Repository navigation
[Determinism] Support deterministic fused MoE auxiliary loss - #7697
Open
zhongbozhu wants to merge 6 commits into
Open
zhongbozhu wants to merge 6 commits into
zhongbozhu wants to merge 6 commits into
Conversation
Contributor
Author
|
/ok to test b02ba07 |
| if fused: | ||
| if not HAVE_TE or fused_moe_aux_loss is None: | ||
| raise ValueError("fused_moe_aux_loss is not available. Please install TE >= 2.7.0.") | ||
| deterministic = deterministic or torch.are_deterministic_algorithms_enabled() |
Contributor
There was a problem hiding this comment.
Nit.
Should we just trust deterministic and remove this line?
The False-vs-global-True case should be a conflict.
- config.deterministic_mode=True together with the torch global enabled is consistent (in deterministic setup), so nothing to raise.
- deterministic_mode=False with the torch global True currently runs deterministic silently because of the
or. If you'd rather trust the config, validate once at config setup (raise on that mismatch) instead of re-checking inside every loss call. As a nit, either is acceptable.
Contributor
|
Hi, @zhongbozhu, I'd expect you may remove the flag |
yaox12
approved these changes
Oct 14, 2026
zhongbozhu
force-pushed
the
fix/deterministic-moe-aux-loss
branch
from
October 20, 2026 05:11
b02ba07 to
be26a58
Compare
Detect TE's deterministic aux-loss API and propagate explicit or PyTorch global determinism through all three router loss paths. Allow supported fused execution in deterministic mode while preserving legacy TE compatibility and existing flag precedence. Validate capability and dispatch compatibility, unfused-reference equivalence, and bitwise loss and gradient replay. Focused GB200 tests: 40 passed, with the atomic negative control observing nondeterminism. Signed-off-by: zhongboz <zhongboz@nvidia.com>
Signed-off-by: zhongboz <zhongboz@nvidia.com>
Signed-off-by: zhongboz <zhongboz@nvidia.com>
zhongbozhu
force-pushed
the
fix/deterministic-moe-aux-loss
branch
from
October 28, 2026 07:04
be26a58 to
15a5285
Compare
Contributor
Author
|
/ok to test 15a5285 |
Contributor
|
/ok to test 4dc9d6b |
Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
Contributor
|
/ok to test 44034a3 |
Complete the sequence aux-loss router stub configuration and keep dense TopK replay coverage independent of the optional deterministic fused aux-loss API. Signed-off-by: zhongboz <zhongboz@nvidia.com>
Contributor
Author
|
/ok to test ba117d6 |
ZhiyuLi-Nvidia
approved these changes
Oct 30, 2026
cspades
approved these changes
Oct 30, 2026
Phlip79
approved these changes
Oct 30, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Detect TE's deterministic aux-loss API and propagate explicit or PyTorch global determinism through all three router loss paths. Allow supported fused execution in deterministic mode while preserving legacy TE compatibility and existing flag precedence.
Validate capability and dispatch compatibility, unfused-reference equivalence, and bitwise loss and gradient replay. Focused GB200 tests: 40 passed, with the atomic negative control observing nondeterminism.
TE PR should be merged first: NVIDIA/TransformerEngine#3587
Fixes #7221
What does this PR do?
Issue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
jit_fuser/torch.compile, CUDA extension, TE or external-library dispatch, or a scatter/index accumulation), I have added or updated its bit-exact determinism test and registered it intests/unit_tests/determinism/kernels/manifest.py(guide)Code review
Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.