Constrained Dynamic Shapes: 23x Prefill Throughput Boost

Techniques like Roofline AI constrain dynamic prompt lengths to hardware-friendly multiples (e.g., 32) at the input layer, enabling efficient fixed-size tensor instructions and achieving up to 23 times higher prefill throughput on GPUs and NPUs.

The top 3

  1. Constrained Shapes: Resolving LLM Dynamic Input vs. Hardware Mismatch: Constrained dynamic shapes tackle the fundamental conflict between variable LLM prompt lengths and hardware optimized for fixed-size computations. By applying padding once at the input and propagating these guarantees, this method allows downstream operations to utilize efficient fixed-size instructions, achieving up to 23x higher prefill throughput compared to baselines without dynamic shape optimizations.
  2. Compiler's Role: Input-Level Padding & Symbolic Shape Propagation: The 23x prefill throughput boost stems from compiler-driven strategies, primarily input-level padding coupled with constrained dynamic input shapes. This approach, implemented in systems like Roofline's dynamic-shape-aware compiler infrastructure, ensures that hardware-friendly shapes are propagated throughout the network, avoiding costly runtime fixes and enabling efficient tensor instruction use.
  3. Prefill Throughput Gains: Constrained vs. Operator Padding: While operation-level padding alone can improve LLM prefill performance by roughly 3x, the combination of input-level padding and constrained dynamic input shapes achieves a significantly larger boost, exceeding 23x. This highlights constrained dynamic shapes as a superior method for optimizing the compute-bound prefill phase, surpassing less integrated dynamic shape handling techniques.

Sources

Open the full topic