How FlashKDA v1 kernel fusion works
masterFlashKDA v1 achieves high performance by partitioning the Kimi Delta Attention computation into two distinct kernels (K1 and K2) to maximize parallelism and avoid SM (Streaming Multiprocessor) idling.
- K1 (Token-parallel): Operates on a grid of
N × H × num_chunks. It handles the initial stages:gactivation, L2 normalization, decay application,L/Mqkconstruction, and matrix inversion. - K2 (Head-parallel): Operates on a grid of
N × H. It handles the recurrence and projection: chunk-by-chunk delta-rule recurrence, output projection, and running state accumulation.
Splitting the pipeline into these two kernels provides at least a 15% end-to-end speedup compared to a single fused kernel design.