Skip to content

Set TORCHINDUCTOR_COMPILE_THREADS=1 in modal CI sandbox to stop 300s test timeouts - #8914

Merged
tohtana merged 1 commit into
deepspeedai:masterfrom
delock:ci/inductor-serial-compile
Oct 26, 2026
Merged

tohtana merged 1 commit into
deepspeedai:masterfrom
delock:ci/inductor-serial-compile

Conversation

@delock

@delock delock commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Description

Since #8902 (Python 3.10 -> 3.12 sandbox bump) landed on 10-25, modal-torch-latest merge-queue runs hit repeated DS_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 inside tests/unit/v1/compile/test_compile_zero.py at 95%+ progress.

Root cause: torch 2.10.0's Inductor SubprocPool.shutdown() (torch/_inductor/compile_worker/subproc_pool.py) waits up to process.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. Each test_compile_zero case 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=1 in the Modal sandbox env: serial compile never creates the worker pool, so the shutdown race cannot occur. The variable should be removed when MODAL_TORCH_PRESET moves to >= 2.13.

Why this does not duplicate an existing PR or issue

Checked open PRs for TORCHINDUCTOR_COMPILE_THREADS, inductor timeout, and 300 seconds timeout in 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:

Env Experiment Result
py3.12.15 + torch 2.10.0+cpu AsyncCompile.process_pool() + in-flight task, then shutdown_compile_workers() TimeoutExpired after exactly 300.0s (wall 305.8–309.0s) — matches CI's ~310s/case signature
py3.10.22 + torch 2.10.0+cpu same identical 300.0s hang — rules out Python version as the switch
py3.12.15 + torch 2.10.0+cpu, TORCHINDUCTOR_COMPILE_THREADS=1 process_pool() unreachable (assert threads>1); cold torch.compile shutdown shutdown 0.00s; compile 16.7–19.7s vs 17.2–24.5s with default threads (no regression)
py3.12.15 + torch 2.13.0+cpu same race as row 1 shutdown returned in 2.5s (confirms upstream fix; long-term option)

Hardware: 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_zero cases dropping from ~310s to ~20s in --durations output and no further timeout: 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.

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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T10:02:46.032967Z aefecb1 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@delock

delock commented Oct 26, 2026

Copy link
Copy Markdown
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.

@pengdurice
pengdurice added this pull request to the merge queue Oct 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 26, 2026
@tohtana
tohtana merged commit 1fcac82 into deepspeedai:master Oct 26, 2026
15 checks passed
@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added the skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. label Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants