Skip to content

CI: every Darkbloom macOS job names a signed VM size - #70

Merged
davidtai merged 3 commits into
mainfrom
ci/macos-explicit-size
Nov 20, 2026
Merged

davidtai merged 3 commits into
mainfrom
ci/macos-explicit-size

Conversation

@davidtai

@davidtai davidtai commented Nov 20, 2026 •

Copy link
Copy Markdown

Summary

David, 2026-11-20: shrink the macOS CI VMs of the three MLX repositories. Every Darkbloom macOS job here now names its VM size, so none relies on the approval's pinned 12x32.

Job (fork-tests.yml) Old New 12 vCPUs (runs 43368507444 to 43569480732) Hosted 3 vCPUs, 7 GiB
build-wheel pinned (12x32) 4x16 153 to 354 s 575 s (run 43120201853)
build-cpp pinned 4x16 277 to 620 s (p90 about 480 s); the slow runs spend up to 190 s in the build cache action 940 s, compile 632 s (run 43120201853)
python-gpu (2 shards) pinned 4x24 171 to 541 s 297 to 635 s
python-cpu (3 shards) pinned 12x32 152 to 444 s 279 to 546 s
metal-build-and-test pinned 4x16 34 to 190 s 20 to 23 s

The first head gave build-cpp 8x16 and the Python shards 4x16. The sampler's data moved them (see Validation).

test_init_reduce_large_output skips where its 4 GiB output does not fit: on the GPU it needs max_buffer_length >= 4 GiB, on the CPU memory_size >= 16 GiB. The GPU shards (a Metal buffer can have half of the VM's memory) and the CPU shards give both, so the test still runs: all three runs ran it on the GPU and on the CPU (... ok).

The new Python files follow this repository's ruff rules (pre-commit ruff-check and ruff-format), so the sampler copy has wrapped lines; the logic is unchanged. fork.yaml lists the three new scripts. Check Lint runs the two new tests after pre-commit.

How a job names its size

A Darkbloom macOS job that names no size gets the size that the approval pins, today 12 vCPUs and 32 GiB. A job outside a route asks for a size with its runner label (darkbloom-sandbox docs/developer/ci-routes.md, "Asking for a VM size"): [self-hosted, macOS, ARM64, darkbloom-macos-arm64-4x16]. Admission then runs it on the pinned image's signed sibling of that size. The size label needs no DARKBLOOM_JOB_SHAPES; that variable gates only the route workflow's lane sizes. This repository's route workflow has one Linux lane (codeql), and the route refuses a size on a Linux lane.

This mirrors Layr-Labs/d-inference ml-explore#2409: every macOS lane names a signed size, and a test fails on any that does not.

The check

.github/scripts/test-runner-sizes.py reads every workflow. It fails when:

  • a job's runs-on asks for darkbloom-macos-arm64 without a size, or with a size other than 4x16, 4x24, 8x16 and 12x32;
  • a route lane on Linux names a size, or one on macOS names none;
  • a job's size differs from the table in the script, or the table names a job that no workflow has;
  • .github/actionlint.yaml does not list a used sized label, or still lists the bare label.

Its third test feeds it an unsized job, an unsigned size, a block-form runs-on and two bad lanes, and requires a refusal for each.

Measuring

There was no memory data: no job of this repository logged a memory peak. Every macOS job now runs .github/scripts/ci-resource-sampler.py, the report-only sampler of d-inference (scripts/ci-resource-sampler.py, with its offline test test-ci-resource-sampler.py). It starts after the checkout and its last step ("Report the resource samples", always()) prints the peak of used memory (app + wired + compressed), swap, the three largest processes, the busy vCPUs, and the time scaled to 4 and 8 vCPUs. It never fails a job. This PR's CI run is the first run at the new sizes; the measured peaks are below.

No step, test, timeout or check name changes.

Validation

Three runs, each measured by the sampler. A job's peak is the larger of used memory (app + wired + compressed) and the sum of its processes' lifetime peak footprints, because used memory counts compressed pages at their compressed size. The idle VM uses about 6 GiB. The rule: the smallest signed size with 30% headroom over the peak (16 GiB holds 12.3, 24 GiB 18.5, 32 GiB 24.6).

Job Run 44750715218 (f2cf828) Run 44754340762 (ddc9c04) Run 44760388078 (4e4814c, final)
build-wheel 4x16: 230 s, 10.65 GiB 4x16: 242 s, 10.50 GiB 4x16: 245 s, 10.63 GiB
build-cpp 8x16: 302 s, 10.42 GiB; the sampler scales it to about 335 s on 4 vCPUs 4x16: 374 s, 10.56 GiB 4x16: 378 s, 10.61 GiB
python-gpu 4x16: 214 and 288 s; shard 1 used 11.65 GiB with 4.1 GiB compressed, footprints 13.21 GiB (over 12.3) 4x16: 182 and 307 s; shard 1 footprints 13.03 GiB 4x24: 176 and 428 s; 13.12 and 17.41 GiB
python-cpu 4x16: 190 to 258 s; 12.37 to 13.20 GiB used with 5.2 to 7.1 GiB compressed, memory pressure at warning, footprints up to 18.12 GiB 4x24: 163 to 273 s; up to 19.26 GiB used (over 18.5) 12x32: 165 to 191 s; 16.73 to 20.93 GiB
metal-build-and-test 4x16: 36 s, 6.01 GiB 4x16: 38 s, 6.07 GiB 4x16: 94 s, 6.92 GiB

Every job of the final head is under 10 minutes and within its headroom. No job swapped. python-cpu genuinely needs 12x32: its three to four parallel test processes use about 18 to 21 GiB, more than 24 GiB / 1.3. So the approval must keep 12x32 signed for this repository; python-gpu needs 4x24.

🤖 Generated with Claude Code

davidtai and others added 3 commits November 20, 2026 08:07
A macOS job without a size gets the approval's pinned size (12 vCPUs,
32 GiB). Each Fork Tests job now names its size in its runner label:
build-cpp 8x16 (it took 940 s on the hosted 3-vCPU Mac, so 4 vCPUs would
pass 10 minutes), and build-wheel, the Python shards and
metal-build-and-test 4x16. test_init_reduce_large_output still runs on
4x16: a Metal buffer can have 8 GiB and memory_size is 16 GiB.

