The Unified Flow: Symbolic Shapes Across TVM's Abstraction Layers
The core technical breakthrough of TVM Unity is allowing symbolic dimensions (e.g., `n` for batch size, `m` for sequence length) to flow and be understood across computational graphs, tensor programs, and hardware primitives, enabling new cross-layer co-optimizations.
The top 3
- Relay's Dynamic Shape Limitations vs. Unity's Breakthrough: Before TVM Unity, the older Relay IR struggled with dynamic shapes, representing unknown dimensions as generic 'Any'. This limitation prevented critical compile-time optimizations, pushed memory allocation and computation decisions to runtime, and reduced the expressibility for dynamic workloads, leading to performance bottlenecks.
- How TVM Unity Unifies Symbolic Shapes Across Abstraction Layers: TVM Unity, particularly through its Relax IR, achieves a 'unified flow' by implementing first-class symbolic shape support across all abstraction layers. This means dynamic dimensions (e.g., `n`, `m`) are globally tracked from high-level computational graphs down to low-level TensorIR and hardware primitives, enabling seamless information exchange and cross-layer interactions for advanced optimizations.
- Top 3 Optimization Gains from Unified Symbolic Shapes: The unified flow of symbolic shapes in TVM Unity delivers crucial optimization benefits: 1) enabling compile-time deduction of complex tensor relationships, which unlocks more efficient memory allocation and computation; 2) vastly improving support for dynamic workloads, such as varying batch sizes or sequence lengths in LLMs; and 3) facilitating novel cross-layer optimizations by allowing high-level graph decisions to be informed by low-level TensorIR automation.
Sources
Open the full topic