Smarter Memory Management with Dynamic Shapes
By leveraging symbolic shapes, compilers like BladeDISC++ can develop adaptive memory allocation and rematerialization strategies that efficiently handle varied input sizes at runtime, achieving memory usage comparable to static-shape optimizations.
The top 3
- PagedAttention: Virtual Memory for LLMs: PagedAttention, inspired by OS virtual memory, segments the dynamic KV cache into fixed-size pages, virtually eliminating internal and external memory fragmentation and significantly improving GPU memory utilization for higher LLM serving throughput.
- Compiler's Dynamic Shape Memory Arsenal: Compilers employ strategies like bucketing inputs by similar lengths, symbolic shape propagation to delay concrete allocation decisions, and static memory planning to reuse buffers, effectively optimizing memory usage for varied LLM inputs.
- Dynamic Shape Gains: 23x Throughput Boost: Compiler-driven strategies like constrained dynamic shapes deliver up to 23x higher prefill throughput, directly demonstrating the significant performance and memory efficiency gains from optimizing for varied LLM inputs.
Sources
Open the full topic