Skip to content

Multiple updates and refactorings - #364

Merged
LyricZhao merged 2 commits into
mainfrom
public-release-2606
Jun 23, 2026
Merged

LyricZhao merged 2 commits into
mainfrom
public-release-2606

Conversation

@zheanxu

@zheanxu zheanxu commented Jun 23, 2026 •

Copy link
Copy Markdown
Collaborator

In this PR, we merged the four SM100 fp8/fp4 mqa logits kernels (paged/non-paged) into a single kernel and added flexible support for various combinations of num_heads, head_dim, and reduce precision (float32/bfloat16). This yields ~2% speedup for fp4 non-paged cases, ~10% for fp4 paged varlen (due to scheduler and load balancing improvements), and ~20% when using bf16 precision for reduction.

For Mega MoE, we now support BF16 precision, which also brings significant acceleration to BF16 MoE. Additionally, we implemented a ring buffer that substantially reduces memory usage compared to the previous version.

There are also several other minor improvements.

@zheanxu
zheanxu requested a review from LyricZhao June 23, 2026 08:57
@LyricZhao
LyricZhao merged commit 54e2261 into main Jun 23, 2026
qiushixiaoyu pushed a commit to qiushixiaoyu/DeepGEMM that referenced this pull request Jul 1, 2026
qiushixiaoyu pushed a commit to qiushixiaoyu/DeepGEMM that referenced this pull request Jul 2, 2026
qiushixiaoyu pushed a commit to qiushixiaoyu/DeepGEMM that referenced this pull request Jul 19, 2026
RayWang96 pushed a commit that referenced this pull request Jul 20, 2026
Brings deepseek-ai PR #377 (559d79f, including #364 and #343) onto
nv_dev (a6b593d = #369 merge). Merge base is 88965b0.

Conflict resolution highlights:
  * MQA: adopt #377's unified SM100 implementation and common MMA/PTX
    refactor while preserving nv_dev's SM90 next_n=4 multicast and
    block_kv=32 support, dedicated SM120 paths, FP16/BF16 weights, and
    16-head indexer coverage.
  * Scheduler safety: retain zero-context and empty-varlen handling; drive
    producer prefetch from the scheduler's actual next query; bound the
    SM90 block_kv=32 odd-page tail before reading block tables.
  * FP16 weights: port the implementation to the new headers and preserve
    padded host offsets, per-warpgroup row indexing, and per-row compressed
    window bounds.
  * GEMM/layout: combine #377's grouped scale-factor, PSUM, zero-padding,
    and Mega-MoE changes with nv_dev's SM120 dense/grouped dispatch.
  * Tests: merge upstream coverage with nv_dev's SM90/SM100/SM120 cases and
    add regressions for empty metadata, skipped requests, FP16 compressed
    windows, and the SM90 odd physical-page tail.

Validation:
  * All Git-tracked Python files pass py_compile.
  * No unresolved conflicts, conflict markers, missing project includes, or
    references to removed headers were found.
  * CUDA build/JIT and GPU numerical tests were not run because this host has
    no nvcc, PyTorch, or visible GPU tooling.
heyselbi pushed a commit to neuralmagic/DeepGEMM that referenced this pull request Aug 26, 2026
  Syncs 9 upstream commits (54e2261..8b1392b):
  - Multiple updates and refactorings (deepseek-ai#364)
  - Fix race condition in in-flight tensormaps (deepseek-ai#343)
  - Public release 26/07 (deepseek-ai#377)
  - Fix SM100 FP16 MQA synchronization
  - SiTU support for FP8 FP4 MegaMoE

Signed-off-by: greg pereira <[email protected]>
Helicoplacoidea pushed a commit to Helicoplacoidea/DeepGEMM that referenced this pull request Aug 31, 2026
Replay of PR sgl-project#69 onto the re-based `dev` branch (merge-base reset from the old
deepseek-ai#364 lineage to current upstream `dev`). The upstream rewrite made SM90 keep a
`LegacyMegaMoEScheduler` while adding the SM100 producer-warp `TaskInfo`
scheduler; this commit re-integrates the SM90 work on that base.

What this brings (the PR's original scope, unchanged):

* SM90 MegaMoE moves from the wave-based scheduler to an SM100-style
  producer-warp interleaved scheduler. A dedicated producer warp claims L1/L2
  tasks from two global atomic counters and interleaves them 1:1 after a warmup
  phase, so an early pool block's L2 tiles overlap the L1 compute of later
  blocks instead of waiting for a whole L1 wave to drain.

* The `kNumExpertsPerWave` / ring-token heuristic is dropped from the SM90
  config and host, since the interleaved scheduler needs no wave bookkeeping.

* Fused shared experts (`kNumSharedExperts > 0`) on SM90: two extra phases
  (`SharedLinear1` / `SharedLinear2`) with their own task counters, wired
  through config, host descriptors, the TMA loader, the L1/L2 epilogues, and
  the python / FF buffers.

Merge notes:

* `scheduler/mega_moe.cuh`: kept upstream's `TaskInfo<>` / producer
  `MegaMoEScheduler` / `LegacyMegaMoEScheduler` (needed by the SM100 kernels)
  and appended the SM90 `SM90MegaMoETaskInfo` + `MegaMoEInterleavedScheduler`.
  The duplicated `get_num_l1_warmup_waves` helper resolves to the single
  upstream definition; `is_l1_phase` / `is_shared_phase` are added.

* `sm90_fp8_mega_moe.cuh` + `heuristics/sm90_mega_moe.hpp`: taken from the PR
  side. The only upstream cuh delta vs the old base was a rename of the wave
  scheduler in a path the SM90 kernel no longer uses, so no behaviour is lost.

Co-Authored-By: Claude <[email protected]>
qiushixiaoyu pushed a commit to qiushixiaoyu/DeepGEMM that referenced this pull request Sep 4, 2026
qiushixiaoyu pushed a commit to qiushixiaoyu/DeepGEMM that referenced this pull request Sep 15, 2026
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.

2 participants