Cross-Layer Optimization's Edge: Dynamic Shape & Fusion

The merged Relax-TIR IR leverages first-class symbolic shapes to enable dynamic shape-aware, cross-layer optimizations, from high-level graph fusion down to precise tensor operation scheduling.

The top 3

  1. Dynamic Shapes: Solving LLM Edge Inference Bottleneck: Dynamic input shapes, common in LLMs due to variable prompt lengths, typically hinder efficient on-device inference on hardware optimized for fixed-size computations. Techniques like constrained dynamic shapes, which pad inputs to hardware-friendly multiples once, can boost prefill throughput by over 23x by ensuring efficient use of fixed-size tensor instructions across the entire network.
  2. Kernel Fusion's LLM Performance Multipliers: Kernel fusion combines multiple operations into a single GPU kernel, drastically reducing memory traffic, latency, and boosting throughput by keeping intermediate results in fast on-chip memory. This lossless optimization, crucial for memory-bound LLMs, can yield significant speedups; for example, FlashFuser achieved up to 4.1x kernel speedup and 1.24x end-to-end throughput on LLM workloads.
  3. Cross-Layer Synergy: Dynamic Shape + Fusion Edge: Combining dynamic shape handling with kernel fusion creates a powerful cross-layer optimization synergy. Dynamic shape ensures consistent, hardware-friendly tensor dimensions throughout the model, while fusion consolidates operations across these optimized shapes, maximizing data locality and minimizing memory overhead, leading to more comprehensive and efficient LLM inference performance than isolated optimizations.

Sources

Open the full topic