Fused Shared-Memory Kernels for Dual-Path Chunkwise Delta Attention
A fused GPU kernel system that computes dual-path chunkwise linear attention interactions in shared memory to eliminate the latency and memory bandwidth overhead of residual state writes.
Time
Compute level
Resources
What the paper used
Prerequisites
Scope
The Gap
In Section 4.3 and Section 5, chunkwise parallel training computes two distinct causal interaction matrices, L and J, and two output projection components, Pu and Pr. These separate operations require additional matrix multiplications and global memory reads/writes during the intra-chunk forward and backward passes.
“Within this schedule, residual writing contributes additional matrix products to the correction, state, and output computations while retaining the same C × C triangular system size.”
Limitation
Stable GDN-2 introduces significant memory bandwidth and runtime overhead by evaluating separate intra-chunk interaction matrices and auxiliary states for symmetric and residual pathways across global GPU memory.
Proposed Solution
Develop a specialized fused Triton/CUDA kernel that loads keys, symmetric factors, and residual factors simultaneously into SRAM. Compute the causal lower triangular products for both pathways within a single shared-memory tiling loop, reusing the cumulative decay vector and shared value matrix to evaluate token updates and output blocks in a single kernel pass.
Why This Matters
Fusing the dual-path computation is expected to reduce intra-chunk latency by 25-40% and match the training throughput of simpler linear attention baselines like KDA.
How to Get Started
How to test it: Benchmark the fused kernel against the unfused PyTorch implementation across chunk sizes 64 to 256 on 64K sequences. Discontinue if kernel compilation overhead or register spilling prevents achieving at least a 20% speedup in end-to-end forward-backward step time.
- Profile the existing Stable GDN-2 chunkwise implementation with PyTorch Profiler to pinpoint memory bandwidth bottlenecks in computing auxiliary matrices.
- Draft a Triton kernel that fuses the calculation of the strictly lower triangular causal matrices for both symmetric and residual terms within block SRAM.
- Benchmark forward and backward pass speeds against standard KDA across key/value dimensions 64 and 128.
- Integrate the fused kernel into the 1.6B Stable GDN-2 pretraining pipeline and verify exact numerical equivalence with the reference implementation.
Suggested by AI. Adapt it to your setup.
Has This Been Done?
The listed works explore hardware acceleration, fused compiling, and various forms of delta attention such as Systolic Linear Attention and FlexLinearAttention, but none of them detail a fused shared-memory Triton/CUDA kernel specifically designed for dual-path chunkwise delta attention utilizing a single shared-memory tiling loop.
- FlexLinearAttention: Compiling a Unified Abstraction into Scalable Kernels for Linear Attention · 2026 · 0 citations
- Systolic Linear Attention: Co-Designing Tile-Grouped Gated Delta Attention for TPUs · 2026 · 0 citations
We searched OpenAlex and arXiv for “fused chunkwise delta rule triton kernel linear attention” and “Fused Shared-Memory Kernels for Dual-Path Chunkwise Delta Attention” and an AI compared the idea with the top 10 results. A small search can miss relevant work.
Source Paper
Stable Gated DeltaNet-2: Understanding and Mitigating Recurrent State InstabilityXichong Zhang, Xixuan Hao, Zhichen Liu +11 more · 2026
This paper investigates recurrent state instability in Gated DeltaNet-2 (GDN-2), demonstrating that asymmetric erase operators induce non-normal state transitions whose directional gains accumulate and trigger exponential state growth and training crashes during long-context training. To resolve this, the authors introduce Stable GDN-2, which enforces non-expansive recurrent state propagation via symmetric erasure while preserving update flexibility through decay-regulated residual writing. Evaluated at the 1.6B parameter scale across recurrent and hybrid configurations, Stable GDN-2 eliminates catastrophic numerical failures, guarantees an O(sqrt(T)) recurrent state norm bound, and improves long-context retrieval scores on RULER at 128K context length.
Related Ideas
- Fused Latent-Cache Attention and Memory-Coalesced Binary Factorized CUDA KernelsLittleBit: Ultra Low-Bit Quantization via Latent Factorization🟠Medium
- Dual-Axis KV Sharing: Integrating Joint-KV with Cross-Layer and Prefix-Shared AttentionMulti-Branch Transformer🟠Medium
- Integration of Sequence Parallelism for Long-Context TrainingLlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models🔴Hard
- Graph-Compatible Dynamic Sparse Attention for End-to-End Prefix CaptureTideway: Phase-Aware Tiered Memory Management for MoE Inference on Consumer Devices🟡Fairly easy
- Joint Inter-DP and Intra-Sequence Layout Optimization for Multi-Document Sparse AttentionTeleChat to Xing4: Advancing Frontier Agentic Models on Domestic Chips and Frameworks🟠Medium