Skip to main content
QUICK REVIEW

[Paper Review] FlashDecoding++: Faster Large Language Model Inference on GPUs

Ke Hong, Guohao Dai|arXiv (Cornell University)|Nov 2, 2023
Topic ModelingComputer Science14 citations
TL;DR

FlashDecoding++ is a fast LLM inference engine that optimizes attention softmax synchronization, flat GEMM utilization, and dataflow adaptability to achieve substantial speedups on NVIDIA and AMD GPUs compared to Hugging Face and other baselines.

ABSTRACT

As the Large Language Model (LLM) becomes increasingly important in various domains. However, the following challenges still remain unsolved in accelerating LLM inference: (1) Synchronized partial softmax update. The softmax operation requires a synchronized update operation among each partial softmax result, leading to ~20% overheads for the attention computation in LLMs. (2) Under-utilized computation of flat GEMM. The shape of matrices performing GEMM in LLM inference is flat, leading to under-utilized computation and >50% performance loss after padding zeros in previous designs. (3) Performance loss due to static dataflow. Kernel performance in LLM depends on varied input data features, hardware configurations, etc. A single and static dataflow may lead to a 50.25% performance loss for GEMMs of different shapes in LLM inference. We present FlashDecoding++, a fast LLM inference engine supporting mainstream LLMs and hardware back-ends. To tackle the above challenges, FlashDecoding++ creatively proposes: (1) Asynchronized softmax with unified max value. FlashDecoding++ introduces a unified max value technique for different partial softmax computations to avoid synchronization. (2) Flat GEMM optimization with double buffering. FlashDecoding++ points out that flat GEMMs with different shapes face varied bottlenecks. Then, techniques like double buffering are introduced. (3) Heuristic dataflow with hardware resource adaptation. FlashDecoding++ heuristically optimizes dataflow using different hardware resource considering input dynamics. Due to the versatility of optimizations in FlashDecoding++, FlashDecoding++ can achieve up to 4.86x and 2.18x speedup on both NVIDIA and AMD GPUs compared to Hugging Face implementations. FlashDecoding++ also achieves an average speedup of 1.37x compared to state-of-the-art LLM inference engines on mainstream LLMs.

Motivation & Objective

  • Motivate faster LLM inference due to high computational cost in real-world deployments.
  • Identify bottlenecks in decode-phase GEMM/attention and propose targeted optimizations.
  • Develop a unified framework that adapts to different hardware back-ends and input dynamics.
  • Demonstrate performance gains over state-of-the-art inference engines across multiple models and GPUs.

Proposed method

  • Introduce asynchronized softmax with a unified max value to remove cross-partial synchronization in attention.
  • Optimize flat GEMM by padding to 8 and applying double buffering to hide memory latency.
  • Develop a heuristic dataflow that selects between CUDA Core and Tensor Core implementations based on workload inflection points.
  • Profile and build an offline lookup-based decision flow to map GEMV/GEMM shapes to the optimal kernel.
  • Evaluate across NVIDIA and AMD GPUs using Llama2, OPT, and ChatGLM2 models against multiple baselines.

Experimental results

Research questions

  • RQ1Can asynchronous softmax with a unified maximum value eliminate synchronization overhead in partial softmax computations?
  • RQ2How can flat GEMM be optimized for decode-phase LLM workloads to improve utilization without padding-induced waste?
  • RQ3Can a heuristic dataflow adaptively route GEMV/GEMM workloads to the most suitable hardware kernels to maximize throughput across varying input dynamics and hardware configurations?
  • RQ4What are the performance gains of FlashDecoding++ over Hugging Face and other state-of-the-art LLM inference engines on mainstream GPUs?

Key findings

  • Achieves up to 4.86× speedup over Hugging Face on NVIDIA and AMD GPUs in the decode phase.
  • Achieves up to 3.93× speedup over Hugging Face on AMD GPUs.
  • Provides an average of 1.37× speedup versus FlashDecoding, a state-of-the-art LLM inference engine, across various models.
  • Attains an average speedup of 1.37× on Tesla A100 when compared with FlashDecoding.
  • Delivers competitive performance across multiple models including Llama2, OPT, and ChatGLM2.
  • Proves effectiveness of asymmetric softmax, double-buffered flat GEMM, and hardware-adaptive dataflow across back-ends.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.