Skip to content

feat(glm-dsa): GLM-5.2 sparse-MLA construct-time determinism (deep-align)#1695

Open
yhl-amd wants to merge 4 commits into
ROCm:mainfrom
yhl-amd:glm52-deep-align-mainline
Open

feat(glm-dsa): GLM-5.2 sparse-MLA construct-time determinism (deep-align)#1695
yhl-amd wants to merge 4 commits into
ROCm:mainfrom
yhl-amd:glm52-deep-align-mainline

Conversation

@yhl-amd

@yhl-amd yhl-amd commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What

Port of the GLM-5.2 sparse-MLA determinism work onto current main (673e6e0). Makes the sparse-MLA indexer pipeline construct-time deterministic (NV-aligned), which eliminates cross-rank / run-to-run KV-subset divergence that corrupts long generations on gfx950.

Commits:

  • cause 1/3/4 (deepseek_v2.py, linear.py): small-M bf16 projections use deterministic F.linear (not non-deterministic tgemm.mm); ENABLE_ALLREDUCE_RMSNORM_FUSION / ENABLE_DS_INDEXER_QK_ROPE_CACHE_FUSION / ENABLE_GLM_FUSED_INDEXER forced off (mainline's own unfused branches). Deliberately does NOT disable QKNORM/INPUT_RMSNORM fusions (their unfused path is buggier).
  • frontend: GLM <tool_call>...<arg_key> parser + vLLM-style streaming UTF-8 detok (no U+FFFD split of CJK/emoji) + ANTHROPIC_DEFAULT_TOP_P=0.9.
  • frequency/presence penalty end-to-end + opt-in logit NaN check.
  • docs: determinism incident writeup.

cause 2 (deterministic top-k tie-break) is in the companion aiter PR (ROCm/aiter#4376) + TOPK_FORCE_PATH=o.

Verification (GLM-5.2-MXFP4, tp8, gfx950)

  • greedy determinism 4/4-distinct → 3/4-identical; tool calls OK; streaming CJK/emoji clean (0 U+FFFD); long-analysis corruption 0/N on the synthetic oracle.

Caveats for review

  • tool_parser.py is ported wholesale from the GLM-5.2 branch and overwrites mainline's current tool_parser; it needs reconciliation with any newer mainline tool-parser handlers before merge.
  • abort-on-client-disconnect commits are already in mainline and were intentionally excluded.

🤖 Generated with Claude Code

hyi and others added 4 commits July 24, 2026 14:32
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wire frequency_penalty/presence_penalty through sampling_params -> sequence
token_counts -> scheduler sparse penalty triples -> model_runner _apply_penalties
(bf16-cast to match logits). Adds opt-in _check_logits_finite (ATOM_DEBUG_LOGIT_NANCHECK)
and tests/test_sampler.py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…+ sampling defaults

Port onto latest mainline (673e6e0): bring the GLM-5.2 <tool_call>...<arg_key>
tool-call parser (mainline's tool_parser lacks the arg_key format), add vLLM-style
sliding-window incremental detokenization (no U+FFFD split of CJK/emoji during
streaming), and ANTHROPIC_DEFAULT_TOP_P=0.9 + temperature handling for /v1/messages.
abort-on-disconnect is already in mainline (skipped).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e 1/3/4)

Port cause 1/3/4 onto mainline (673e6e0) via native's own unfused paths,
NOT the old branch's dead-code deletion:
- cause 1 (linear.py): small-M bf16 projections use deterministic F.linear
  instead of nondeterministic aiter tgemm.mm.
- cause 3: ENABLE_ALLREDUCE_RMSNORM_FUSION=False (separate all-reduce + RMSNorm).
- cause 4: ENABLE_DS_INDEXER_QK_ROPE_CACHE_FUSION=False + ENABLE_GLM_FUSED_INDEXER
  =False (mainline already has the unfused branches; just flip the flags).
cause 2 (deterministic top-k tie-break) is handled in aiter's topk kernel +
TOPK_FORCE_PATH=o, so no deepseek_v2 change is needed for it here. Deliberately
does NOT disable QKNORM/INPUT_RMSNORM fusions (their unfused path is buggier).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every eligible PR before approval:

  • ✅ Pre Checkin: Black, Ruff, catalog schema validation, non-GPU unit tests

Heavy model tests:

  • ✅ Run after the PR is approved and Pre Checkin passes
  • ✅ Run immediately when an approval review is submitted
  • ✅ Can be requested before approval with labels
Label Tests
ci:full Run all heavy PR model tests: native ATOM, vLLM, and SGLang
ci:atom Run native ATOM model accuracy tests
ci:vllm Run ATOM vLLM OOT model accuracy tests
ci:sglang Run ATOM SGLang model accuracy tests

Heavy jobs are skipped when the PR is not approved and no matching ci:* label is present.
Add labels via the sidebar or gh pr edit 1695 --add-label <label>

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