Skip to content

Add an opt-in fused gate+up grouped GEMM for AutoEP experts - #8733

Merged
tohtana merged 4 commits into
deepspeedai:masterfrom
yh0903:yh0903/autoep-fused-gate-up
Oct 12, 2026
Merged

tohtana merged 4 commits into
deepspeedai:masterfrom
yh0903:yh0903/autoep-fused-gate-up

Conversation

@yh0903

@yh0903 yh0903 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

AutoEP's grouped experts run the gate (w1) and up (w3) projections of the same routed rows as two grouped GEMMs. In the backward pass, they compute two input-gradient GEMMs and add the two BF16 results. This adds an opt-in expert_parallel.gate_up_impl="fused", which runs both projections as one torch._grouped_mm over the two weights, concatenated on each call.

Change

  • GroupedExperts(gate_up_impl="fused") concatenates w1 and w3 per call and runs one grouped GEMM with 2 * hidden_dim output columns.
    • The backward pass therefore has one input-gradient GEMM, which accumulates both projections in FP32, and no separate addition.
  • The activation reads the two halves of the packed output in place:
    • swiglu uses a new Triton kernel, swiglu_packed, with the same FP32 math as the existing swiglu kernel.
    • The other registered forms (geglu_tanh, swiglu_clamped, swiglu_oai) run their eager expression on views of the halves.
    • New forms can register a packed_fused_fn.
  • The parameters keep their separate w1/w3 layout. Checkpoints, universal checkpoints, expert tensor parallelism and optimizer state, including Muon's per-expert treatment, are unchanged.
  • The default, "separate", keeps the existing path.
  • "fused" is rejected rather than ignored when the experts would not run torch._grouped_mm:
    • use_grouped_mm=false, at config validation and in GroupedExperts;
    • devices that select the Triton grouped GEMM, unless disable_triton_grouped_mm=true.
  • Docs: autoep.rst and the config reference.

Numerical and autograd contract

The forward expression and parameter-gradient semantics are unchanged. Exact output/weight-gradient equality is an observation in the tested H100 cases, not a guarantee across GEMM shapes, implementations or hardware. The input gradient can differ because it is accumulated in one FP32 GEMM rather than as two rounded BF16 results added. The FP64 regression now uses the same represented BF16 weights as the tested paths, rather than the original pre-quantization FP32 weights; its existing relative-L2 bound (fused error <= 1.05 * separate error) is unchanged. This is not a universal accuracy-improvement or bitwise-equivalence claim.

Cross-GEMM output and parameter-gradient assertions now use the existing grouped-GEMM BF16 policy (rtol=0.02, atol=0.02 * max(abs(reference))) rather than zero tolerance. The skewed/empty-expert forward and smooth-form parameter gradients use the independent FP64 reference. Clamped-form parameter gradients use an independent dense BF16 reference, because rounding a projection across a clamp boundary changes its derivative discontinuously; the bound is not enlarged to absorb those discontinuities. The input-gradient relative-L2 comparison is unchanged. The multi-step test uses the same policy for comparisons across algorithms, while saved/reloaded parameters, optimizer momentum tensors and parameter-group configuration must still match exactly. Exact parity checks between the two implementations of the same elementwise SwiGLU kernel remain unchanged.

The packed SwiGLU Triton path has first-order gradients only: create_graph=True raises rather than silently dropping its second derivative. Forward and backward select the input's CUDA device and its current stream, restoring the caller's current device. The eager expressions for the other activation forms and the default separate path are unchanged.

Tests

  • CPU, TestFusedGateUp in tests/unit/v1/moe/test_autoep_expert_activation.py:

    • packed versus separate halves for every registered form, forward and backward;
    • only swiglu has a packed kernel;
    • the default is unchanged;
    • unsupported settings are rejected (bad value, use_grouped_mm=false, Triton grouped GEMM path), at config validation and in GroupedExperts;
    • the config reaches the replaced experts, whose parameters remain w1, w2, w3.
  • Earlier GPU evidence, on one H100 (305 passed): test_swiglu_triton.py, test_autoep_expert_activation.py and test_autoep_unit.py.

    • swiglu_packed matches the existing swiglu kernel's values exactly, forward and backward (rtol=0, atol=0, not a signed-zero bit-pattern assertion). Covered: FP32/FP16/BF16, odd widths, 3-D inputs, empty inputs, non-contiguous input, and an odd last dimension (rejected).
    • The fused path joins test_grouped_gemm_paths_match_the_for_loop for every form.
    • New test_matches_separate_with_skewed_and_empty_experts, for every form, with an empty expert and unaligned rows:
      • output and w1/w2/w3 gradients match exactly in the tested shapes;
      • the original relative-L2 FP64 error comparison is retained with the corrected represented-weight reference described above.
    • Not part of this change: the 2 failures are TestMiniMaxM3Block::test_replaced_block_matches_hf_block. That preset requires Transformers >= 5.15.0, and the image has 5.12.0.
  • The shipped GroupedExperts, one H100, Qwen3-30B-A3B per-rank expert shape (131,072 routed rows, hidden 2048, expert hidden 768, 16 local experts, BF16):

    Per call (ms) Forward, no grad Forward Backward Total
    "separate" 2.149 2.292 4.857 9.298
    "fused" 2.224 2.236 4.321 8.781

    Output and all weight gradients matched exactly; the input gradient differed by 2.9e-3 relative.

  • End to end, Qwen3-30B-A3B on 8 H100s:

    • Setup: expert parallel size 8, micro-batch 4, 16 accumulation steps, sequence length 4096, DeepEP, reentrant activation checkpointing, BF16 parameters and Adam state, 30 steps with 10 warmup.
    • Measured with an equivalent benchmark patch on our benchmark base: the same concatenation and the same packed SwiGLU kernel.
    • Separate 22,018.8 / 22,018.5 ms against fused 21,601.2 / 21,608.4 ms, in two pairs in the same job: -414 ms (-1.9%).
    • Step-1 loss identical. Later losses agree within same-arm repeat noise.
    • Peak allocated memory unchanged; reserved memory about 0.4 GB higher.

