Skip to content

Backend CI: run the multi-rank gloo suites in their own Repo tests shard - #15291

Merged
danielhanchen merged 2 commits into
mainfrom
ci-repo-cpu-gloo-shard
Oct 25, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
ci-repo-cpu-gloo-shard

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Repo tests (CPU, rest) has been running out of time. Its pytest step is capped at timeout --signal=INT --kill-after=60 2100.

Cause

The shard is the catch-all. It has picked up the multi-rank gloo suites added recently: tensor parallel, pipeline parallel, context parallel, float8 and fp8 under FSDP2. Each spawns 2 to 4 ranks per test. This is the same thing that happened with the FSDP2 gloo files, which is why they already have their own fsdp2 shard.

Measured locally at this job's shape (-n 4 --dist loadgroup, pinned to 4 cores, one selection per core set):

selection wall
the 7 non-FSDP2 gloo files 578 s
the catch-all without them 680 s
the existing fsdp2 shard 648 s

So the gloo files are about 46% of the catch-all. Folding them into fsdp2 would push that shard to the cap instead; its jobs already run 17.5 to 29 minutes on CI.

Fix

A gloo shard takes every *gloo* file except test_fs*, which are fsdp2's. It is written as two globs, tests/test_[!f]*gloo*.py and tests/test_f[!s]*gloo*.py, because an explicit file root cannot be filtered with --ignore, as the matrix notes already say. rest ignores the same two globs. A new multi-rank gloo file lands in the new shard without a workflow edit.

This adds a check, Repo tests (CPU, gloo). No existing check name changes.

Verification

  • tests/studio/test_backend_ci_parallel_isolation.py pins the number of parallel pytest runs; it now expects eight, five of them repo-cpu-tests shards (it failed at seven before that update). It and tests/test_ci_repo_cpu_shards.py together: 54 passed.
  • tests/test_ci_repo_cpu_shards.py on its own: 13 passed. It fails both ways if the split is broken: drop the new shard and its files are reported as dropped; drop the rest ignores and they are reported as run twice.
  • Collected ids at main (--collect-only with the same shell glob expansion): the old rest has 17751. The new rest (17666) plus gloo (85) is identical, with nothing in both and nothing shared with fsdp2.
  • test_gloo_spawn_cpu_guard.py matches neither glob and stays in rest. It is a guard, not a multi-rank suite.

Not proven here

Runner timing is estimated by scaling: the catch-all is about 1258 s locally against roughly 2800 s projected on CI. That puts the new rest near 1500 s and gloo near 1270 s, both under 2100 s. This PR's own run will show the real numbers.

Repo tests (CPU, rest) has been hitting its 2100 s pytest cap: on most runs
today pytest got SIGINT and stopped at 74 to 98%, so the tail of the shard
never ran, and with the other reds now fixed the shard fails on the timeout
alone (exit 124). The new tensor, pipeline and context parallel, float8 and
fp8 gloo suites spawn 2 to 4 ranks per test, as the FSDP2 ones did before they
got the fsdp2 shard: on 4 cores they are 578 s of the catch-all's 1258 s.

A gloo shard takes every *gloo* file except test_fs* (fsdp2's), written as two
globs because an explicit file root cannot be filtered by --ignore, and rest
ignores the same two globs. The collected ids are unchanged: 17751 in the old
rest = 17666 in the new rest + 85 in gloo, none shared with fsdp2.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 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-25T21:12:43.975005Z 31afa92 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 183997612f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

test_the_command_scan_sees_the_parallel_run_and_the_serial_steps pins how many
parallel pytest runs the workflow has, so that a shard added or removed is
stated rather than silently covered by fewer checks. The gloo shard makes it
eight parallel runs, five of them repo-cpu-tests shards.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 31afa92368

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 231a4aa into main Oct 25, 2026
24 of 31 checks passed
@danielhanchen
danielhanchen deleted the ci-repo-cpu-gloo-shard branch October 25, 2026 22:51
danielhanchen added a commit that referenced this pull request Oct 28, 2026
`Repo tests (CPU, fsdp2)` on #15833's staging run passed every test and
still went red:

```
364 passed, 28 skipped, 80 warnings in 2092.29s (0:34:52)
##[error]Process completed with exit code 124.
```

The shard's pytest step runs under `timeout --signal=INT --kill-after=60
2100`. pytest finished 8 s under that cap, and the cap then fired while
it was exiting.

## Cause

#15291 moved the FSDP2 gloo tests into their own shard at about ten
minutes of runner time. They have grown since, with most of a dozen
FSDP2 PRs merged today adding tests there (#15756, #15748, #15720,
#15709, #15708, #15352, ...). Over the last twenty-odd staging runs this
job took 21 to 38 minutes, so it now sits at its cap on an ordinary
runner. Nothing failed; the shard is simply too big for its timeout.

## Fix

Split the shard in two by file name, balanced on measured time. Per-test
durations on main, summed per file across all 76 files:

| shard | selection | files | tests | measured time |
|---|---|---|---|---|
| `fsdp2` | `tests/test_fsdp2_[!n]*.py tests/test_fsdp2_n[!a]*.py
tests/test_fsdp2_native_[abc]*.py` | 34 | 237 | 1156 s (45%) |
| `fsdp2-native` (new) | `tests/test_fsdp2_native_[!abc]*.py` | 42 | 276
| 1406 s (55%) |
| both together, unchanged total | `tests/test_fsdp2*.py` | 76 | 513 |
2562 s |

`fsdp2` keeps its name, so its check name is unchanged. The step timeout
and job cap are left alone, so each half gets the whole budget.

## Guards

- `tests/test_ci_repo_cpu_shards.py` already fails when a file lands in
no shard or in two. It caught my first draft, which dropped
`test_fsdp2_non_cuda_accelerate_route.py`; hence the `n[!a]` glob.
- A new check, `TestEveryGlobRootMatchesAFile`, fails if a shard glob
matches no test file. bash passes an unmatched glob through literally
and pytest then fails the whole shard on a missing path. Sabotage:
adding `tests/test_fsdp2_zz*.py` to a selection fails it with
`[('fsdp2', 'tests/test_fsdp2_zz*.py')]`.
- `tests/studio/test_backend_ci_parallel_isolation.py` pins the number
of parallel runs, now nine (six repo-root shards).

## Verification

- `tests/test_ci_repo_cpu_shards.py` and
`tests/studio/test_backend_ci_parallel_isolation.py`: 56 passed.
- With `tests/studio/test_cache_budget_discipline.py` added: everything
passes except the guard on my first draft, fixed above.
- `--collect-only` on the two selections gives 237 + 276 = 513, the same
as the old single glob.

The per-file times are from a local `-n 8` run, so the split ratio is
approximate. The first runs of the two new shards will show the actual
runner times.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant