Repository navigation
Public release 26/09/30 - #462
Merged
Merged
Conversation
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 <41318296+xay5421@users.noreply.github.com> Co-authored-by: Chenggang Zhao <chenggangz@deepseek.com> Co-authored-by: huahuaquq <289927700+huahuaquq@users.noreply.github.com> Co-authored-by: TwenTy_ <47315699+THUTwenTy@users.noreply.github.com> Co-authored-by: xyf007 <41227294+xyf007@users.noreply.github.com> Co-authored-by: Yongqi Zhuo <Yongqi-Zhuo@users.noreply.github.com> Co-authored-by: yukuai26 <1010238651@qq.com> Co-authored-by: Zhean Xu <94977922+zheanxu@users.noreply.github.com>
17 of 56 tasks
|
Ое |
This was referenced Oct 3, 2026
Heisenberg-Yin
added a commit
to Heisenberg-Yin/DeepGEMM
that referenced
this pull request
Oct 9, 2026
…stograms, next-n 1..6 Port the BF16 paged MQA producer of deepseek-ai#462 (merge 057ca59: MXFP4 Q/KV, BF16 head weights, BF16 head reduction and BF16 logits) as an isolated `mqa_bf16` kernel with its own split-384 cost-balanced schedule, and let it emit the same coarse histogram as the FP32 path. - APIs: `get_paged_mqa_logits_bf16_metadata(context_lens, 128, num_sms, indices=, tokens_per_request=)` and `fp4_paged_mqa_logits_bf16(..., indices=, histogram=, tokens_per_request=)` (pybind, TVM-FFI, deep_gemm / sgl_deep_gemm). - Adjacent equal request IDs share KV loads; the CPU hint selects Q4 / 3 TMEM stages (1..4) or Q6 / 2 stages (5..6; 6 also XOR-swizzles the histogram). Q4 keeps deepseek-ai#462's static TMEM stage mapping (its no-histogram kernel is SASS-identical to deepseek-ai#462); Q6 rotates a two-stage TMEM ring. - Exact histogram: every live non-NaN stored BF16 score counted once per row (16-bit shared counters for a window of rows, packed fast path for 2^-14 <= |x| < 16, published with packed 64-bit global atomics). The histogram kernels' scheduler caps a task's splits so the 16-bit overflow guard runs once per task; Q6 counts a 12-row window with 6 KV stages, so a CTA moving to the next request does not publish mid-kernel. Logits are bit-identical with and without the histogram. - Shared with the FP32 path: the coarse-bin encoding (epilogue/ coarse_histogram.cuh, plus a BF16 overload) and NoHistogram; dev's packing, ring pipeline (new parity-phase option for steps longer than a 2-stage ring), math / PTX / UMMA descriptor helpers. Only the kernel core, its shared-memory layout, its scheduler and the histogram accumulator are BF16-specific. - Test: sgl_deep_gemm/tests/test_mqa_bf16.py (n = 1..6, PDL off / on, exact counts, accumulation, CUDA-graph replay with changing lengths and request IDs). Replaces sgl-project#96.
zyongye
added a commit
to zyongye/DeepGEMM
that referenced
this pull request
Oct 10, 2026
Bring in locality-aware Mega MoE, the GEMM epilogue classes with BF16 stochastic rounding, the reworked Lightning/Sparse Indexer kernels, and upstream's MQA API changes. Adapt the new upstream APIs to the TORCH_LIBRARY bindings: - Epilogue classes are a `deep_gemm::Epilogue` custom class built by factory ops; `deep_gemm.epilogue.X(...)` returns one and every GEMM and einsum op takes it as `epilogue=None`. - Locality domain helpers are `locality_domain_*` ops, exposed as `deep_gemm._C.locality_domain` for `deep_gemm.locality_domain`. - MLOPart calls into Python through the CPython limited API instead of pybind11, taking the GIL itself. - `shutdown` is a config op. - Python errors from MLOPart surface as `RuntimeError` through the dispatcher, which `test_locality_domain` now accepts. Adopt upstream's MQA API: drop `fp8_mqa_logits`, `fp8_paged_mqa_logits`, `fp8_gemm_nt_skip_head_mid`, `clean_logits` and `logits_dtype`, and always return compressed logits. SM120 keeps its kernels unchanged: FP8 inputs with per-token float KV scales or MXFP4, FP32 weights and FP32 logits, fixed-length or varlen paged queries. SM90 keeps 32-row pages and next_n=4. Keep dev's other changes on top of upstream: - SM120 GEMMs move to `epilogue::operators` and lose the head-split index remap along with `fp8_gemm_nt_skip_head_mid`. - The SiTU Mega MoE variant is re-derived from upstream's kernel, and the NVFP4 Mega MoE uses the new scheduler with one locality domain. - SwiGLU alpha/beta is re-applied on top of upstream's prefetching epilogue. - Mega Gate keeps the removal of the finite-score device trap. - `get_bf16_mega_gate_config` is removed, following upstream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zyongye
added a commit
to vllm-project/DeepGEMM
that referenced
this pull request
Oct 10, 2026
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: Chenggang Zhao <chenggangz@deepseek.com> Co-authored-by: Anyi Xu <41318296+xay5421@users.noreply.github.com> Co-authored-by: huahuaquq <289927700+huahuaquq@users.noreply.github.com> Co-authored-by: TwenTy_ <47315699+THUTwenTy@users.noreply.github.com> Co-authored-by: xyf007 <41227294+xyf007@users.noreply.github.com> Co-authored-by: Yongqi Zhuo <Yongqi-Zhuo@users.noreply.github.com> Co-authored-by: yukuai26 <1010238651@qq.com> Co-authored-by: Zhean Xu <94977922+zheanxu@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
6 tasks done
1 of 2 tasks
Heisenberg-Yin
added a commit
to Heisenberg-Yin/DeepGEMM
that referenced
this pull request
Oct 16, 2026
…stograms, next-n 1..6 Port the BF16 paged MQA producer of deepseek-ai#462 (merge 057ca59: MXFP4 Q/KV, BF16 head weights, BF16 head reduction and BF16 logits) as an isolated `mqa_bf16` kernel with its own split-384 cost-balanced schedule, and let it emit the same coarse histogram as the FP32 path. - APIs: `get_paged_mqa_logits_bf16_metadata(context_lens, 128, num_sms, indices=, tokens_per_request=)` and `fp4_paged_mqa_logits_bf16(..., indices=, histogram=, tokens_per_request=)`: TORCH_LIBRARY ops in csrc/torch_library_api.cpp (`Tensor(a!)? histogram`, no schema defaults), deep_gemm / sgl_deep_gemm wrappers that own the defaults, and pybind. - Adjacent equal request IDs share KV loads; the CPU hint selects Q4 / 3 TMEM stages (1..4) or Q6 / 2 stages (5..6; 6 also XOR-swizzles the histogram). Q4 keeps deepseek-ai#462's static TMEM stage mapping (its no-histogram kernel is SASS-identical to deepseek-ai#462); Q6 rotates a two-stage TMEM ring. Each stage count is the deepest ring that fits (TMEM columns, SM100 shared memory with the histogram window); split 384 and the 3 x 128 math threads are named `Config` constants. The schedule (one CTA, two int32 per row in shared memory) checks its documented limit of 16384 rows. - Exact histogram: every live non-NaN stored BF16 score counted once per row (16-bit shared counters for a window of rows, packed fast path for 2^-14 <= |x| < 16, published with packed 64-bit global atomics). The histogram kernels' scheduler caps a task's splits so the 16-bit overflow guard runs once per task; Q6 counts a 12-row window with 6 KV stages, so a CTA moving to the next request does not publish mid-kernel. Logits are bit-identical with and without the histogram. - Shared with the FP32 path: the coarse-bin encoding (epilogue/ coarse_histogram.cuh, plus a BF16 overload) and NoHistogram; dev's packing, ring pipeline (new parity-phase option for steps longer than a 2-stage ring), math / PTX / UMMA descriptor helpers. Only the kernel core, its shared-memory layout, its scheduler and the histogram accumulator are BF16-specific. - Test: sgl_deep_gemm/tests/test_mqa_bf16.py, a plain script that run_tests.sh runs on SM100 (n = 1..6, PDL off / on, exact counts, accumulation, CUDA-graph replay with changing lengths and request IDs; the schedule's row limit). Replaces sgl-project#96. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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.
This update introduces new features, performance improvements, and important API changes:
New features
deep_gemm.epilogueclasses:Identity,Alpha,FP8Quantization, and opt-inBF16StochasticRoundingfor direct BF16 output on SM100.bhr,hdr->bhdandbhd,hdr->bhr.Performance improvements
Fixes
Breaking changes
fp8_fp4_mqa_logitsAPI now requires a positivemax_seqlen_kand returns compressed logits. The dense non-paged and paged MQA APIs no longer acceptclean_logitsorlogits_dtype; callers must mask entries beyond each row's valid KV span.indicesand usenext_n=1.fp8_mqa_logits,fp8_paged_mqa_logits, andfp8_gemm_nt_skip_head_midAPIs. Use thefp8_fp4_*mqa_logitsAPIs for MQA workloads.scoring_func="sqrtsoftplus", which is also the default.get_bf16_mega_gate_confighas been removed.Related release
Contributors