Review follow-up validation

  • Current-master targeted validation on NVIDIA H100 80GB HBM3, torch 2.10/CUDA 13.0, Triton 3.6.0 and transformers 5.12.0: 83 passed, 0 skipped (the full 63-case SwiGLU file plus 20 TestFusedGateUp cases). The SwiGLU file also passed 63/63 with no skips under pytest --forked. Cross-device cases used two GPUs; the lifecycle cases use the actual native grouped GEMM.
  • With only the same new tests applied to the prior runtime, all four focused guards fail as intended: both FP16/BF16 cross-device cases reproduce Triton's inaccessible-pointer error, and both FP32/BF16 higher-order cases fail because create_graph=True was not rejected. This verifies the actual root causes, not an unrelated collection or test-API failure.
  • Regressions cover strided packed inputs and upstream gradients, two-device/current-stream selection and caller restoration, explicit higher-order rejection, the corrected FP64 reference, and two SGD updates with two accumulation micro-batches per step. All four activations run with and without reentrant recomputation; a model/optimizer state-dict round trip between updates keeps the separate w1/w2/w3 names and shapes and checks the next update against the independent separate path.
  • The SwiGLU test file imports its runtime in the worker, not during collection, so its Triton driver probe is deferred until after pytest --forked starts the worker.
  • The follow-up changes launch-device selection and unsupported-autograd handling, not the GEMM implementation, kernel arithmetic, launch configuration, default or parameter layout. The earlier local and E2E performance evidence is reused without retiming; the historical percentages are not new measurements of these guards.

AI review follow-up

  • Changed tests and documentation only; the runtime is byte-identical to the previous validated head.
  • The numerical-contract comment is addressed by the reference/tolerance policy above, plus a regression that accepts a single BF16 representable-step change but rejects a clearly incorrect value. On NVIDIA H100 80GB HBM3, torch 2.10/CUDA 13.0, Triton 3.6.0 and transformers 5.12.0, the focused fused-gate-up/grouped-GEMM suite passed 33/33 with no skips.
  • A synthetic one-ULP perturbation of the fused down-GEMM output passed all 12/12 reference/lifecycle cases with the contract-level checks; the old exact checks failed all 12/12 under the same perturbation. An independently injected 25% output/gradient error was rejected by all four reference cases. These are small test controls, not new GEMM-backend or performance measurements; they demonstrate that legitimate rounding is allowed without accepting an incorrect computation.
  • The DCO comment was checked against the actual GitHub PR commit list and local ancestry: every PR commit has the configured author's Signed-off-by trailer, and DCO passes. The SHA cited in that comment is not in the PR and is not found by GitHub's commit API, so no commit amendment or history rewrite is needed.

CI and scope

DCO, test collection and changed-files pre-commit passed on the published follow-up. Full GPU CI and infrastructure-smoke jobs were skipped on the PR event; they are not reported as full GPU CI acceptance. The targeted H100 runs above provide the device evidence for this follow-up.