Every macOS job runs the report-only resource sampler of
Layr-Labs/d-inference (wrapped to this repository's ruff rules) so that
its log gives the measured memory peak and busy vCPUs.
test-runner-sizes.py, run in Check Lint, fails when a macOS job names no
signed size or a size other than its table gives. FORKDIFF.md (Job
sizes) gives the data; fork.yaml lists the new scripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first sampled run (44750715218) measured every macOS job:
- python-cpu peaked at 12.37 to 13.20 GiB used on 4x16, with up to
  7.1 GiB compressed and memory pressure at warning once. 16 GiB is less
  than 1.3 times that, so the CPU shards ask for 4x24.
- build-cpp took 302 s on 8x16 and peaked at 10.42 GiB; the sampler
  scales its CPU time to about 335 s on 4 vCPUs, so it asks for 4x16.

FORKDIFF.md (Job sizes) records the measured peaks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Used memory counts compressed pages at their compressed size, so on
4x16 it hid part of the Python shards' demand. Run 44754340762 measured
the CPU shards on 4x24 at 19.26 GiB used (17.89 GiB of process
footprints), and python-gpu shard 1's processes reach 13.21 GiB on
4x16. With 30% headroom the CPU shards need more than 24 GiB, so they
ask for 12x32, the next signed size with more memory; the GPU shards ask
for 4x24. A job's peak is now the larger of used memory and the
footprint sum (FORKDIFF.md, Job sizes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davidtai
davidtai merged commit e0db9d7 into main Nov 20, 2026
22 checks passed
@davidtai
davidtai deleted the ci/macos-explicit-size branch November 20, 2026 15:32
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