Repository navigation
[Bugfix][CI] Give cpu_test a gloo dist_init so it cannot poison forked engines - #56490
Thangnguyenvn98 wants to merge 1 commit into
Conversation
…d engines
The dist_init fixture always creates an NCCL process group. That initializes
the CUDA driver in the pytest process, but leaves torch.cuda.is_initialized()
False. _maybe_force_spawn() gates on that flag, so it keeps the default fork
start method, and the next test to launch an EngineCore subprocess without
first initializing CUDA in the parent dies with:
torch.AcceleratorError: CUDA error: initialization error
Tests marked cpu_test now get a gloo group and skip the accelerator teardown,
so they leave the CUDA driver untouched. Seven tests carry both cpu_test and
dist_init; all are CPU-only weight-loading/tying unit tests with no GPU
collectives, so gloo at world_size=1 is equivalent for them.
Unsharded runs mask this: engine tests using hf_runner run first, initialize
CUDA in the parent, and force spawn for everything after. It surfaces once the
suite is sharded and a shard puts the cpu_test ahead of its first engine test.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EtYAn47ncwudr3P9AvcdNt
Signed-off-by: Thang Nguyen <thang.nguyen@inferact.ai>
|
@khluu flagging you since #53170 introduced the Short version: It has never fired unsharded — 30-day scan of 10,669 failed jobs found 0 occurrences in the unsharded Extended Generation job (26 failures, all ordinary regressions) and exactly 1 in build 88240 shard 4/5. Unsharded runs are protected by the 20 One ask: I could not run this on GPU. The reproducer is deterministic since both tests are in one file in the failing order — |
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment Once the PR is approved or has the If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. Agent GuidelinesIMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban. 🚀 |
|
This pull request has merge conflicts that must be resolved before it can be |
What
dist_initalways creates an NCCL process group. For a test markedcpu_testthat is both unnecessary and harmful: it initializes the CUDA driverin the pytest process while leaving
torch.cuda.is_initialized()False._maybe_force_spawn()(vllm/utils/system_utils.py:126) gates on that flag, soit keeps the default
forkstart method. The next test that launches anEngineCore subprocess without first initializing CUDA in the parent then
inherits a dirty driver and dies:
This change makes
dist_inithonour the marker the test already carries: acpu_testgets agloogroup and skips the accelerator teardown, so it leavesthe CUDA driver untouched.
Why it is invisible today
Unsharded runs mask it. In nightly build 88259 the poisoner
(
test_gemma.py::test_checkpoint_lm_head_can_override_tied_config) is test #21of 43, behind 20
test_common.py::test_modelscases. Those usehf_runner,which loads a transformers model onto the GPU in the parent — CUDA becomes
initialized,
_maybe_force_spawn()switches to spawn, and every later enginelaunch is safe.
A 30-day scan of failed jobs (10,669) found zero occurrences in the
unsharded configuration:
language-models-test-extended-generation, unshardedlanguage-models-tests-hybrid-m hybrid_modelnever selects it)Once the suite is sharded it stops being masked. The poisoner and the three
test_dummy_loadercases all live intest_gemma.py, so whenever they share ashard they run effectively adjacent with no
hf_runnertest ahead of them:Both observed draws match: build 88240 (N=5) collided and failed; build 88231
(N=8) separated and passed.
Only
test_dummy_loaderis vulnerable — it usesload_format="dummy"and goesstraight to
vllm_runner, so nothing initializes CUDA in the parent first. In88231 shard 2 the poisoner was also test #1, followed immediately by
test_granite.py::test_models, and that passed because of itshf_runner.Scope
Seven tests carry both
cpu_testanddist_init(found by AST scan). All areCPU-only weight-loading/tying unit tests with no GPU collectives, so
glooatworld_size=1is equivalent:tests/v1/attention/test_mla_backends.pyandtests/v1/kv_connector/unit/test_bidirectional_kv_transfer.pyuse both markersbut on different tests, so they are unaffected. Non-
cpu_testusers ofdist_initkeep NCCL and the full teardown — unchanged.Adds one guard test asserting the backend is
gloo.Not a duplicate
gh pr list --repo vllm-project/vllm --state open --search "dist_init","cpu_test cuda initialization"and"cudaErrorInitializationError"return noPR touching this fixture or this failure mode. Related prior art: #53170, which
introduced the
cpu_test+dist_initcombination ontest_gemma.py.Tests run
Not yet run on GPU — no CUDA available to the author's local environment.
The reproducer is one command, and both tests sit in one file in the failing
order (line 24 before line 121), so it is deterministic:
Expected: fails on
main, passes with this change. Please confirm on a GPUrunner before merge.
Model evaluation
Not applicable. Test-fixture-only change; no vLLM runtime, serving, or model
output path is touched.
AI assistance
AI assistance (Claude Code) was used to diagnose the failure from Buildkite
logs, to scan 30 days of job history, and to draft this change. The diff is
small and has been reviewed line by line by the submitter.
🤖 Generated with Claude Code