Skip to content

Pytest - #26

Closed
A-transformer wants to merge 4 commits into
deepseek-ai:mainfrom
A-transformer:pytest
Closed

A-transformer wants to merge 4 commits into
deepseek-ai:mainfrom
A-transformer:pytest

Conversation

@A-transformer

Copy link
Copy Markdown
Contributor

Decorate the test function with @pytest.mark.skipif(...) so the test is skipped if CUDA is unavailable. Move all testing logic into a function named test_jit() so it’s automatically discoverable by pytest.

CUTLASS Configuration
Ensure that the CUTLASS_ROOT environment variable is set. For example:
export CUTLASS_ROOT=/root/DeepGEMM/third-party/cutlass
export CPATH="$CUTLASS_ROOT/include:$CPATH"
export CPLUS_INCLUDE_PATH="$CUTLASS_ROOT/include:$CPLUS_INCLUDE_PATH"

Running the Tests:
pip install pytest
pytest tests/test_jit.py -v -s

image

pytest tests/test_core.py -v -s

image

nvidia-smi
image

@LyricZhao LyricZhao closed this Feb 28, 2025
LyricZhao pushed a commit that referenced this pull request Apr 16, 2026
Stone749990226 pushed a commit to Stone749990226/DeepGEMM that referenced this pull request May 28, 2026
zyongye added a commit to zyongye/DeepGEMM that referenced this pull request Oct 6, 2026
…pseek-ai#26)

* [NVFP4 MegaMoE] Early TMEM release, faster exact L1 quantization, two routed K tiles per stage

- Drain the L1 accumulator slice from TMEM into registers first (the same
  per-token-scale multiply, BF16 rounding and clamp), release the TMEM stage,
  then run SwiGLU, quantization and stores from registers, so the next task's
  MMAs overlap the epilogue.
- Quantize the routed L1 output with fewer instructions: the division by
  6 * l2_activation_scale uses the FMA-corrected fast path with the divisor's
  refined reciprocal hoisted (matching IEEE division over the scale clamp
  range), FP4 packing has no divergent branch, and the two scale bytes of a
  token pair are written by different lanes.
- Carry two routed BLOCK_K tiles per pipeline stage when at least four stages
  remain and the combine's shared-memory chunking is unchanged, halving barrier
  round trips and MMA commits per routed K within the same shared-memory
  budget.

The output is bitwise identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zijing Liu <[email protected]>
Signed-off-by: Yongye Zhu <[email protected]>

* [NVFP4 MegaMoE] Decode-shaped launches: sparse count atomics, L2-first claims, evict-first weights, L1-first ≤ 64, fast pulls

Scheduling and dispatch variants for small (decode) launches, compiled in only
for decode-shaped instantiations (a template flag, also passed to the
scheduler, default false):

- Count atomics only for experts with a non-zero count; publish the receive
  totals with st.release.
- Claim an L2 task only once its M block's L1 outputs are done.
- Routed weight TMA loads with an evict-first cache hint.
- L1-first task claims while BLOCK_M <= 64.
- Fast token pulls (one rank per lane; needs <= 32 ranks/experts).

The output is bitwise identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Zijing Liu <[email protected]>
Signed-off-by: Yongye Zhu <[email protected]>

* Choose NVFP4 MegaMoE launch variants with host heuristics

Replace the fixed decode-shaped gate with three variants that the host
heuristics choose per launch:

- Compact dispatch count exchange (zero-count atomics skipped, receive counts
  summed locally and read from shared memory): whenever ranks and local
  experts fit one warp, at every token count.
- Batched scale-factor pulls: for decode-shaped launches, and for larger
  launches when intermediate_hidden is at most 2048.
- Decode-shaped (evict-first routed weight loads; tiles of at most 64 rows
  claim all L1 tasks before L2 tasks): when the expected tokens per expert
  plus one standard deviation fit one M block, so each weight tile is read
  once per launch.
- Remove the L2-readiness claim check, which slowed tiles of 128 rows or more.
- Add DG_NVFP4_MOE_COMPACT_DISPATCH, DG_NVFP4_MOE_BATCHED_SF_PULLS and
  DG_NVFP4_MOE_DECODE_SHAPED overrides, and print the selection with
  DG_PRINT_CONFIGS.

The output is bitwise identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Yongye Zhu <[email protected]>

---------

Signed-off-by: Zijing Liu <[email protected]>
Signed-off-by: Yongye Zhu <[email protected]>
Co-authored-by: Zijing Liu <[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.

2 participants