Repository navigation
test(moe): realign expert batching with the causal replay pass - #3795
Merged
Qubitium merged 1 commit intoNov 12, 2026
Merged
Conversation
All but one test in this file fail on main. Two changes since the file was last touched (ModelCloud#3572) moved the ground it stands on. The mocked processor auto-creates attributes, so the capture-frontier restore hook added in ModelCloud#3600 looks callable and returns a truthy mock, which makes `_run_single_subset_pass` skip the forward pass every assertion is about. A real processor without that hook returns None, so the fixture now says so explicitly. ModelCloud#3600 also added a causal replay pass: with `execution_config.fwd_replay_after_process` set, each chunk runs one capture forward and one replay forward, so `_run_forward_batches` is called twice per chunk instead of once. The expectations were doubled and the comments now say why, instead of just carrying a different number. The flush counts are unchanged: the replay pass does not call `torch_empty_cache`. tests/test_moe_expert_batching.py 9 passed Before this change the file reported 8 failed, 1 passed on main.
Collaborator
|
Review: the fixture now disables both auto-created capture restore hooks on |
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.
Summary
Eight of the nine tests in
tests/test_moe_expert_batching.pyfail on main. Two changes since the file was last touched (#3572) moved the ground it stands on.1. The mocked processor now satisfies a hook that skips the forward pass.
_run_single_subset_passasks the processor whether a captured forward frontier can be restored:A
MagicMock()processor auto-creates that attribute, socallable(...)is true and the mock's return value is truthy - the forward pass every assertion is about is skipped. A real processor without the hook returnsNone. The fixture now says so explicitly for both restore hooks added in #3600.2. #3600 added a causal replay pass.
With
execution_config.fwd_replay_after_processset (as it is in this fixture'ssetUp), each chunk runs one capture forward and one replay forward, so_run_forward_batchesis called twice per chunk instead of once.The expectations were doubled and the comments explain why, rather than carrying a different number. The flush counts are unchanged: the replay pass does not call
torch_empty_cache.Result
Nothing in the product code changes; this only restores the coverage that #3600 silently turned off.
Not covered
tests/test_subset_plan.pyandtests/test_stage_modules.pydump core on this machine, before and after this change (verified by stashing it). That looks environmental and is not addressed here.