Repository navigation
Sync nv_dev with upstream #462, #471 and #478 - #509
Merged
RayWang96 merged 10 commits intoNov 19, 2026
Merged
Conversation
* Public release 26/09 * Update News
Add locality-aware Mega MoE execution, GEMM epilogue classes with BF16 stochastic rounding, wider sparse MQA head support, and packed SF strides. Improve Indexer and Mega MoE pipelines, update attention and Mega Gate interfaces, and include runtime and correctness fixes. Export the current source through the OSS filter while retaining public release history and the Mega MoE task-info release-ordering fix. Co-authored-by: Anyi Xu <[email protected]> Co-authored-by: huahuaquq <[email protected]> Co-authored-by: TwenTy_ <[email protected]> Co-authored-by: xyf007 <[email protected]> Co-authored-by: Yongqi Zhuo <[email protected]> Co-authored-by: yukuai26 <[email protected]> Co-authored-by: Zhean Xu <[email protected]>
Add FP8CastWithClamp with optional clamped-element counts, consolidate GEMM epilogue conversions, and accept 128-byte paged sparse KV strides. Keep the Mega MoE localizer alive until test teardown and bump the package version to 2.8.2. Co-authored-by: xyf007 <[email protected]> Co-authored-by: yukuai26 <[email protected]> Co-authored-by: Zhean Xu <[email protected]>
A CUDA graph kernel node keeps the same %gridid on every replay. The mega_mhc split barriers tag each execution with %gridid, so after a replay a barrier line still holds encode_state(grid_idx, kNumSplits), which is exactly the state the next replay waits for. A Mix or Norm waiter whose m-block init CTA has not started yet proceeds immediately and reads the previous replay's split partials. Tag executions with an epoch instead. The epoch and an exit count live in the unused tail of the first barrier line, so the host-side buffer is unchanged. Every CTA reads the epoch after cudaGridDependencySynchronize, and the last CTA to retire resets the exit count and advances the epoch. Signed-off-by: lightseek-bot <[email protected]>
…i#432: Public Release 26/09) as merged into nv_dev deepseek-ai#447 brought the content of upstream 66081d4 (deepseek-ai#432) and 78b6900 (deepseek-ai#441) into nv_dev, but was squash-merged, so neither commit became an ancestor of nv_dev and the merge base with main stayed at 559d79f (deepseek-ai#377). This merge records 78b6900 as the second parent without changing any file, so the next upstream merge starts from 78b6900 instead of re-applying 26/09. Checked before recording: of the 128 files upstream changed between 559d79f and 78b6900, 97 are byte-identical on nv_dev; a three-way merge of 78b6900 changes no file outside its conflicts except smxx_clean_logits.cuh, which upstream deleted and nv_dev keeps for the SM120 and SM100 FP16-weight MQA logits; and every upstream-side line in the 25 conflicted files is present on nv_dev or replaced by an nv_dev change (SM120 arch/alignment generalizations, deepseek-ai#459, deepseek-ai#396). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rriers under CUDA graph replay) into nv_dev Brings deepseek-ai PRs deepseek-ai#462 (057ca59, Public release 26/09/30), deepseek-ai#471 (1fc9c66) and deepseek-ai#478 (5081f85) onto nv_dev (b4c138c). Merge base is 78b6900. API follows upstream: * MQA logits: `clean_logits` is removed, `max_seqlen_k` is required, and the SM100 paged metadata is varlen-only. nv_dev keeps one extension: a `logits_dtype` keyword (FP32 or BF16, after `max_seqlen_k` / `max_context_len`). It defaults to BF16 on SM100 and FP32 on SM90/SM120. * The legacy `fp8_mqa_logits` / `fp8_paged_mqa_logits` wrappers and `fp8_gemm_nt_skip_head_mid` are removed, as upstream removed them. * GEMM/einsum epilogues take upstream's `EpilogueClass` objects. Conflict resolution highlights: * Epilogues: the SM120 BF16 and FP8/FP4 GEMM kernels move from `epilogue/transform.cuh` to the `epilogue/operators.cuh` operator API (`EpilogueOperatorArgs`, `Identity`); `HeadSplits` and `apply_index_n` are gone. The device files match DeepGEMM-sm120 v0.2.0. SM120 GEMMs reject custom epilogue classes; the SM120 BF16 einsum takes `C` and accepts only a plain BF16 store on its native path, checked before `D` is written. * MQA logits: adopt upstream's dense/paged/sparse host code while keeping nv_dev's SM120 dense, paged and sparse paths, the SM90 block_kv=32 and next_n=4 multicast, and the SM100 FP16-weight path. * Sparse MQA logits: follow upstream's `kNumMaxHeads` layout and the `kPartialTailFlag` bit in the KV split header. nv_dev keeps its metadata, device, alignment and weight-stride checks, the 16-byte paged KV stride (deepseek-ai#459) and workspace reuse under graph capture (deepseek-ai#459). * Mega MoE, mega_mhc, locality domain, layout and runtime: upstream. * README: upstream. docs/scaling-factor-format.md describes the new API. * Tests: SM120 tests move to the new API (no `clean_logits`, 0x3fffffff KV count mask, required `max_seqlen_k`) and add coverage for the plain FP8 GEMM store branches and the SM120 einsum `C` input. test_nv_attention_restoration.py no longer imports removed helpers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
) Upstream 26/09/30 made the SM100 dense and paged MQA logits kernels take BF16 weights and write BF16 logits only. nv_dev callers pass FP32 weights and read FP32 logits, so port vllm-project#46: the SM100 kernel is templated on the weights and logits types again, and the host accepts FP32 or BF16 weights on SM100 (MX inputs). `logits_dtype` now defaults to the weights' precision: BF16 weights reduce in BF16 and require (and default to) BF16 logits; FP32 and FP16 weights default to FP32 logits. This is the same default on every architecture. Non-MX FP8 inputs on SM100 still take the FP16-weight path only. Tests: test_nv_attention_restoration.py checks the SM100 unified dense kernel with MXFP8 inputs and FP32/BF16 weights, eager against scheduled, bitwise. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The SM120 sparse MQA kernel reads `layout/sparse_mqa_logits.cuh`, which is shared with SM100 and follows upstream. Assert the parts of it the kernel reads (struct sizes and field offsets, slot packing, KV split flag mask), so a future upstream format change fails to compile instead of producing wrong logits. The device file matches DeepGEMM-sm120 v0.2.0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The MQA logits APIs no longer take `clean_logits`. Also note that the SM100 FP16-weight path is the only non-MX FP8 MQA logits path on SM100. Co-Authored-By: Claude Opus 5.5 <[email protected]>
lucifer1004
added a commit
to lucifer1004/DeepGEMM
that referenced
this pull request
Nov 19, 2026
…deepseek-ai#441, deepseek-ai#462, deepseek-ai#471) as merged into nv_dev deepseek-ai#509 synced these upstream commits into nv_dev but was squash-merged, which kept their changes and dropped their ancestry. Without it the next upstream sync would see them as unmerged and re-apply them from an older merge base. This merge uses the 'ours' strategy: the tree is unchanged.
RayWang96
added a commit
that referenced
this pull request
Nov 19, 2026
SM120 batch invariance under deterministic algorithms (stacked on #509)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merges upstream
5081f85(#478) intonv_devatb64107f(#459). This brings in #462 (Public release 26/09/30) and #471; the merge base is78b6900.The branch keeps the topology of the previous
nv_devsyncs (#314, #328, #349, #384): an explicit non-fast-forward merge with the upstream commit as the second parent. Please merge without squashing.Commits:
b4c138crecords upstream78b6900(Fix Mega MoE task info slot release ordering #441, on top of Public Release 26/09 #432: Public Release 26/09) as merged intonv_dev, with-s ours. Integrate main APIs and SM120 kernels while preserving nv_dev features #447 brought that content in as a squash, so Git did not knownv_devalready had it, and merging Public release 26/09/30 #462 directly would have replayed all of 26/09 as conflicts. Before recording the merge I checked thatnv_devcontains Public Release 26/09 #432/Fix Mega MoE task info slot release ordering #441: the files Integrate main APIs and SM120 kernels while preserving nv_dev features #447 left byte-identical to78b6900cover everything except nv_dev's own extensions.5d42ae5merges5081f85. Conflict resolution is listed below.c83713drestores FP32 weights and logits in SM100 MQA logits, porting Restore FP32 MQA logits and the logits_dtype switch vllm-project/DeepGEMM#46.a15b023pins the sparse MQA metadata layout in the SM120 kernel at compile time.72e97d7drops staleclean_logitsnotes from the README.API
The API follows upstream, with one addition:
clean_logitsis removed,max_seqlen_kis required, and the SM100 paged metadata is varlen-only.fp8_mqa_logits,fp8_paged_mqa_logitsandfp8_gemm_nt_skip_head_midare removed, as upstream removed them.EpilogueClassobjects.fp8_fp4_mqa_logitsandfp8_fp4_paged_mqa_logitstake alogits_dtypekeyword (torch.float32ortorch.bfloat16) aftermax_seqlen_k/max_context_len. It defaults to the weights' precision: BF16 weights reduce in BF16 and require BF16 logits; FP32 and FP16 weights default to FP32 logits. The default is the same on every architecture.On SM100, upstream 26/09/30 made the dense and paged MQA kernels MX-only, with BF16 weights and BF16 logits.
c83713drestores FP32 weights with FP32 logits for MX inputs.Upstream also removed the non-MX branch (
kIsMXSF: FP8 with per-token FP32 KV scales). This sync does not restore it, matching upstream and vllm-project/DeepGEMMdev. On SM100, non-MX FP8 MQA logits are now available only through nv_dev's dense FP16-weight path, and non-MX paged MQA logits are not available. Callers of that format, such as V3.2-style indexers, need to convert to MXFP8 or use FP16 weights for dense. V4/V4.1 use MX inputs and are not affected.Conflict resolution
epilogue/transform.cuhto theepilogue/operators.cuhoperator API (EpilogueOperatorArgs,Identity);HeadSplitsandapply_index_nare gone. SM120 GEMMs reject custom epilogue classes. The SM120 BF16 einsum takesC. Its native path accepts only a plain BF16 store, and this is checked beforeDis written.block_kv=32andnext_n=4multicast, and the SM100 FP16-weight path.kNumMaxHeadslayout and thekPartialTailFlagbit in the KV split header. Kept nv_dev's metadata, device, alignment and weight-stride checks, the 16-byte paged KV stride, and workspace reuse under graph capture (Sparse MQA logits follow-ups for nv_dev: 16-byte paged KV stride, workspace reuse under graph capture #459).docs/scaling-factor-format.mddescribes the new API.clean_logits, the0x3fffffffKV count mask, a requiredmax_seqlen_k.Cinput.test_nv_attention_restoration.pyno longer imports removed helpers. It checks the SM100 unified dense kernel with MXFP8 inputs and FP32/BF16 weights, eager against scheduled, bitwise.SM120 device layer
The SM120 device headers are byte-identical to lucifer1004/DeepGEMM-sm120 v0.2.0, which targets the 26/09/30 epilogue-operator API. The sparse MQA layout (
layout/sparse_mqa_logits.cuh) is no longer vendored; it is the shared file upstream maintains.The kernel therefore asserts every part of that layout it reads: struct sizes and field offsets, slot packing, and the KV split flag mask. A future upstream format change, such as another flag, fails to compile instead of producing wrong logits. Both current flags are hints the SM120 kernel may ignore, because it bounds-checks every KV token it copies.
The DeepGEMM-sm120 compile gate passes against this branch and against vllm-project/DeepGEMM
dev(44cba7d). With an extra flag bit added to the layout it fails as intended. Format changes are caught at compile time, but changes in meaning are not, so syncs should still runtests/test_sm120_attention.pyon SM120.Validation
CUDA 13.2, torch 2.13.0+cu132. Each run uses a freshly built package and an empty JIT cache.
SM120 (RTX PRO 6000 Blackwell): all 712 SM120 tests pass:
test_sm120_attention.pytest_sm120_gemm.pyAfter the last commit,
test_sm120_attention.pywas re-run from an empty JIT cache and passed again.SM90 (H200): every file was run on this branch and on
nv_devb64107f; nothing regresses.test_attention.py(dense, paged and sparse MQA logits),test_bf16.py,test_fp8_fp4.py,test_einsum.py,test_layout.py,test_hyperconnection.py,test_legacy.py,test_mega_gate.py,test_mega_mhc.py,test_pack_ue8m0.py, and the Mega MoE SM90 and contract tests.test_nv_attention_restoration.py: 105 passed on both; fewer skipped cases, because theclean_logitsand legacy-wrapper variants were removed.test_lazy_init.py: 3 passed. Onb64107fno tests are collected.test_locality_domain.py(new upstream): 3 tests need MLOPart, which the H200 host does not provide.SM103 (B300, single GPU): every test file passes on this branch:
test_attention.py: dense, paged and sparse MQA logits, the full SM100 matrix.test_nv_attention_restoration.py: 78 passed. This includes the FP16-weight path and the restored FP32 weights/logits, eager against scheduled, bitwise.test_bf16.py,test_fp8_fp4.py,test_einsum.py,test_layout.py,test_hyperconnection.py,test_lazy_init.py,test_legacy.py,test_locality_domain.py,test_mega_gate.py,test_mega_mhc.py,test_pack_ue8m0.py.test_mega_moe.pyandtest_nvfp4_mega_moe.pypass their correctness checks with--num-processes 1.The merge introduces no new
git diff --checkwarnings againstnv_dev. No conflict markers remain, and no project include points at a removed header.Cautions
🤖 Generated with Claude Code