Skip to content

Sync nv_dev with upstream #377 - #384

Merged
RayWang96 merged 5 commits into
deepseek-ai:nv_devfrom
Barry-Delaney:user/jinshik/nv_dev_377
Jul 20, 2026
Merged

RayWang96 merged 5 commits into
deepseek-ai:nv_devfrom
Barry-Delaney:user/jinshik/nv_dev_377

Conversation

@Barry-Delaney

@Barry-Delaney Barry-Delaney commented Jul 17, 2026 •

Copy link
Copy Markdown

Summary

Merges upstream 559d79f (#377, Public release 26/07) into nv_dev at a6b593d (#369). This also brings in upstream #364 and the race fix from #343; the merge base is 88965b0.

The branch uses the same explicit non-fast-forward topology as the previous nv_dev sync PRs (#314, #328, and #349), keeping the upstream main commit as the merge commit's second parent.

B200 validation exposed two SM100 FP16-weight MQA synchronization gaps in the PTX-wrapper migration. Follow-up 96fbced elects one lane for raw-PTX 2x1SM UMMA issue, waits for each CTA's local KV-scale TMA before consumption, and fences the TMEM producer/consumer handoff.

Conflict resolution

  • Adopted #377's unified SM100 MQA and common MMA/PTX refactor while retaining nv_dev's SM90 next_n=4 multicast and block_kv=32, dedicated SM120 paths, FP16/BF16 weights, and 16-head indexer support.
  • Preserved metadata safety for empty/zero-context requests and made producer Q prefetch follow the scheduler's actual next task.
  • Ported the FP16-weights path to the new headers, with padded host offsets, correct per-warpgroup row indexing, and per-row compressed-window bounds.
  • Guarded the SM90 block_kv=32 odd physical-page tail from reading one page past the block-table row.
  • Combined upstream grouped scale-factor, PSUM, zero-padding, and Mega-MoE changes with nv_dev's SM120 dense/grouped GEMM dispatch.
  • Merged and extended attention/GEMM/layout coverage for SM90, SM100, and SM120.

Validation

Tests were run from isolated Docker worktrees on NVIDIA B200 GPUs (SM100):

  • The final FP16-weight MQA fix passed a clean CUDA extension build/JIT.
  • Core suites passed: test_bf16.py, test_fp8_fp4.py, test_layout.py, test_einsum.py, test_legacy.py, and test_hyperconnection.py.
  • SM100 attention prefill passed all 1,824 generated cases. Each completed case includes 20 repeated bitwise-consistency checks plus mask and numerical-reference validation.
  • Targeted SM100 FP16-weight MQA coverage passed head dimensions 32/64/128 with CP=0/1; the original H64/D32/CP0 failure passed 500 consecutive consistency runs.
  • SM100 paged MQA passed all 6,624 generated configurations. The exhaustive matrix was completed across isolated resume shards with two-case overlaps at every interrupted handoff; each completed case includes 20 repeated bitwise-consistency checks plus mask and numerical-reference validation.
  • Six-GPU Mega-MoE smoke runs passed for both fp8xfp4 and bf16xbf16. The fused kernels launched and benchmarked successfully; the deep_ep baseline comparison was skipped because that module was unavailable in the image.
  • All Git-tracked Python files pass py_compile; no unresolved conflicts, conflict markers, missing project-local includes, or references to removed headers were found.

GPU validation is SM100/B200 only. SM90 and SM120 GPU paths were not covered.

Three git diff --check warnings are inherited byte-for-byte from upstream #377 (Mega-MoE trailing whitespace); the conflict resolutions and follow-up fix introduce no new whitespace warnings.

zheanxu and others added 5 commits June 23, 2026 18:58
* Public release 26/06

* Minor fix
… into nv_dev

Brings deepseek-ai PR deepseek-ai#377 (559d79f, including deepseek-ai#364 and deepseek-ai#343) onto
nv_dev (a6b593d = deepseek-ai#369 merge). Merge base is 88965b0.

Conflict resolution highlights:
  * MQA: adopt deepseek-ai#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 deepseek-ai#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.
Elect one lane for the raw PTX UMMA issue path, order CTA-local KV scale loads before consumption, and fence TMEM handoff between producer and consumer.
@RayWang96
RayWang96 merged commit f8e8fb5 into deepseek-ai:nv_dev Jul 20, 2026
@eugr

eugr commented Jul 20, 2026 •

Copy link
Copy Markdown

@Barry-Delaney - given that current Deepseek V4 Flash implementation for sm12x that is merged into vLLM depends on this branch of DeepGEMM, validation on SM12x is still needed.

For example, this PR caused the following regression:

On DGX Spark (SM121), vLLM startup for deepseek-ai/DeepSeek-V4-Flash fails with DeepGEMM f8e8fb5. The DEEPGEMM_MXFP4 path enters m_grouped_fp8_fp4_gemm_nt_contiguous and triggers smxx_layout.cuh:131:

Assertion failed: (values[j] & 0x807fffffu) == 0
 CUDA_ERROR_LAUNCH_FAILED (719)

When I pin DeepGEMM to a6b593d it is working just fine.

lucifer1004 added a commit to lucifer1004/DeepGEMM that referenced this pull request Sep 15, 2026
Resolve the nv_dev sync using an ordinary merge, following the ancestry-preserving approach of prior sync PRs deepseek-ai#314, deepseek-ai#328, deepseek-ai#349 and deepseek-ai#384. Audit all 75 target-side changed paths, including 59 conflicts and seven automatically changed paths, against the prepared main-API implementation.

Retain DeepJIT, native SM120 kernels, restored nv_dev attention and MegaMoE contracts, and the validated NVFP4 WAR fix. Preserve the target's FP16 MQA indexing include; this is the only tree change relative to the validated integration head.

Standard standalone build, delivered-package import, 81 host protocol tests, 349 SM120 focused tests, packing and HC passed. Runtime sources are unchanged; prior bounded hardware and sanitizer evidence applies. Existing combined IDE indexing build limitations and previously documented qualification limits remain.
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.

6 participants