Repository navigation
AutoEP: opt-in skip of the recomputed DeepEP combine - #8745
Conversation
With reentrant activation checkpointing, backward recomputes each decoder layer only to rebuild its autograd graph and never reads the recomputed outputs. In a decoder layer that adds the MoE output to the residual, the recomputed MoE output is therefore unread. expert_parallel.skip_recompute_combine lets the DeepEP route record the post-expert row weighting and the combine in that recompute without running them; their backward (a cached dispatch on the same handle, and the row-weighting gradients) is unchanged. Guards, since the skip relies on nothing reading the skipped output: - each recompute checks that the layer's decoder layer uses Hugging Face per-layer gradient checkpointing with use_reentrant=True, and raises otherwise; - only presets whose decoder layer adds the MoE output straight to the residual are accepted (deepseek_v2, deepseek_v3, minimax_m3, mixtral, qwen3_5_moe, qwen3_moe); - the skipped combine returns NaN, so a value-dependent reader outside the contract can produce non-finite values or gradients; - requires comm_backend="deepep" with autoep_size > 1. Eager and fused row weighting are both supported. Preserve the upstream non-reentrant replay and exact-size buffer handling. Normal and recorded combines share backward-context setup so replay entries are owned by their consuming graph rather than leaking into a later step. Cover changing routes over successive CPU steps and two-step real-DeepEP parity, and run the CUDA weighting comparison in a fresh test worker. Signed-off-by: yh0903 <[email protected]>
29303c3 to
42243d7
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42243d788f
ℹ️ 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".
| self.combine_impl = resolve_combine_impl(config.combine_impl) | ||
| self.row_weighting_impl = resolve_row_weighting_impl(config.row_weighting_impl) | ||
| self.skip_recompute_combine = config.skip_recompute_combine | ||
| if self.skip_recompute_combine and spec.model_family not in SKIP_RECOMPUTE_COMBINE_PRESETS: |
There was a problem hiding this comment.
Reject custom MoE patterns before enabling combine skipping
With a supported preset_model (or auto-detected model_type) plus a moe_layer_pattern override, resolve_preset_candidates() applies the override while preserving the supported preset name, so this test accepts a custom parent even though docs/code-docs/source/autoep.rst:423-426 says custom patterns are rejected. If that checkpointed parent does anything value-dependent with the MoE output before the residual, _RecordedDeepEPCombine feeds it NaNs and can corrupt gradients. Reject the override at validation/conversion or validate the actual parent contract rather than only model_family.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🟡 Changes recommended
Custom MoE layer-pattern overrides can bypass the preset safety gate and enable combine skipping for unvalidated decoder graphs.
1 open finding
What changed in this PR
Adds an opt-in AutoEP optimization that skips DeepEP combine work during supported reentrant checkpoint recomputation while preserving backward behavior.
Changes:
- Adds configuration, validation, decoder attachment, and recorded combine/weighting paths.
- Adds CPU and H100-focused correctness and replay regressions.
- Documents supported presets, constraints, and performance evidence.
| File | Description |
|---|---|
deepspeed/module_inject/auto_ep_config.py |
Parses and validates the new option. |
deepspeed/module_inject/auto_ep_presets/base.py |
Adds the configuration field. |
deepspeed/module_inject/auto_ep.py |
Attaches replacement MoE layers to decoder parents. |
deepspeed/module_inject/auto_ep_layer.py |
Detects supported recomputation and records skipped operations. |
deepspeed/module_inject/auto_ep_comm.py |
Implements recorded combine with shared backward context. |
deepspeed/ops/triton_ops/autoep_fused_token_ops.py |
Adds recorded fused row weighting. |
tests/unit/module_inject/test_auto_ep_comm.py |
Covers recorded backward behavior and repeated steps. |
tests/unit/v1/moe/test_autoep_unit.py |
Tests configuration and decoder attachment. |
tests/unit/v1/moe/test_autoep_deepep_parity.py |
Adds real DeepEP parity and combine-count tests. |
docs/code-docs/source/autoep.rst |
Documents behavior, safety constraints, and results. |
docs/_pages/config-json.md |
Adds the configuration reference. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Thank you for this awesome optimization!
One small issue I found is that skip_recompute_combine still accepts
a custom moe_layer_pattern together with a supported preset. The pattern
override changes the decoder parent while the preset name remains supported,
so the later whitelist does not prove that the custom parent only performs the
validated residual add. A value-dependent wrapper can consume the recorded
combine's NaNs during recomputation and corrupt gradients.
The minimal fix could be to reject a non-null moe_layer_pattern whenever skip_recompute_combine is enabled and add a supported-preset-plus-custom-pattern regression. See this commit.
A pattern override can select an unchecked decoder parent while retaining a supported preset name. Reject any non-null moe_layer_pattern before enabling the recompute skip, since the preset whitelist alone cannot establish the output-consumer contract. Cover automatic and explicit preset selection, custom, matching and empty pattern overrides, and unchanged validation with the skip disabled or the pattern unset. Document the restriction at both configuration entry points. Signed-off-by: yh0903 <[email protected]> Co-authored-by: Copilot <[email protected]>
Thanks @tohtana ! Applied the minimal validation guard you suggested in |
ghost
left a comment
There was a problem hiding this comment.
Reviewed at 15e5dbbe.
The recorded combine and row weighting look right to me. The recorded eager backward follows the same steps autograd takes through (rows.float() * weights).to(rows.dtype), and the context sharing with _DeepEPCombine keeps the replay entry tied to the consuming node. On CPU (gloo), test_auto_ep_comm.py and test_autoep_unit.py pass at this head: 275 passed, and the 7 skips need CUDA.
One point I think should be fixed, inline below. The recompute guard checks the decoder layer's configuration, not whether the decoder layer is actually checkpointing.
A note for whichever of this PR and #8739 lands second, since both edit _deepep_route. I merged the two locally. The product-code conflict is two adjacent new blocks, and keeping both works. After the merge, five TestSkipRecomputeCombine tests fail with AttributeError: ... no attribute 'overlap_weight_grad', because make_layer builds the layer with __new__ and #8739's route reads that attribute. Adding layer.overlap_weight_grad = False to make_layer fixes them. I also ran the two features together on the CPU harness: two steps with changing routes, score_apply pre and post, with skip alone, overlap alone, and both. The output and all input, router and expert gradients were bitwise equal to the plain run in every case.
| checkpoint_func = getattr(decoder_layer, "_gradient_checkpointing_func", None) | ||
| reentrant = (isinstance(checkpoint_func, partial) and checkpoint_func.func is torch_checkpoint | ||
| and checkpoint_func.keywords.get("use_reentrant") is True) | ||
| if not getattr(decoder_layer, "gradient_checkpointing", False) or not reentrant: |
There was a problem hiding this comment.
Transformers' GradientCheckpointingLayer.__call__ (5.12 and 5.22) only checkpoints when self.gradient_checkpointing and self.training. In eval mode, the decoder layer runs without its checkpoint, but this check still passes, because the configuration is unchanged. If an outer reentrant checkpoint spans the decoder layer, its recompute runs this route inside backward with grad enabled. That sets record_only, the guard passes, and the NaN output reaches whatever reads the decoder output next. I reproduced it on CPU with your TestSkipRecomputeCombine harness: a decoder layer that checkpoints only when training, inside an outer checkpoint(..., use_reentrant=True) followed by y * y. In training mode the gradients are bitwise equal to the unskipped run. In eval mode the gradients of x, the gate and w2 all contain non-finite values, and no error is raised. That is the "checkpoint spanning several layers" case the docstring describes. Requiring decoder_layer.training here as well would match the condition under which the decoder actually checkpoints.
Hugging Face only checkpoints a decoder when gradient_checkpointing and training are both enabled. Reject eval-mode outer recomputes before recording NaN outputs rather than treating a configured checkpoint function as an active per-layer checkpoint. Use actual nested Torch reentrant checkpoints in the existing CPU decoder harness to cover training and eval with pre/post score application. Preserve ordinary eval behavior and the existing pattern restriction, initialize the optional overlap flag in the lightweight test mock, and update both configuration references. Resolve the master import conflict by retaining math, weakref and partial. The human author reviewed the exact staged tree before signoff; focused regression, original-guard controls and changed-files pre-commit passed. Signed-off-by: yh0903 <[email protected]> Co-authored-by: Copilot <[email protected]>
Head branch was pushed to by a user without write access
tohtana
left a comment
There was a problem hiding this comment.
Thank you for the update! Looks good to me.
8702b42
Resolve the conflict with deepspeedai#8745 in tests/unit/v1/moe/test_autoep_unit.py: keep its two skip_recompute_combine tests and this PR's test_fused_combine_accepts_folded_tensor_parallelism. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: pengdurice <[email protected]>
…folding (deepspeedai#8847) # AutoEP: support `combine_impl="fused_weighted_sum"` with AutoEP+AutoTP folding **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 deepspeedai#8670. ## Problem `combine_impl="fused_weighted_sum"` was refused whenever `tensor_parallel.autotp_size > 1`: - `deepspeed/module_inject/auto_ep_config.py` (`validate_autoep_config`) raised `ValueError`. - `deepspeed/module_inject/auto_ep_layer.py` (`set_deepspeed_parallelism`) raised the same error. The reason was that the folded path restores tokens with its own function, `restore_combined` in `deepspeed/moe/ep_tp_dispatch.py`, and the fused kernel was only wired into the unfolded path. `restore_combined` works like this: 1. Each TP peer sends only part of the routed assignments to the experts (`partition_assignments`). 2. After the experts, it all-gathers the rows, their token index, their top-k slot and their routing weight over the TP group. 3. It casts the routing weights to the activation dtype, multiplies, and adds the products with one `index_add_` per top-k slot, all in the activation dtype. So under folding, users could not get the memory saving and the FP32 accumulation of the fused kernel, and the folded restore did its arithmetic in bf16. ## Change - New `restore_combined_fused` in `deepspeed/moe/ep_tp_dispatch.py`: - It does the same differentiable all-gathers as `restore_combined` for the rows and the routing weights, so the `tp_size` gradient factor that the folded AVERAGE and EXPERT_TP_CANCEL strategies cancel is unchanged. - It all-gathers one flat index (`token * top_k + slot`) instead of the token index and the slot separately. - It keeps the routing weights in the router dtype, scatters them into `[tokens, top_k]`, and calls the existing `fused_weighted_restore`. The kernel is unchanged. - It raises a clear `RuntimeError` if the gathered rows do not cover every (token, slot). The folded payload never drops or pads assignments today, so this cannot trigger now; it protects the kernel from reading an unset source row if capacity dropping is added later. - `validate_coverage=True` runs the same coverage check as `restore_combined`. - `AutoEPMoELayer._forward` calls `restore_combined_fused` in the folded branch when `combine_impl == "fused_weighted_sum"`. The default (`"auto"` → `"weighted_sum"`) still calls `restore_combined`. - The two `autotp_size > 1` refusals are removed. The other fused refusals stay: `expert_tensor_parallel_size > 1`, DeepEP, `score_apply` other than `"post"`, and unsupported device or dtype. - Docs: `docs/code-docs/source/autoep.rst` describes the folded fused restore and drops the refusal from the list; `docs/_pages/config-json.md` drops the `autotp_size=1` requirement and lists float32 among the accepted activation dtypes, as the kernel's check does. ## Tests On master e35282b with this change, pytest 8.3.5: | Test | What it checks | GPUs | torch 2.8.0+cu126 | torch 2.9.1+cu128 | |---|---|---|---|---| | `test_autoep_unit.py` (includes `TestAutoEPConfig::test_fused_combine_accepts_folded_tensor_parallelism`, was `..._rejects_...`) | the config is accepted with `tp_size=2`; no other config change | up to 8 | 214 passed | not run | | `test_autoep_autotp_dispatch.py` (includes `test_restore_combined_fused_rejects_a_missing_assignment` and `TestRestoreCombinedFusedTensorParallel`, fp32 and bf16 rows) | a missing (token, slot) raises instead of reading an unset row; 2 TP peers with different row counts, each back-propagating a different gradient: the output is bitwise equal to the unpartitioned `fused_weighted_restore`, and the row and score gradients, summed over the peers, match the unpartitioned gradients | 0 and 2 | 12 passed | 12 passed | | `test_autoep_fused_parity.py::TestAutoEPFusedParityFoldedTensorParallel` (ZeRO 0, 2 and 3, with and without activation checkpointing) | one training step with TP 2 × EP 2: the loss, output, input gradient, every parameter gradient and every parameter update of the fused run match the default folded run | 4 | 6 passed | 6 passed | | rest of `test_autoep_fused_parity.py` (master's cases) | unchanged | 1-2 | not run (they fail on torch 2.8 on master too, see below) | 17 passed | | `test_autoep_fused_token_ops.py` | the kernel is unchanged | 1 | 63 passed | not run | | `test_autoep_autotp_grad_parity.py` with `DEEPSPEED_RUN_H100_TESTS=1` | no change to the default folded path | up to 8 | 20 passed | not run | | `test_auto_ep_comm.py`, `test_autoep_autotp_folding_config.py` | other uses of the combine and folding settings | up to 8 | 65 passed, 3 skipped, 6 failed (see below); 33 passed | not run | | `test_autoep_expert_activation.py` | other uses of `combine_impl` | 1-2 | not run (stalls on torch 2.8 on master too, see below) | 96 passed, 12 skipped (a grouped path that needs CUDA tensors when Triton is installed) | Hardware: 1 node of 8 NVIDIA H100 80GB (driver 595.112.07); torch 2.8.0+cu126 with Triton 3.4.0, and torch 2.9.1+cu128. JIT-built ops used the CUDA 12.8 toolkit (`CUDA_HOME`). Every failure and stall above also happens on master without this change, and passes or does not occur on torch 2.9.1: - `test_auto_ep_comm.py::TestSkipRecomputeCombine` (6 cases, added by deepspeedai#8745) runs `torch._grouped_mm` on the CPU, which torch 2.8 does not implement (`Could not run 'aten::_grouped_mm' with arguments from the 'CPU' backend`); the same 6 fail on master e35282b. - Master's 17 fp16 cases of `test_autoep_fused_parity.py` (`TestAutoEPFusedParityExpertParallel` x 16, `TestAutoEPFusedParityLocalExperts`) fail on torch 2.8 with `RuntimeError: Expected mat_a to be BFloat16 matrix got Half`, also on master 3fe2d95 without this change: torch 2.8's `torch._grouped_mm` accepts only bf16, and these cases run in fp16 with grouped GEMM. - On torch 2.8 the backward of `torch._grouped_mm` does not return for some shapes when one expert receives no rows: `test_autoep_expert_activation.py::TestFusedGateUp::test_matches_separate_with_skewed_and_empty_experts` stalls there the same way on master 3fe2d95 without this change. The folded test reads each parameter before and after the step. Under ZeRO-3 a parameter holds only its partition, so the test's `_parameters` helper now reads the full fp32 value of ZeRO-3 parameters (`safe_get_full_fp32_param`); in these fp32 runs that is the parameter itself. Master's cases have no ZeRO-3 parameters and are unaffected. The end-to-end folded test runs in FP32, on `MockMoEOnlyTransformer`, without grouped GEMM: - FP32: the default folded restore rounds each product and each top-k addition to the activation dtype. In fp16 the two restores differ by 1 to 1.5 units in the last place of the MoE output (about 1,600 in this model), which is more than `PARITY_TOLERANCE` allows after the LM head. In FP32 the two forward passes are bitwise equal. Since both paths run in FP32, the folded test compares them directly; master's fp16 cases are judged against an FP32 reference instead (deepspeedai#8950), which here would equal the default path. - No attention: the key bias of `nn.MultiheadAttention` has a true gradient of zero, so its computed gradient is rounding noise, and Adam's first step turns that noise into ±lr. The parameter-update check then fails by 2 × lr no matter which restore is used. - No grouped GEMM: on torch 2.8, `torch._grouped_mm` accepts only bf16, so the fp32 run would fail before reaching the restore. `pre-commit run --files` passes on the changed files. ## Benchmark One TP group of 2 H200 GPUs on one node. bf16 rows, FP32 routing weights, random routing with distinct experts per token. The hidden size, top-k and expert count are the MiniMax-M3 and GLM-5.2 values. Memory is the peak above the inputs. Time is one forward and backward, averaged over 10 runs after 3 warm-up runs, and includes the identical partition step. Errors are against an FP64 reference. (Measured on master 5f266e2; neither `ep_tp_dispatch.py` nor the kernel's `fused_weighted_restore` has changed on master since.) | Shape (tokens per TP group, top-k, experts, hidden) | Forward peak, GiB (default → fused) | Backward peak, GiB | Time, ms | Output error, relative L2 | Score gradient error, relative L2 | |---|---|---|---|---|---| | 8,192, 4, 128, 6144 (MiniMax-M3) | 1.22 → 0.75 | 1.59 → 0.84 | 13.3 → 7.4 | 3.58e-3 → 1.66e-3 | 2.35e-3 → 8.4e-8 | | 32,768, 4, 128, 6144 (MiniMax-M3) | 4.88 → 3.00 | 6.38 → 3.38 | 41.1 → 21.0 | 3.57e-3 → 1.66e-3 | 2.34e-3 → 8.3e-8 | | 8,192, 8, 256, 6144 (GLM-5.2) | 2.35 → 1.50 | 3.09 → 1.60 | 26.7 → 12.0 | 4.36e-3 → 1.66e-3 | 2.34e-3 → 8.6e-8 | | 32,768, 8, 256, 6144 (GLM-5.2) | 9.39 → 6.01 | 12.38 → 6.38 | 91.9 → 38.8 | 4.36e-3 → 1.66e-3 | 2.35e-3 → 8.7e-8 | The fused output error of 1.66e-3 is the rounding of the bf16 output itself. The score gradient is the router gradient; the default folded path computes it through bf16 weights, the fused path in FP32. Script: `bench_folded_restore.py` (run with `torchrun --nproc_per_node=2`). ## Notes - The default folded path and the fused path give close but not bitwise-equal results, because the default path multiplies and adds in the activation dtype. - AutoEP+AutoTP folding runs at ZeRO stages 0 to 3 on master (CPU optimizer offload at ZeRO-3 since deepspeedai#8829); the end-to-end test covers ZeRO 0, 2 and 3. ## Duplicate check Searched open pull requests on 2026-11-13 and again on 2026-11-17 ("fused_weighted_sum", "AutoEP AutoTP folding", "folding universal"): none enables the fused combine under folding. deepspeedai#8829 (optimizer offload under folding) and deepspeedai#8823 (clipping under folding) are merged and change other parts of folding; deepspeedai#8745 and deepspeedai#8739 change the DeepEP combine. ## AI assistance This change, its tests and this description were prepared with AI assistance (Claude). --------- Signed-off-by: pengdurice <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>

Summary
Add opt-in
expert_parallel.skip_recompute_combinefor 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 #8731. The branch preserves that replay, the fused gate+up defaults from #8733, and the independent exact-size buffer checks from #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 unchangedscore_applyboundary.deepseek_v2,deepseek_v3,minimax_m3,mixtral,qwen3_5_moe,qwen3_moe, checked against Transformers 5.12.0 modeling code.training=True,gradient_checkpointing=Trueand the standard Torch checkpoint partial withuse_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 usegradient_checkpointing_kwargs={"use_reentrant": True}.moe_layer_patternis 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.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
DistributedTestworker, 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_checkpointingandtrainingare 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 asy * 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,weakrefandpartial. The lightweight__new__test layer explicitly initializes the optional overlap flag to its disabled default for eventual merge compatibility; the independent overlap feature from #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:
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):
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:
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:Cannot re-initialize CUDA in forked subprocesson the same setup; the new worker-based case passes.GPU reproduction selector, from
tests/: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:
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.equalfor output/input/router gradients and expert-gradient differences around 5e-5 relative L2, within two normal recomputes' variation.torch.equalis 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.