Skip to content

[TRITON][GLUON] Add Triton and Gluon kernels for DSv4 compressed sparse attention - #3456

Closed
leonling-ll wants to merge 12 commits into
ROCm:mainfrom
leonling-ll:liyang/dsv4_dsa_tt_gl
Closed

leonling-ll wants to merge 12 commits into
ROCm:mainfrom
leonling-ll:liyang/dsv4_dsa_tt_gl

Conversation

@leonling-ll

@leonling-ll leonling-ll commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

This PR aims to add triton and gluon implementation for deepseek v4 compressed sparse attention, targeting to gfx950.

The triton kernels are adapted from vLLM mla_sparse_dsv4 with enabling triton autotune.

The optimization on gluon impl is in progress.
Current status of prefill kernel is

Q H Kv topk triton ms gluon ms triton TFLOPS gluon TFLOPS triton GB/s gluon GB/s speedup
4096 128 4096 512 1.787 1.025 192.152 335.039 1351.607 2356.684 1.74×
4096 128 4096 1024 3.269 1.784 209.003 383.098 1144.831 2098.452 1.83×
8192 128 8192 512 3.579 2.073 191.040 329.769 1346.273 2323.906 1.73×
8192 128 8192 1024 6.522 3.725 211.179 369.753 1154.193 2020.877 1.75×

The shapes come from deepseek v4 original paper: https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro/blob/main/DeepSeek_V4.pdf

cc: @Dewei-Wang-sh

@leonling-ll leonling-ll self-assigned this Jun 1, 2026
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 3456 --add-label <label>

@leonling-ll
leonling-ll force-pushed the liyang/dsv4_dsa_tt_gl branch from e7dd650 to bc2127f Compare June 3, 2026 02:41
@leonling-ll
leonling-ll force-pushed the liyang/dsv4_dsa_tt_gl branch from 8e731a4 to 24aef76 Compare June 16, 2026 07:10
Adopt autotune to prefill/decode triton kernels
Enable double buffering

Add test file

BH32, kernel persistance, stage 3 -> bad perf ~100T

update

update decode

Remove autotune

Adopt num_warps=8 for decode

Align interface

Remove buffer store mask if not needed

Remove unnecessary score mask in main loop, 420 TF

Prefill cleanup

Prefill Adopt BK64 and only cache KV in LDS 480TF

Prefill Cancel persistent 500TF

Reorder instructions 517 TF

Handle prefill num_iter < 2 case
@leonling-ll
leonling-ll force-pushed the liyang/dsv4_dsa_tt_gl branch from d3ee729 to 06ff289 Compare June 19, 2026 09:27
wangye805 added a commit that referenced this pull request Jun 22, 2026
Gluon forward for V4 sparse MLA, opt-in via sparse_mla_fwd_v4(..., backend="gluon").
Based on Leon's (leonling-ll) V3.2 gluon forward from leonling-ll/aiter branch
liyang/dsa (cf. his DSA PR #3456); adds the V4 attention-sink epilogue
(sink-inclusive LSE) to match sparse_mla_fwd_v4. Default stays Triton.

Forward speedup vs Triton on MI355X (with sink): Flash CSA T=4K 1.09x, T=8K 1.28x,
Pro CSA T=4K 1.37x. Validated vs the Triton forward (O + LSE; sink in {None,+1,-1,-1e3}).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant