Repository navigation
Set TORCHINDUCTOR_COMPILE_THREADS=1 in modal CI sandbox to stop 300s test timeouts - #8914
Merged
Merged
Conversation
torch <=2.12 SubprocPool.shutdown() blocks up to 300s when compile workers are still in flight at process exit (pytorch/pytorch#162199, fixed by pytorch/pytorch#184038 first released in 2.13). Every tests/unit/v1/compile/test_compile_zero.py case spawns fresh rank processes, so their exit hits this race and each case costs ~310s instead of ~20s, tripping the CI 'no test progress for 300 seconds' watchdog and failing the merge queue since deepspeedai#8902. Serial compile skips the worker pool entirely; unit-test graphs are tiny so parallel compile gains nothing (measured: same or slightly faster cold compile with threads=1). Remove this when MODAL_TORCH_PRESET moves to >=2.13. Signed-off-by: Ma, Guokai <[email protected]>
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. |
Collaborator
Author
|
This PR is the WA for modal timeout. We didn't choose pytorch 2.13 because the later has more profound impact, should be considered as a seperate task. |
sfc-gh-truwase
approved these changes
Oct 26, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 26, 2026
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.
Description
Since #8902 (Python 3.10 -> 3.12 sandbox bump) landed on 10-25,
modal-torch-latestmerge-queue runs hit repeatedDS_CI_FAILURE_CLASS=timeout: no test progress for 300 seconds(9 occurrences 10-25..10-26 across pr-8478/8647/8642/8800/8882 and the nightly master run). In every case the watchdog fires while workers are insidetests/unit/v1/compile/test_compile_zero.pyat 95%+ progress.Root cause: torch 2.10.0's Inductor
SubprocPool.shutdown()(torch/_inductor/compile_worker/subproc_pool.py) waits up toprocess.wait(300)for its nested compile-worker pool when tasks are still in flight at process exit — pytorch/pytorch#162199, fixed by pytorch/pytorch#184038, first released in torch 2.13. Eachtest_compile_zerocase spawns fresh rank processes (DistributedTest, world_size=2, non_daemonic_procs=True), so nearly every case pays a fixed ~300s at exit (~310s total per case vs ~20-90s before the sandbox bump). When these cases are the last ones running, the whole-suite 300s no-output watchdog kills pytest.This PR sets
TORCHINDUCTOR_COMPILE_THREADS=1in the Modal sandbox env: serial compile never creates the worker pool, so the shutdown race cannot occur. The variable should be removed whenMODAL_TORCH_PRESETmoves to >= 2.13.Why this does not duplicate an existing PR or issue
Checked open PRs for
TORCHINDUCTOR_COMPILE_THREADS,inductor timeout, and300 seconds timeoutin PR bodies — no existing PR addresses this.Test commands run and results (AI-assisted investigation; local reproduction)
Local CPU reproduction (no GPU available locally), torch installed from the cpu wheel index:
AsyncCompile.process_pool()+ in-flight task, thenshutdown_compile_workers()TimeoutExpiredafter exactly 300.0s (wall 305.8–309.0s) — matches CI's ~310s/case signatureTORCHINDUCTOR_COMPILE_THREADS=1process_pool()unreachable (assert threads>1); coldtorch.compileshutdownHardware: local CPU-only workstation (8 cores). CI-side confirmation is implicit in the modal-torch-latest run for this PR: expected effect is
test_compile_zerocases dropping from ~310s to ~20s in--durationsoutput and no furthertimeout: no test progress for 300 seconds.Compatibility matrix
CI-infrastructure-only change (sandbox env var for
modal-torch-latest); no DeepSpeed runtime code, numerics, ZeRO/offload/precision paths, or user-facing behavior are touched.AI assistance disclosure
The log analysis, root-cause investigation, and local reproduction were AI-assisted (agent session); the change was reviewed and approved for submission by the human author of the signoff.