Amazon ScienceStephen Zorio11 min readadvanced
A kernel-centric path to real-time video generation on Trainium
Summary
AWS Neuron Science and Reactor optimized real-time autoregressive diffusion video generation on Trainium. They achieved production-grade performance by using the Neuron Kernel Interface for direct hardware control and a hybrid sharding strategy to overcome challenges like dynamic shapes and memory access patterns.
- Real-time autoregressive diffusion models for video generation face challenges from dynamic shapes, unusual memory access, and heavy cache management.
- The Neuron Kernel Interface (NKI) provides direct hardware control to optimize bottlenecks, reducing 3D-RoPE kernel time from 5s to 1.8ms.
- NKI-Dev-Suite generated optimized kernels, enabling the pipeline to use 11GB HBM where standard eager-mode ran out of memory.
- A hybrid sharding strategy (sequence and tensor parallelism) was crucial for self-attention in long video sequences, which consumes 70% of compute.
Engineers deploying large generative AI models, especially for real-time video or interactive applications, will find this valuable for understanding hardware-specific optimization techniques.
7/10

