Skip to content

Public release 10/14 - #471

Merged
LyricZhao merged 1 commit into
mainfrom
public-sync-20261014
Oct 14, 2026
Merged

LyricZhao merged 1 commit into
mainfrom
public-sync-20261014

Conversation

@LyricZhao

@LyricZhao LyricZhao commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

DeepGEMM 2.8.2

This update adds fused FP8 clamping and statistics, improves GEMM epilogue conversion, and expands paged Sparse Indexer layout support.

New features

  • Fused FP8 cast with optional clamping: deep_gemm.epilogue.FP8CastWithClamp converts BF16-rounded GEMM output to FP8, with optional symmetric clamping before scaling.
  • Optional clamped-element counts: Pass a single-element CUDA torch.uint32 tensor as clamped_count to collect the total asynchronously. Each invocation overwrites the previous count.
  • More flexible paged Sparse Indexer layouts: Paged sparse KV caches now accept page strides aligned to 128 bytes, relaxing the previous 512-byte requirement.

Performance improvements

  • Use packed FP8 conversion and a packed BF16 clamp instruction to improve fused conversion efficiency.
  • Consolidate epilogue conversion paths for FP8 and BF16 outputs, including stochastic rounding.
  • Improve swap-AB epilogue scheduling by preparing scaling factors for both TMEM fragments before FP8 conversion.
  • Reduce clamped-element counts within each warp before updating the global counter.

Fixes

  • Keep the Mega MoE weight localizer alive across correctness iterations and destroy it during final test teardown, avoiding repeated MLOPart and MPS restarts.
  • Update paged Sparse Indexer validation and tests to use the relaxed 128-byte alignment requirement.
  • Extend einsum correctness coverage for clamped FP8 output, scaling factors, and counter overwrite behavior.

Breaking changes

  • deep_gemm.epilogue.FP8Quantization has been replaced by FP8CastWithClamp. Existing callers should update the class name. Omitting clamp_value preserves unclamped conversion.
  • The FP8 (output, sfd) output-pair shorthand remains supported and uses unclamped FP8CastWithClamp.
epilogue = deep_gemm.epilogue.FP8CastWithClamp(
    sfd=sfd,
    clamp_value=clamp_value,      # Optional; None disables clamping
    clamped_count=clamped_count,  # Optional CUDA uint32 tensor with one element
)

Contributors

  • Fused FP8 cast, clamping, statistics, and epilogue optimizations: @xyf007
  • Mega MoE localizer lifecycle fix: @yukuai26
  • Paged Sparse Indexer alignment and release version update: @zheanxu

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]>
@LyricZhao
LyricZhao merged commit 1fc9c66 into main Oct 14, 2026
2 of 3 checks passed
zcnrex added a commit to sgl-project/DeepGEMM that referenced this pull request Oct 16, 2026
…-ai#471) into dev

Two-parent merge of upstream 1fc9c66 (deepseek-ai#441, deepseek-ai#462, deepseek-ai#471) into sgl dev
b296ce3, keeping the SGL wheel, the TORCH_LIBRARY binding and the
downstream kernels.

- Mega MoE: upstream locality-domain scheduling, 4D weight TMA, L1/L2 store
  blocks and the TMEM prefetch epilogue, with NVFP4/MXFP4, TRT-LLM weights,
  alphas, SiTU and FP8 combine carried over. TRT weights stay unlocalized.
- GEMM epilogue classes threaded through every dispatch; SM90/SM120 assert
  that no custom epilogue is set. SM120 kernels drop the head-split epilogue
  parameter, as upstream did for SM90.
- Attention takes upstream's API as-is: no clean_logits/logits_dtype, no
  legacy fp8_mqa_logits/fp8_paged_mqa_logits, no fp8_gemm_nt_skip_head_mid.
  The SM120 MQA kernels that only served the old API are removed.
- Mega gate is sqrtsoftplus-only; bf16_mega_gate defaults to it and
  get_bf16_mega_gate_config is gone.
- TORCH_LIBRARY binding: epilogue classes (Identity, Alpha,
  FP8CastWithClamp, BF16StochasticRounding) cross as
  (kind, scalar, sfd, count) into every GEMM/einsum op; shutdown and the
  locality-domain ops are registered; MLOPart reaches Python through ctypes
  callbacks installed by deep_gemm/locality_domain.py, which re-raises the
  callback's exception from the allocating call.
- sgl_deep_gemm tests pick up upstream's test changes and the new
  test_locality_domain.py.
- Dev's per-expert post-norm (#104) sits on upstream's restructured epilogue
  and combine. Its store block of 48 at block_m 192 becomes the L1 store
  block, upstream's FP8xFP4 L1/L2 blocks at 240 are kept, and
  DG_MEGA_MOE_TILES sets both L1 and L2.
- deep_jit stays at dev's 3732a3b, a descendant of upstream's 2efdab4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zcnrex added a commit to sgl-project/DeepGEMM that referenced this pull request Oct 16, 2026
Merge upstream main (26/09/30 release + deepseek-ai#471) into dev
RayWang96 pushed a commit that referenced this pull request Nov 19, 2026
* Public Release 26/09 (#432)

* Public release 26/09

* Update News

* Fix Mega MoE task info slot release ordering (#441)

* Public release 26/09/30 (#462)

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]>

* Update FP8 epilogues and paged sparse MQA alignment (#471)

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]>

* Fix mega_mhc split barriers under CUDA graph replay (#478)

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]>

* Restore FP32 weights/logits in SM100 MQA logits (port of vllm-project#46)

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]>

* Pin the sparse MQA metadata layout in the SM120 kernel

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]>

* Drop stale clean_logits notes from the README

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]>

---------

Signed-off-by: lightseek-bot <[email protected]>
Co-authored-by: Zhean Xu <[email protected]>
Co-authored-by: Chenggang Zhao <[email protected]>
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: LightSeek Foundation <[email protected]>
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
RayWang96 pushed a commit that referenced this pull request Nov 19, 2026
…r CUDA graph replay) into nv_dev

Brings deepseek-ai PRs #462 (057ca59, Public release 26/09/30), #471
(1fc9c66) and #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
    (#459) and workspace reuse under graph capture (#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]>
RayWang96 added a commit that referenced this pull request Nov 19, 2026
Merge of pull/509/head (72e97d7) without squashing, so that the upstream
merges 78b6900 and 5081f85 stay recorded in nv_dev's history.
Replaces the squash commit c9b569a and its revert c54abc4 (#511).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
zyongye added a commit to vllm-project/DeepGEMM that referenced this pull request Nov 28, 2026
* Public release 26/09/30 (deepseek-ai#462)

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]>

* Update FP8 epilogues and paged sparse MQA alignment (deepseek-ai#471)

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]>

* Fix mega_mhc split barriers under CUDA graph replay (deepseek-ai#478)

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]>

* Public release 26/11/26 (deepseek-ai#525)

* Public release 26/11/26

* Add 2026.11.26 News entry for deepseek-ai#525

---------

Signed-off-by: lightseek-bot <[email protected]>
Co-authored-by: Chenggang Zhao <[email protected]>
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]>
Co-authored-by: LightSeek Foundation <[email protected]>
Co-authored-by: Claude Opus 5.5 <[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