This branch inherits recent upstream master. The backward-overlap child (#8739) remains a separate stacked PR and is not included here; no recompute-skip, buffer-slice, row-weighting-activation or communication optimization is added by this PR.

The new optimizer round trip is a focused SGD test, not an independent qualification of every optimizer, expert-TP/universal-checkpoint combination, ZeRO stage or accelerator. The E2E evidence covers one model/configuration on H100, not long-run convergence or a universal speedup.

AutoEP's grouped experts run the gate and up projections of the same input
as two grouped GEMMs, and in the backward pass add the two input-gradient
GEMM results. expert_parallel.gate_up_impl="fused" concatenates w1 and w3
on each call and runs one torch._grouped_mm with twice the output columns.
A single input-gradient GEMM then accumulates both projections in FP32.

The activation reads the two halves of the packed output in place: swiglu
through a new Triton kernel, swiglu_packed, with the same FP32 math as the
existing swiglu kernel; the other registered forms through their eager
expression on views. Parameters keep the separate w1/w3 layout, so
checkpoints, expert tensor parallelism and optimizer state are unchanged.

The default, "separate", keeps the existing path. "fused" is rejected when
the experts would not run torch._grouped_mm.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: yh0903 <helloyu0903@gmail.com>
yh0903 and others added 2 commits October 9, 2026 16:24
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: yh0903 <helloyu0903@gmail.com>
Select the packed input device for forward and backward while preserving its current stream and the caller device. Reject create_graph through the new packed kernel instead of silently dropping its second derivative. Defer SwiGLU test driver imports until the worker starts.

Compare FP64 input-gradient references against the represented BF16 weights, without loosening the existing error bound. Cover all activations over two updates with GAS two, reentrant recomputation and model/optimizer checkpoint reload. Keep kernel arithmetic, GEMM logic, separate parameter layout and opt-in default unchanged, and scope numerical/performance statements to the validated cases.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: yh0903 <helloyu0903@gmail.com>
@yh0903
yh0903 marked this pull request as ready for review October 10, 2026 00:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T00:06:36.351014Z ed88d3d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed88d3dfd9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

config.score_apply = param_dict.get("score_apply", "auto")
config.combine_impl = param_dict.get("combine_impl", "auto")
config.row_weighting_impl = param_dict.get("row_weighting_impl", "auto")
config.gate_up_impl = param_dict.get("gate_up_impl", "separate")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required Signed-off-by trailer

This is a one-parent non-merge commit, but git log -1 --format='%B' 8213255561f7700869cafa528429eec5546669e3 contains no Signed-off-by: trailer. Add the trailer using the configured author identity; otherwise the commit cannot satisfy the repository's DCO/CI requirement.

AGENTS.md reference: AGENTS.md:L8-L9

Useful? React with 👍 / 👎.

Comment on lines +380 to +382
torch.testing.assert_close(out_fused, out_separate, rtol=0, atol=0)
for name in ("w1", "w2", "w3"):
torch.testing.assert_close(getattr(fused, name).grad, getattr(separate, name).grad, rtol=0, atol=0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Relax parity checks to the documented numerical contract

On a CUDA architecture or library version where the single wide GEMM and the two narrow GEMMs select different valid algorithms, _run_experts_grouped_mm_fused_gate_up explicitly permits rounding differences, but these zero-tolerance output and weight-gradient assertions fail before the FP64 error comparison. The update/checkpoint test repeats the same assumption, so compare against the independent FP64 reference or use contract-level tolerances rather than requiring bitwise parity across GEMM shapes.

AGENTS.md reference: AGENTS.md:L31-L34

Useful? React with 👍 / 👎.

Reuse the existing BF16 grouped-GEMM rounding bound and compare against independent references instead of requiring cross-algorithm exact parity. Keep the input-gradient relative-L2 bound and exact checkpoint state/config restoration assertions. Clamped parameter gradients use dense BF16 references to preserve their derivative branches without enlarging the tolerance.

Exercise permitted one-ULP rounding and rejection of incorrect values. Runtime, kernels, opt-in default and parameter layout remain unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: yh0903 <helloyu0903@gmail.com>

@tohtana tohtana left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!

@tohtana
tohtana enabled auto-merge October 12, 2026 05:39
@tohtana
tohtana added this pull request to the merge queue Oct 12, 2026
Merged via the queue into deepspeedai:master with commit 3a656d3 Oct 12, 2026
15 checks passed
banxingmjj pushed a commit to openanolis/DeepSpeed that referenced this pull request Oct 27, 2026
…peedai#8652)

# AutoEP: fused Triton kernel for the clamped expert activations

<!-- r3 2026-10-15: branch peng-add-fuse-fn-clamped-form-v2 (worktree
/fsx/peng/workspace/ds-add-fuse-fn-clamped-form-v2)
on master 5f266e2; pushed to the PR's branch
peng-add-fuse-fn-clamped-form-v1 with --force-with-lease (GitHub
shows the PR's commit 90c9660 in conflict with master). DRAFT
2026-10-12, for the PR body of deepspeedai#8652. Replaces the whole current body.
Items marked TODO(user) need the
submitter. Job IDs of every result: SOURCES.md. -->

**Branch:** `peng-add-fuse-fn-clamped-form-v1`, rebased on `master` at
`5f266e26d` (2026-10-15). The expert activation registry it
registers into is merged (deepspeedai#8650), and so is the fused gate+up projection
(deepspeedai#8733), which this PR now also covers.
**Part of:** deepspeedai#8672 (Q4 2026 roadmap), "Mixture-of-Expert (MoE) Training
Scaling and Kernel Development": "AutoEP
Performance Optimization & Parallel Folding (AutoEP + AutoTP)" (PoC
@tohtana @pengdurice). Follows the merged expert
activation registry (deepspeedai#8650) and MiniMax-M3 preset (deepspeedai#8651).

## Summary

The clamped expert activations `swiglu_clamped` (DeepSeek-V4) and
`swiglu_oai` (GPT-OSS, MiniMax-M3) run as plain
PyTorch expressions that keep about four `[rows, ffn]` temporaries for
backward. Plain `swiglu` has fused Triton
kernels that keep only `gate` and `up`. This PR adds the same kernels
for the clamped forms, for both expert layouts:

- `gate_up_impl="separate"` (two grouped GEMMs): `swiglu_clamped(gate,
up, ...)`.
- `gate_up_impl="fused"` (one grouped GEMM, deepspeedai#8733):
`swiglu_clamped_packed(gate_up, ...)`, which reads the two halves
  of the packed GEMM output in place, as master's `swiglu_packed` does.

At the busiest rank of a MiniMax-M3 run that ran out of memory
(1,045,081 rows x 3,072, bf16), one `swiglu_oai`
call goes from 41.86 GiB extra peak memory and 77.8 ms to 17.94 GiB and
11.9 ms, the same as plain `swiglu`.

## Duplicate check

Open PRs and issues searched on 2026-10-12 for "swiglu", "clamp",
"expert activation" and "gpt-oss": no other work on
fused clamped activations. deepspeedai#8748 (another author, open) adds a different
kernel, `swiglu_weighted` (routing weight
inside the activation, plain `swiglu` only), to the same two files
(`swiglu_triton.py` and the registry in
`ep_experts.py`). The two do not overlap in function; whichever merges
second needs a small rebase.

## Problem

Each clamped form is two clamps, a sigmoid, three products and an add in
plain PyTorch, each a full `[rows, ffn]`
temporary, most of them saved for backward. On an expert-parallel rank
this is where the memory goes, because
AutoEP has no capacity limit and real routers send some ranks several
times the mean number of rows.

MiniMax-M3 at 65,536 tokens with expert parallel 32 on 4 nodes of 8 H200
ran out of memory there: the busiest rank
received 1,045,081 rows (3.99 times its own 262,144) and failed inside
`apply_expert_activation` on one 11.96 GiB
temporary, with 129.50 GiB already in use. (Setup: all 60 layers, real
checkpoint, `minimax_m3` preset, ZeRO-3 with
the optimizer state on the host, activation checkpointing; torch
2.8.0+cu126, transformers 5.15.1, DeepSpeed master
`4a5856c25` plus the then-open registry PR.) Over the 57 MoE layers, the
busiest of 32 ranks received a median 4.20
times the mean number of rows (maximum 7.84).

## The change

| File | What |
|---|---|
| `deepspeed/ops/triton_ops/swiglu_triton.py` |
`_swiglu_clamped_fwd_kernel` / `_swiglu_clamped_bwd_kernel`, modelled on
master's swiglu kernels: int64 offsets, float32 math, one rounding on
store, `OAI: tl.constexpr` selects the form, `PACKED: tl.constexpr`
reads `gate` and `up` from one `[rows, 2 * INTER]` tensor with master's
packed indexing. The clamp gradient passes at the limit, as
`torch.clamp`'s does. Public `swiglu_clamped(gate, up, alpha, limit,
oai)` and `swiglu_clamped_packed(gate_up, alpha, limit, oai)`;
plain-PyTorch fallback without Triton or on the CPU. The packed backward
raises for `create_graph=True`, as master's packed swiglu does |
| `deepspeed/moe/ep_experts.py` | registers the kernels as `fused_fn`
and `packed_fused_fn` of `swiglu_clamped` and `swiglu_oai`. Nothing else
changes: the grouped-GEMM expert paths reach them through
`apply_expert_activation(..., fused=True)` and
`apply_packed_expert_activation`; the for-loop reference path keeps
`fused=False` |
| `docs/_pages/config-json.md` | one sentence: which forms run a fused
kernel |
| `tests/unit/v1/ops/triton_ops/test_swiglu_triton.py`,
`tests/unit/v1/moe/test_autoep_expert_activation.py` | see Tests |

Size: 264 added and 2 removed lines under `deepspeed/` (232 added in
`swiglu_triton.py`, 32 in `ep_experts.py`).

## Measured

One H200, torch 2.8.0+cu126, Triton 3.4.0, through
`apply_expert_activation` / `apply_packed_expert_activation`
(`fused=True`). 1,045,081 rows x 3,072 in bf16 (one `[rows, ffn]` tensor
= 5.98 GiB), alpha 1.702, limit
7.0, inputs at 6 x standard normal so most values are past a clamp.
Extra peak = `max_memory_allocated` during
forward + backward minus the memory allocated before (inputs and
upstream gradient). Kept = memory still allocated
after the forward, minus the output. Time = median of 5 forward +
backward passes after 3 warm-ups.

| Form | Layout | master `1c862f7df`: extra peak / kept / time | this
PR: extra peak / kept / time |
|---|---|---|---|
| `swiglu` (existing kernels, for comparison) | separate | 17.94 GiB /
0.00 GiB / 11.9 ms | 17.94 GiB / 0.00 GiB / 11.9 ms |
| `swiglu` | packed | 17.94 / 0.00 / 11.9 ms | 17.94 / 0.00 / 11.9 ms |
| `swiglu_clamped` | separate | 35.88 / 17.94 / 51.6 ms | **17.94 / 0.00
/ 11.9 ms** |
| `swiglu_clamped` | packed | 35.88 / 17.94 / 92.1 ms | **17.94 / 0.00 /
13.1 ms** |
| `swiglu_oai` | separate | 41.86 / 23.92 / 77.8 ms | **17.94 / 0.00 /
11.9 ms** |
| `swiglu_oai` | packed | 41.86 / 23.92 / 118.3 ms | **17.94 / 0.00 /
13.2 ms** |

Per MoE layer on that rank, `swiglu_oai` keeps 23.92 GiB less for
backward and runs 6.5 times faster (separate) or
9.0 times faster (packed). The packed clamped kernels are 1.2-1.3 ms
slower than master's packed `swiglu` kernel,
which does less arithmetic per element. Bench script:
`expert_activation_bench.py` (TODO(user): attach as a gist or
drop this line).

## Tests

Command, from `tests/`, on 1 node of 8 H200 (143,771 MiB each, driver
580.126.09), torch 2.8.0+cu126, Triton 3.4.0,
transformers 5.15.1, pytest 9.1.1:

```bash
DEEPSPEED_RUN_H100_TESTS=1 python -m pytest unit/v1/ops/triton_ops/test_swiglu_triton.py \
    unit/v1/moe/test_autoep_expert_activation.py -v \
    -k "not (skewed_and_empty or accumulated_updates_and_checkpoint)"
```

Result: **204 passed**, 12 deselected, in 31 s. On master `5f266e26d`
(2026-10-15): **204 passed**, 12 deselected, in 34 s on torch 2.8.0; the
two empty-expert tests from deepspeedai#8733 on torch 2.9.1: 12 passed on this
branch and 12 passed on master.

The two deselected tests are master's (deepspeedai#8733). On torch 2.8.0+cu126 on
H200 they do not finish, on master as well
as on this branch: they pass an empty expert group (`counts = [37, 0,
291, 72]` and `[16, 0, 32, 16]`) to
`torch._grouped_mm`, whose backward never returns for some shapes when a
group is empty on that torch version (GPU at
100% with no progress; known from MiniMax-M3 work, one-GPU reproduction
available). AutoEP itself never passes an
empty group, because `generate_permute_indices` gives every local expert
at least 8 rows. On torch 2.8.0 master's
`test_matches_separate_with_skewed_and_empty_experts[swiglu]` did not
finish in 300 s; on torch 2.9.1+cu128 (Triton
3.5.1) both tests pass, **12 passed** on this branch and 12 passed on
master.

New and changed tests:

| Test | What it would catch |
|---|---|
| `test_clamped_forward_matches_reference` (2 forms x 3 dtypes x 6
shapes) | a wrong output: compared with the expression evaluated in
float32 and rounded once; inputs at scale 4 so about 8% are past a
clamp; the kernel must also be no farther from float32 than the eager
low-precision evaluation |
| `test_clamped_backward_matches_reference` (2 x 3 x 5) | wrong input
gradients, the same way, with a random upstream gradient |
| `test_clamped_alpha_and_limit_are_honoured` | alpha or limit ignored;
a nonzero gradient where an input was clamped |
| `test_clamped_gradient_at_the_limit_is_inclusive` | a gradient that
stops at `gate == limit` or `up == -limit`, where `torch.clamp`'s passes
|
| `test_clamped_empty_input`, `test_clamped_non_contiguous_input`,
`test_clamped_shape_and_dtype_mismatch_rejected` | the edge cases
master's swiglu tests cover |
| `test_clamped_packed_matches_the_separate_kernel_exactly` (2 forms x 2
dtypes x 4 shapes, including 3-D and empty) | a packed path that reads
the wrong half or row: output and gradient bit-equal to the separate
kernel |
| `test_fused_kernel_matches_plain_pytorch` (every form with a
`fused_fn`) | `apply_expert_activation(fused=True)` differing from the
plain form evaluated in float32 and rounded once (bf16, 256 x 3,072) |
| `test_packed_kernels_are_registered` (was
`test_only_swiglu_has_a_packed_kernel`) | the fused gate+up path
silently running the clamped forms in plain PyTorch |
| `test_grouped_gemm_paths_match_the_for_loop`,
`test_packed_activation_matches_the_separate_halves` (master's, now
running the new kernels) | the grouped-GEMM paths differing from the
for-loop reference path |

`pre-commit run --files` passes on every changed file.

## Compatibility

The change is an elementwise kernel behind AutoEP's existing activation
registry; it does not depend on the ZeRO
stage, offload or parallel layout.

| | Validated | Not validated |
|---|---|---|
| Precision | float32, float16, bf16 (kernel tests); bf16 through the
expert paths | |
| Expert layouts | `gate_up_impl` `"separate"` and `"fused"`;
`torch._grouped_mm` and Triton grouped-GEMM paths (unit tests) | |
| End to end | | no training job has run with this kernel. The
MiniMax-M3 runs on 4 nodes used the plain PyTorch form (the
out-of-memory case above was avoided with expert parallel 4) |
| Accelerators | CUDA (H200); CPU fallback (plain PyTorch) | ROCm, XPU
and other Triton backends. The packed path sets the device with
`torch.cuda.device` (`#ignore-cuda`), as master's packed swiglu does |

## AI assistance

This PR was written with AI assistance (Claude).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: pengdurice <pengduhit@gmail.com>
@tohtana tohtana added needs-gpu-test GPU testing is recommended to validate the changes in this PR. and removed needs-gpu-test GPU testing is recommended to validate the changes in this PR. labels Nov 10, 2026
tohtana pushed a commit to yh0903/DeepSpeed that referenced this pull request Nov 14, 2026
## Summary

Add opt-in `expert_parallel.skip_recompute_combine` for AutoEP's DeepEP
route. In supported Hugging Face per-decoder-layer **reentrant**
checkpointing, the recomputed MoE output is used only by the residual
add and is discarded by the checkpoint. The route records post-expert
row weighting and combine backward without executing those forward
operations; dispatch, expert compute and all required backward transfers
still run. Default behavior is unchanged.

This is the existing skip-combine PR, not a duplicate implementation. It
remains distinct from the non-reentrant layout replay merged in
deepspeedai#8731. The branch preserves that replay, the fused
gate+up defaults from deepspeedai#8733, and the independent
exact-size buffer checks from deepspeedai#8747. AI assistance
was used for finalization, with author review before submission.

## Supported contract

- `comm_backend="deepep"`, `autoep_size > 1`, BF16 dispatch; eager and
fused row weighting, at their unchanged `score_apply` boundary.
- Supported decoder presets: `deepseek_v2`, `deepseek_v3`, `minimax_m3`,
`mixtral`, `qwen3_5_moe`, `qwen3_moe`, checked against Transformers
5.12.0 modeling code.
- The recompute guard checks the attached decoder layer's current state
and checkpoint configuration: `training=True`,
`gradient_checkpointing=True` and the standard Torch checkpoint partial
with `use_reentrant=True`. An eval-mode decoder does not run its own
Hugging Face checkpoint, so an outer reentrant recompute is rejected
rather than recording a NaN output. Ordinary eval forwards are
unchanged. Transformers 5 defaults to non-reentrant, so explicitly use
`gradient_checkpointing_kwargs={"use_reentrant": True}`.
- Any non-null `moe_layer_pattern` is rejected during configuration
validation when the skip is enabled, even with an explicit or
automatically selected supported preset, a pattern matching the preset,
or an empty string. Leave the pattern unset or disable the skip;
custom-pattern support is unchanged with the option off.
- Other checkpoint APIs, non-reentrant checkpointing with this flag and
unsupported presets are outside the supported contract. Without
recomputation, the ordinary path runs.
- The skip requires that the MoE output has no value-dependent consumer
in the recompute. The combined sentinel is NaN; an invalid consumer can
produce non-finite values or gradients, but the sentinel is **not** a
general runtime proof that arbitrary wrappers, hooks or patched decoder
graphs are safe.

## Finalization

Resolved the upstream conflicts without dropping replay or buffer
behavior. Both normal and recorded combines now share their
backward-context setup, including transferring the pending dispatch
entry from the exchange to the consuming autograd node. Otherwise the
recorded path could retain a stale entry and attempt to replay the
previous step's routing in a later reentrant backward.

The CPU reproducer fails before the context fix with `activation
checkpointing recomputed a different routing`. The new regression
performs three successive steps with changing routes and compares
outputs, input/router/expert gradients and required transfers for both
pre/post score application.

The single CUDA weighting test now runs in a fresh `DistributedTest`
worker, retaining its actual fused/recorded-backward comparison rather
than allocating CUDA from an ordinary forked unittest. The existing
real-DeepEP skip parity cases run two steps per model. The one-step test
helper's defaults and original tolerances remain unchanged.

### Review follow-up

Following the review, reject pattern overrides before model conversion.
Applying an override preserves the supported preset name but can select
a different decoder parent, so a preset-name whitelist cannot establish
the residual-only output-consumer contract. The fix is a four-line
configuration guard, not a decoder-graph validator or a runtime
fallback.

Six parametrized cases cover automatic and explicit preset selection, a
custom parent, the preset's own pattern and an empty pattern. Each also
checks that disabling the skip or leaving the pattern unset remains
accepted. Both configuration references document the restriction. The
kernels, recorded backward, supported execution paths and numerical
thresholds are unchanged.

### Training-state guard follow-up

The decoder must actually be checkpointing, not merely configured to
checkpoint. Hugging Face enables the per-layer checkpoint only when
`gradient_checkpointing` and `training` are both true. Without the
training-state check, an eval decoder under an outer reentrant
checkpoint can feed the recorded NaN into a value-dependent consumer
such as `y * y`. The original guard was reproduced on CPU with finite
forward output but non-finite input, router and expert gradients, for
both pre and post score application.

The guard now fails closed in that invalid recompute. A faithful decoder
harness uses actual Torch nested reentrant checkpoints: training-mode
output and every input/router/expert gradient match the unskipped CPU
reference, eval-mode outer recomputes raise, and ordinary train/eval
forwards retain the full route unchanged. The kernel, backward and
numerical thresholds are unchanged.

The latest master merge preserves the maintainers' existing merge
commits and resolves only the import conflict by retaining `math`,
`weakref` and `partial`. The lightweight `__new__` test layer explicitly
initializes the optional overlap flag to its disabled default for
eventual merge compatibility; the independent overlap feature from
deepspeedai#8739 is not imported into this PR.

## Testing

Latest training-state guard validation: **145 passed, 1 CUDA test
skipped, 58 subtests passed**, on **1x Apple M4 Pro CPU**, macOS 26.7,
Python 3.11.15, Torch **2.14.1**, pytest 9.1.1; CUDA and accelerator
driver are not applicable. This covers the complete comm/replay suite,
configuration tests and supported decoder attachment. The same selector
previously reported **139 passed, 1 skipped, 52 subtests passed** for
the earlier pattern-guard follow-up:

```bash
DS_ACCELERATOR=cpu PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONDONTWRITEBYTECODE=1 \
  python -m pytest -q -p no:cacheprovider \
  tests/unit/module_inject/test_auto_ep_comm.py \
  tests/unit/v1/moe/test_autoep_unit.py::TestAutoEPConfig \
  tests/unit/v1/moe/test_autoep_unit.py::TestModelDetectionAndReplacement::test_skip_recompute_combine_attaches_each_layer_to_its_decoder_layer
```

The skipped case requires CUDA and Triton for recorded fused weighting;
its existing device evidence is listed below. The newly affected
nested-checkpoint and ordinary-forward train/eval tests also pass under
isolated forked workers (**2 passed, 0 skipped**):

```bash
DS_ACCELERATOR=cpu PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONDONTWRITEBYTECODE=1 \
  python -m pytest -q -p no:cacheprovider -p pytest_forked --forked \
  tests/unit/module_inject/test_auto_ep_comm.py::TestSkipRecomputeCombine::test_outer_recompute_respects_the_decoder_training_state \
  tests/unit/module_inject/test_auto_ep_comm.py::TestSkipRecomputeCombine::test_nothing_is_skipped_without_a_recompute
```

The new regression produces exactly two missing-error failures with the
original guard (eval mode, pre/post), while its two training controls
pass. The earlier six pattern regressions passed under isolated forked
workers (**6 passed, 0 skipped**) on the same CPU setup:

```bash
DS_ACCELERATOR=cpu PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONDONTWRITEBYTECODE=1 \
  python -m pytest -q -p no:cacheprovider -p pytest_forked --forked \
  tests/unit/v1/moe/test_autoep_unit.py::TestAutoEPConfig::test_skip_recompute_combine_rejects_pattern_overrides_even_with_supported_presets
```

Existing product validation is bound to the original PR commit
`29303c378`: **275 passed, 1 skipped** on four H100s. All four
eager/fused and uniform/skewed skip-parity cases ran, as did the
recorded fused-weighting backward test. The skipped case is a MiniMax-M3
router-logit test requiring Transformers >=5.15.0; the validation
environment has 5.12.0. This is reused evidence for the original
implementation, not a claim that the entire suite was rerun after
rebase.

Pre-review focused CPU validation: **75 passed, 1 CUDA test skipped**,
under both ordinary pytest and `pytest --forked`, on macOS with Torch
2.10.0 and Transformers 5.12.0. This covers the comm/replay suite, three
skip config/conversion cases and the one-step helper defaults. Ordinary
pytest also reports **52 subtests passed**.

Earlier focused device validation, before the pattern and training-state
guard follow-ups: **9 passed, 0 skipped** with `pytest --forked`, on
**4x NVIDIA H100 80GB HBM3**, driver **580.159.04**, Torch
**2.10.0.2+cu130 / CUDA 13.0**, Triton **3.6.0**, Transformers
**5.12.0**, using the previously validated DeepEP runtime:

- All four eager/fused and uniform/skewed skip-parity cases run two
training steps on each model. They retain the original numerical bounds,
check last-step output/input/router/parameter gradients and accumulated
parameter deltas, and verify one forward combine per layer per step
rather than two.
- The four upstream non-reentrant/nested-reentrant replay cases still
pass, confirming that the shared context preserves normal replay
behavior.
- The recorded fused-weighting backward comparison runs in a fresh
worker. The original ordinary unittest reproduces `Cannot re-initialize
CUDA in forked subprocess` on the same setup; the new worker-based case
passes.

GPU reproduction selector, from `tests/`:

```bash
PYTHONPATH=.. DEEPSPEED_RUN_H100_TESTS=1 pytest --forked \
  unit/module_inject/test_auto_ep_comm.py unit/v1/moe/test_autoep_deepep_parity.py \
  -k 'skipping_the_recomputed_combine or recorded_fused_row_weighting or non_reentrant_checkpointing_replays'
```

Changed-files pre-commit passed for all 11 files in the final PR delta.
Existing device evidence is reused for unchanged kernels/backward and
supported training paths; GPU tests, full E2E and the existing
performance matrix were not restarted for these guard follow-ups. The
new state predicate is exercised through actual Torch
checkpoint/autograd on CPU, not presented as a fresh H100 execution or a
real Transformers-model run. The focused tests do not establish every
ZeRO/offload/TP/PP combination, other hardware, arbitrary checkpoint
composition or long-run convergence.

The static CI selector includes the v1 AutoEP unit and parity files.
Real DeepEP cases remain gated on the opt-in H100 test flag, four GPUs
and a GIN-capable DeepEP build, so test collection alone does not prove
they ran. The standalone recorded-weighting CUDA comparison is outside
Modal's v1 test scope and was explicitly included in the focused
hardware command above; its recorded path is also exercised by the v1
model-parity cases. Full GPU CI follows the repository's merge-queue
workflow.

## Existing performance evidence

Qwen3-30B-A3B, **8 H100s**, EP8, micro-batch **4**, gradient
accumulation **16**, sequence **4096**, DeepEP **28 SMs**, reentrant
activation checkpointing; **30 steps with 10 warmup**. The equivalent
benchmark prototype records the same weighting/combine backward but
returns uninitialized output where the product fills NaN. Both arms
inherit concatenated gate+up and backward weight-gradient overlap; this
is the **incremental skip effect**, not their combined benefit.

One allocation, order normal / skip / skip / normal:

| Recompute | Run medians | Mean |
|---|---|---:|
| Normal | 20,575.1 / 20,574.2 ms | 20,574.7 ms |
| Combine + post-weighting forward skipped | 19,945.7 / 19,928.2 ms |
**19,936.9 ms (-3.10%)** |

Peak allocated memory stayed at **58.69 GB**; peak reserved memory was
**0.25 GB lower**. Loss differences over these 30 steps were within
same-arm repeat noise (maximum **9.4e-4**). The 8-GPU residual-block
gate had numerical equality under `torch.equal` for output/input/router
gradients and expert-gradient differences around **5e-5 relative L2**,
within two normal recomputes' variation. `torch.equal` is not a claim
about signed-zero bit patterns.

The measurements are historical prototype evidence, **not** a retiming
of the rebased product or a universal benefit across models/hardware.
Skipping the forward combine removes that recompute transfer; it does
not add overlap or remove the cached dispatch and weight-gradient
communication required by backward.

---------

Signed-off-by: yh0903 <helloyu0903@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: pengdurice <pengduhit@gmail.com>
banxingmjj pushed a commit to openanolis/DeepSpeed that referenced this pull request Nov 15, 2026
…bine (deepspeedai#8739)

The fused gate+up prerequisite, deepspeedai#8733, has merged.
This branch is synchronized with current master and retains only the
backward-overlap feature delta; no force-rewrite of the earlier
submitted commits is required.

In AutoEP's DeepEP backward, the experts compute their input gradient
(dX) and their weight gradients (dW). DeepEP's combine then sends dX
back to the token ranks. dW and the combine are independent, yet they
run serially: a grouped GEMM's backward computes dX and dW together, and
only then does the dispatch backward start the combine. In a kernel
profile of Qwen3-30B-A3B on 8 H100s, DeepEP ran concurrently with no
compute kernel at all.

This adds an opt-in `expert_parallel.overlap_weight_grad`, which runs
the combine and the dW GEMMs side by side.

### Change

- `GroupedExperts.forward` takes an optional `ExpertWeightGradSlot`.
- With a slot, `_DeferredWeightGradExperts` runs the same forward as the
`torch._grouped_mm` path, for separate or fused gate+up and every
registered activation.
  - Its backward returns dX at once and leaves the dW GEMMs in the slot.
- The GEMMs are the products autograd forms for `torch._grouped_mm`
(`_grouped_mm_mat1_backward`, `_grouped_mm_mat2_backward`).
- The DeepEP dispatch takes the expert weights as extra inputs. Its
backward:
  1. launches the dX combine with `async_with_compute_stream=True`;
  2. runs the slot's dW GEMMs on the compute stream;
  3. waits on the combine's event;
4. returns dW through autograd, so ZeRO's gradient handling is
unchanged.
- SM carveout:
- `torch._grouped_mm` launches persistent kernels sized to every SM,
which leaves the combine nowhere to run.
- The dW GEMMs are therefore launched with `comm_num_sm` SMs withheld
through `torch._C._set_sm_carveout_experimental`.
  - The previous carveout is restored even if the GEMMs raise.
- The pending combine's event is waited on in a `finally` block as well,
so a dW error does not leave the queued communication unaccounted for.
- Activation backward:
- The activation registry gains optional standalone backward functions
for the fused kernels. `swiglu` provides them, via new `swiglu_backward`
and `swiglu_packed_backward`, which the existing autograd functions now
also call.
- Forms without them are recomputed and differentiated, so the deferred
path always matches the forward that ran.
- The default, off, keeps the existing path.
- Master's per-layer checkpoint-dispatch replay and exact-size
buffer-slice optimization are retained. Overlap slots are separate per
invocation and do not replace replay handles.
- The deferred custom backward is first-order only: `create_graph=True`
raises rather than returning an incomplete derivative.
- `overlap_weight_grad` is rejected, rather than ignored, unless all of
these hold:
  - `comm_backend="deepep"` with `autoep_size > 1`;
- `use_grouped_mm=true`, and the experts do not select the Triton
grouped GEMM;
  - ZeRO stage 1 or 2, explicitly rejecting both stage 0 and stage 3;
  - PyTorch provides both the SM carveout getter and setter APIs.
- Docs: `autoep.rst` and the config reference.

### Tests

- CPU, `TestDeferredExpertWeightGrad`:
- Output, input gradient and `w1`/`w2`/`w3` gradients match the plain
path's values exactly in the tested CPU cases, for every activation,
separate and fused gate+up, FP32 and BF16, with weight gradients
immediate or deferred, including an empty expert. This does not assert
universal bit-pattern equivalence.
- Also: slot lifecycle errors, the `torch._grouped_mm` requirement, and
config validation for every rejected setting.
- CPU, `TestWeightGradOverlap`, the route against a DeepEP contract
buffer:
- Exact numerical agreement with the serial backward in the tested CPU
cases, separate and fused gate+up, with no checkpointing, reentrant and
non-reentrant checkpointing, now composed with upstream's replay
coordinator.
- The order is async combine, then dW with `comm_num_sm` withheld, then
wait.
  - The carveout is restored, including on error.
- A dW exception still waits for the async combine before propagating;
it does not widen optimizer/backend support.
- GPU, H100, 402 passed:
- `test_overlapped_weight_gradients_match_the_serial_backward`, on 4
GPUs with DeepEP, uniform and skewed routing, separate and fused
gate+up: input and every parameter gradient within 1e-2 relative L2, the
shared parity checks, and no leaked carveout.
  - The CUDA bitwise check with the Triton kernels.
- `swiglu_backward` and `swiglu_packed_backward` bitwise against
autograd.
  - The rest of the DeepEP parity, AutoEP unit and activation suites.
- Not part of this change: the 2 failures are
`TestMiniMaxM3Block::test_replaced_block_matches_hf_block`. That preset
needs Transformers >= 5.15.0, and the image has 5.12.0.
- End to end, Qwen3-30B-A3B on 8 H100s:
- Setup: expert parallel size 8, micro-batch 4, 16 accumulation steps,
sequence length 4096, DeepEP, reentrant checkpointing, fused gate+up, 30
steps with 10 warmup.
- Measured with an equivalent benchmark patch on our benchmark base: the
same deferral, async combine and carveout.
  - Two pairs in one job:

    | Arm | Mean step |
    |---|---:|
    | Serial backward | 21,569.5 ms |
    | Overlap without the carveout | 21,418.5 ms (-0.70%) |
    | **Overlap with the carveout** | **21,097.3 ms (-2.19%)** |

- A kernel profile showed DeepEP running alongside grouped GEMMs for
1,325 ms of the step, against none before.
- Step-1 loss identical. Later losses agree within same-arm repeat
noise.
- Peak allocated memory unchanged; reserved memory about 0.7 GB higher.
- A follow-up sweep in one job: withholding more SMs than DeepEP uses
(24 with `comm_num_sm=12`) was 0.9% slower. That supports tying the
carveout to `comm_num_sm`.
- The overlap's gain depends on how much backward communication is left
to hide. A second job separated the SM budget from the overlap:

    | Arm | Mean step |
    |---|---:|
    | Serial backward, `comm_num_sm=12` | 21,569.9 ms |
    | Serial backward, `comm_num_sm=20` | 20,942.6 ms |
| **Overlap, `comm_num_sm=20`** | **20,696.9 ms (-1.17% vs serial at
20)** |
    | Overlap, `comm_num_sm=28` | 20,638.8 ms |

On this single node, more DeepEP SMs speed up every DeepEP call
regardless of this option. The overlap saves 472 ms at 12 SMs and 246 ms
at 20.

### Review follow-up

- The ZeRO-0 feedback is addressed by failing closed: `zero_stage not in
(1, 2)` is rejected while the disabled default still permits the
ordinary stage-0 path.
- The engine now passes its actual ZeRO stage into that validator.
Previously it omitted the keyword, so tightening the validator alone
would incorrectly treat every optimizer as stage 0; both direct-config
and engine-wiring cases cover stages 0/1/2/3.
- Master synchronization preserves the already merged
numerical-reference policy, packed-kernel input-device/stream guard and
higher-order rejection. Extracted standalone backward helpers use the
input device rather than whichever CUDA device happens to be current.
- The real-DeepEP comparison now reads trainable accumulated gradients
through `safe_get_full_grad` before `engine.step()`, including stage-2
cases where `param.grad` is released. It does not accept an empty
expert-gradient dictionary as proof of parity.
- Prior targeted H100 acceptance: **40 passed, 0 skipped**, on an 8x
NVIDIA H100 80GB HBM3 host (distributed cases use four ranks), driver
580.159.04, torch 2.10.0.2/CUDA 13.0, Triton 3.6.0 and transformers
5.12.0. It covers both supported ZeRO stages, uniform/skewed routing,
separate/fused gate+up, replay composition, standalone helper device
selection and every trainable gradient before clipping. The 1e-2
relative-L2 criterion is unchanged.
- On Apple M4 Pro CPU with torch 2.14.1, the comm suite passes **66/66
in forked mode**; targeted config/folding/activation checks pass.
Removing only the three guards reproduces all **four** expected failures
(ZeRO 0 accepted, missing event wait, and separate/fused incomplete
higher-order derivatives). CPU mocks are not presented as physical
DeepEP validation.
- Existing 402-passing-case H100 and E2E results above are reused, not
described as fresh broad-hardware or full-training validation. The new
follow-up retains the old numerical thresholds and performs no
throughput sweep.
- The activation-weighting child, deepspeedai#8748, is
reviewed after this parent and remains a separate opt-in feature; its
shifted-rounding semantics are not part of this PR.

AI assistance was used for review and test preparation. The human author
reviewed the exact task-specific diff before signoff/publication. This
updates an existing PR rather than opening a duplicate feature
implementation.

DCO, test collection and changed-files pre-commit passed on the
published head. Full GPU CI and infrastructure smoke jobs were skipped;
they are not described as a full GPU CI run. On-device evidence for this
review follow-up is the targeted H100 execution above.

### Latest review follow-up

Applied the requested minimal test-double repair: `record_validate`
accepts and records `zero_stage`, and the existing sequence-parallel
engine test asserts the actual stage is `0`. It no longer rejects the
engine's keyword argument, and it would still catch missing stage
forwarding instead of silently ignoring it. The original test reproduced
`TypeError: ... unexpected keyword argument 'zero_stage'` before the
repair.

Synchronized with master to resolve the test-fixture import conflict.
The worker-only fixture retains both this PR's standalone SwiGLU
backward helpers and master's merged clamped activation helpers and
tests. The only manual edits in this follow-up are in those two test
files; no manual kernel, autograd, scheduling, numerical-threshold or
default changes were made. The activation-weighting child remains
separate.

Validation on **1x Apple M4 Pro CPU**, macOS 26.7, Python 3.11.15, Torch
**2.14.1**, pytest 9.1.1; CUDA and accelerator driver are not
applicable:

- Configuration, deferred expert gradients, ZeRO stage 0/1/2/3 engine
wiring, and complete comm/replay coverage: **159 passed, 8 CUDA-only
skipped, 49 subtests passed**. The repaired sequence-parallel test
passes.
- The repaired test also passes under `--forked`. Three selected SwiGLU
cases reach the merged worker fixture and skip explicitly because
CUDA/Triton is unavailable; this is import/worker coverage, not kernel
execution.
- All **155** SwiGLU cases collect, including both standalone backward
and clamped forms. Changed-files pre-commit passes for all 14 files in
the final PR delta.

CPU reproduction command, from the repository root:

```bash
DS_ACCELERATOR=cpu PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONDONTWRITEBYTECODE=1 \
  python -m pytest -q -p no:cacheprovider \
  tests/unit/v1/moe/test_autoep_unit.py::TestAutoEPConfig \
  tests/unit/v1/moe/test_autoep_expert_activation.py::TestDeferredExpertWeightGrad \
  tests/unit/v1/moe/test_autoep_expert_activation.py::TestFusedGateUp::test_overlap_weight_grad_settings_are_validated \
  tests/unit/v1/moe/test_autoep_expert_activation.py::TestFusedGateUp::test_overlap_weight_grad_rejects_the_triton_grouped_gemm \
  tests/unit/v1/moe/test_autoep_expert_activation.py::TestFusedGateUp::test_engine_passes_the_actual_zero_stage_to_overlap_validation \
  tests/unit/module_inject/test_auto_ep_comm.py
```

The prior H100 and E2E results above are reused evidence for the overlap
implementation, not a new device run of this merged tree. GPU
integration, throughput, memory and convergence experiments were not
repeated for this test-only review repair and import-conflict
resolution. No additional ZeRO/offload/TP/PP or hardware combinations
are claimed.

---------

Signed-off-by: yh0903 <helloyu0903@gmail.com>
Signed-off-by: Masahiro Tanaka <tanaka.masahiro@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: pengdurice <pengduhit@gmail.com>
Co-authored-by: Masahiro Tanaka <tanaka.masahiro@gmail.com>
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