[Bug][EP][compile] non_blocking=True D2H race in input_splits under per-layer torch.compile#2951
Open
weifengpy wants to merge 1 commit intopytorch:mainfrom
Open
[Bug][EP][compile] non_blocking=True D2H race in input_splits under per-layer torch.compile#2951weifengpy wants to merge 1 commit intopytorch:mainfrom
weifengpy wants to merge 1 commit intopytorch:mainfrom
Conversation
Consolidate apply_compile_dense and apply_compile_sparse into a single apply_compile function. The only difference was capture_scalar_outputs which is harmless for dense models. Remove the _run_experts_grouped_mm separate compile boundary and EP wrapper — no longer needed after fixing the symbolic shape issue in _generate_permute_indices. Fix _generate_permute_indices to use torch.arange(seg_ids.shape[0]) instead of torch.arange(total), reusing the unbacked symint from repeat_interleave rather than creating a redundant one that produces an Eq(u1, u2) constraint inductor cannot lower. Remove the x[:total_tokens] slice in _run_experts_for_loop — padding was removed in pytorch#2774, so sum(num_tokens_per_expert) == x.shape[0] and the slice is a no-op. This also eliminates the need for torch._check guards on the unbacked symint.
1fbf4d4 to
612002d
Compare
8 tasks
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.
this is needed for per-layer compilation #2741
repro command:
NGPU=8 MODULE=deepseek_v3 CONFIG=deepseek_v3_16b ./run_train.sh --compile.enable --compile.components model,loss --parallelism.expert_parallel_degree 4 --training.steps 20error:
RuntimeError: Eq(u27 + u28 + u29 + u30, 98304)clauded guessed root cause:
raw error stack: