Skip to content

[DSA][GLM5.2] Index Share for MHA - #29959

Merged
Fridge003 merged 22 commits into
sgl-project:mainfrom
mattteochen:dsa/glm52-indexshare-mla
Jul 4, 2026
Merged

Fridge003 merged 22 commits into
sgl-project:mainfrom
mattteochen:dsa/glm52-indexshare-mla

Conversation

@mattteochen

@mattteochen mattteochen commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Closes #29951

Indexer is run on Layer38, Layer39 skips it.
Screenshot 2026-07-03 at 09 30 58

Modifications

  • Skip DSA indexer on shared indexer layers.

Accuracy Tests

== aime25 ==
30 examples x 16 repeats  |  4721.4s  |  1943 tok/s  |  9.2M tokens

* pass@1[avg-of-16]  =  90.83% +/- 3.94% (SEM 0.99%)
  pass@16            =  100.00%
  majority@16        =  93.33%
  no_answer          =  0.21%
  stop_rate          =  100.00%
  truncated_rate     =  0.00%
  error_rate         =  0.00%

Cookbook reports 87.7 %.

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Run #28653902841
Latest PR Test (Extra): ❌ Run #28653902712

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@mattteochen
mattteochen marked this pull request as ready for review July 3, 2026 07:10
@Fridge003

Copy link
Copy Markdown
Collaborator

Can you please attach a screenshot of profiler results. So that indexer can be correctly skipped when mha is called

mattteochen commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor Author

glm52-indexsharefix_batch8_input1024_output1024_prefill.trace.json.gz

@Fridge003 Thanks for checking this. I re-inspected the prefill profile glm52-indexsharefix_batch8_input1024_output1024_prefill.trace.json.gz and the trace does show the intended behavior.

This run is the eager prefill/MHA path (step[EXTEND bs=8 toks=8192], eager_runner._execute_extend, no cudaGraphLaunch). All 78 decoder layers call the MHA path, but only the expected non-shared indexer layers call the DSA indexer:

MHA prepare/core calls: 78
DSA backend forward_extend calls: 78
DSA indexer forward_cuda calls: 21
DSA indexer _forward_cuda_k_only calls: 21
GPU fused_k_indexer_norm_rope_store kernels: 21

For GLM-5.2-FP8, the config has num_hidden_layers=78, index_topk_freq=4, and index_skip_topk_offset=3, so the expected indexer-producing layers are:

[0, 1, 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74]

Those are exactly the layers where the trace shows dsa_indexer.forward_cuda and the indexer store kernel. The shared/skip-topk layers still run normal MHA attention work, but they no longer run the DSA indexer/cache-fill work.

@Fridge003 Fridge003 added the run-ci CI: run the baseline test suite on this PR label Jul 3, 2026
@Fridge003

Copy link
Copy Markdown
Collaborator

/rerun-test test/registered/8-gpu-models/test_deepseek_v32_indexcache.py

@github-actions

github-actions Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/8-gpu-models/test_deepseek_v32_indexcache.py:

🚀 8-gpu-h200 (1 test): ✅ View workflow run

cd test/ && python3 registered/8-gpu-models/test_deepseek_v32_indexcache.py

@Fridge003 Fridge003 changed the title [DSA][GLM5.2] Index Share MLA [DSA][GLM5.2] Index Share for MHA Jul 4, 2026
@Fridge003
Fridge003 merged commit 92b800c into sgl-project:main Jul 4, 2026
126 of 149 checks passed
@tobeprozy

Copy link
Copy Markdown

精度下降这么多?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] [GLM5.2] Index share reuse with MHA

3 participants