Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/provider-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ jobs:
# shards share one lane with a count of 2: the two Cluster Focused Checks
# shards, Cluster Runtime Tests shards 2 and 3 (test-cluster-2) and shards
# 4 and 5 (test-cluster-3). A lane asks for a job only when the job runs.
# Cluster GPU Tests shards 1 and 3 have a lane each. Shard 2 has none: it
# uses 42 GiB, more than any signed size, so it runs on
# blacksmith-12vcpu-macos-27 without asking.
#
# Sizes (<vCPUs>x<GiB>) are sent only while DARKBLOOM_JOB_SHAPES is `on`
# (darkbloom-route.yml). A job asks for the smallest signed size (4x16,
Expand Down Expand Up @@ -185,4 +182,5 @@ jobs:
build-provider macos_arm64 blacksmith-12vcpu-macos-27 ${{ (needs.components.outputs.provider == 'true' || (github.event_name == 'push' && needs.tested.outputs.skip == 'true' && needs.components.outputs.changed_provider == 'true')) && 1 || 0 }} 12x32
cluster-release-checks macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.cluster == 'true' && 1 || 0 }} 8x16
test-cluster-gpu-1 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.cluster == 'true' && 1 || 0 }} 4x24
test-cluster-gpu-2 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.cluster == 'true' && 1 || 0 }} 4x24
test-cluster-gpu-3 macos_arm64 blacksmith-12vcpu-macos-27 ${{ needs.components.outputs.cluster == 'true' && 1 || 0 }} 4x24
6 changes: 2 additions & 4 deletions .github/workflows/provider-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,11 @@ jobs:
# ones and the benchmarks (scripts/cluster-test-plan.py). They run and
# report whenever the cluster jobs run; a failure does not fail the
# workflow. Shards 1 and 3 each run one half of the real-geometry rows
# check and read a lane of their own (provider-plan.yml). Shard 2 uses
# 42 GiB, more than any signed Darkbloom size, so it runs on Blacksmith
# without asking the route.
# check. Each shard reads a lane of its own (provider-plan.yml).
name: Cluster GPU Tests (non-blocking, shard ${{ matrix.shard }})
needs: build-cluster
if: ${{ inputs.cluster == 'true' }}
runs-on: ${{ matrix.shard == 2 && 'blacksmith-12vcpu-macos-27' || fromJSON(inputs.routes)[format('test-cluster-gpu-{0}', matrix.shard)] }}
runs-on: ${{ fromJSON(inputs.routes)[format('test-cluster-gpu-{0}', matrix.shard)] }}
timeout-minutes: 60
strategy:
fail-fast: false
Expand Down
8 changes: 4 additions & 4 deletions changelog.d/ci-gpu-shards-darkbloom.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### CI: Cluster GPU Tests shards 1 and 3 ask Darkbloom first
### CI: every Cluster GPU Tests shard asks Darkbloom first

- Cluster GPU Tests shards 1 and 3 now ask the Darkbloom plane for a sandbox, each on a lane of its own (`test-cluster-gpu-1`, `test-cluster-gpu-3`; 4x24 while sizes are on: 14.33 and 14.72 GiB used in run 42737118357). Each falls back alone to `blacksmith-12vcpu-macos-27` when the plane does not grant it.
- Shard 2 still runs on `blacksmith-12vcpu-macos-27` without asking: it uses 42 GiB, which no signed size holds.
- A full CI run now asks for 14 macOS jobs instead of 12. The two GPU lanes come last in the lane table, so the `DARKBLOOM_MACOS_LANES` cap drops them first.
- Each of the 3 Cluster GPU Tests shards now asks the Darkbloom plane for a sandbox on a lane of its own (`test-cluster-gpu-1`, `test-cluster-gpu-2`, `test-cluster-gpu-3`; 4x24 while sizes are on). Each falls back alone to `blacksmith-12vcpu-macos-27` when the plane does not grant it. A lane routes only when the approval's `lanes` names it; on 2026-11-10 it named `test-cluster-gpu-1` and `test-cluster-gpu-2` but not `test-cluster-gpu-3`.
- Shard 2 no longer needs 42 GiB. The paged verify/prefill attention bench (`paged-verify-bench`) bounds MLX's freed-buffer cache to 1 GiB, as a ready Qwen tensor-parallel rank does. Before, the cache kept every prompt chunk's attention temporaries, and the bench's process reached 34.26 GiB. The bench also prints its peak active memory and cache size for each run.
- A full CI run now asks for 15 macOS jobs instead of 14. The GPU lanes come last in the lane table, so the `DARKBLOOM_MACOS_LANES` cap drops them first.
56 changes: 33 additions & 23 deletions docs/developer/build.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build The Provider And Landing

> Last updated: 2026-11-08
> Last updated: 2026-11-10

Build the provider, its source-matched native resources, and the independent
landing site from this repository. Backend, sidecar, console and admin builds
Expand Down Expand Up @@ -378,17 +378,16 @@ again; the next failure opens a new one.

A full run takes about 13 minutes and 110 macOS job-minutes: about 31 for the
build jobs, Cluster Release Build Checks and Cluster GPU Tests, and about 79
for the 9 blocking test shards. Every macOS job but Cluster GPU Tests shard 2
is routed, and falls back to Blacksmith when the plane grants no Mac.
for the 9 blocking test shards. Every macOS job is routed, and falls back to
Blacksmith when the plane grants no Mac.

### Build Once

Each lane builds its debug test products once, on a large runner, and its
test jobs run them with `swift test --skip-build`. No test job compiles the
provider or the cluster packages. Every job below reads its runner from the
route ([CI Runner Routing](#ci-runner-routing)), except shard 2 of
`test-cluster-gpu`. Its fallback is `blacksmith-12vcpu-macos-27`. While job sizes are off, every job
asks without a size ([Job sizes](#job-sizes)).
route ([CI Runner Routing](#ci-runner-routing)). While job sizes are off,
every job asks without a size ([Job sizes](#job-sizes)).

| Job | Runner | Needs | Does |
|---|---|---|---|
Expand All @@ -397,7 +396,7 @@ asks without a size ([Job sizes](#job-sizes)).
| `cluster-release-checks` (Cluster Release Build Checks) | routed | - | Compiles the release build of the worker capability and prefill schedule checks, and runs them |
| `test-provider`, shards 1 and 2 | routed | `build-provider` | The provider selections, Prompt Parity, the native gates, the audit and coverage |
| `test-cluster`, shards 1 to 5 | routed | `build-cluster` | The blocking cluster selections |
| `test-cluster-gpu`, shards 1 to 3 | shards 1 and 3 routed; shard 2 `blacksmith-12vcpu-macos-27`, not routed | `build-cluster` | The non-blocking cluster GPU selections |
| `test-cluster-gpu`, shards 1 to 3 | routed, a lane per shard | `build-cluster` | The non-blocking cluster GPU selections |
| `test-cluster-focused`, shards 1 and 2 | routed | - | The focused runner scripts and the pairing, diagnostics and placement flow runners (shard 1); the stage metadata, provisioning, onboarding and console runners (shard 2) |

The cluster lane builds in a job of its own, so the cluster tests start as soon
Expand Down Expand Up @@ -490,7 +489,7 @@ shard the lane its matrix entry names, `matrix.lane`.

| Workflow | Routed jobs | Fallback |
|---|---|---|
| `provider-tests.yml` (lanes requested by `provider-plan.yml`) | `test-provider` (lanes `test-provider-1` and `test-provider-2`, one per shard), `test-cluster` (lanes `test-cluster-1` for shard 1, `test-cluster-2` for shards 2 and 3, and `test-cluster-3` for shards 4 and 5), `test-cluster-focused` (one lane, `test-cluster-focused`, requested for both shards), `build-cluster`, `build-provider`, `cluster-release-checks`, `test-cluster-gpu` (lanes `test-cluster-gpu-1` and `test-cluster-gpu-3`, one per shard; shard 2 is not routed) | `blacksmith-12vcpu-macos-27` |
| `provider-tests.yml` (lanes requested by `provider-plan.yml`) | `test-provider` (lanes `test-provider-1` and `test-provider-2`, one per shard), `test-cluster` (lanes `test-cluster-1` for shard 1, `test-cluster-2` for shards 2 and 3, and `test-cluster-3` for shards 4 and 5), `test-cluster-focused` (one lane, `test-cluster-focused`, requested for both shards), `build-cluster`, `build-provider`, `cluster-release-checks`, `test-cluster-gpu` (lanes `test-cluster-gpu-1`, `test-cluster-gpu-2` and `test-cluster-gpu-3`, one per shard) | `blacksmith-12vcpu-macos-27` |
| `ci-master.yml` (lanes requested by `provider-plan.yml`) | `release-integrity`, `docs` | `blacksmith-4vcpu-ubuntu-2404` |
| `docs-impact.yml` | `commit-signatures`, `docs-impact` | `blacksmith-4vcpu-ubuntu-2404` |
| `landing.yml`, `desktop.yml`, `nightly-linear-package.yml` | `check`, `frontend`, `test` | `blacksmith-4vcpu-ubuntu-2404` |
Expand Down Expand Up @@ -559,11 +558,10 @@ keep their fallback, so a push saves caches on Darkbloom only from an admitted
branch and only in routed lanes ([CI Caching](#ci-caching)).
Release, signing, publication, model registration, review automation and
`master` or dispatched cache warming keep literal Blacksmith labels. In CI,
every macOS job but Cluster GPU Tests shard 2 reads its lane of the plan's one
route request (the plane routes a run attempt once); the plan's own bookkeeping
(the tree lookup, the component choice), the CI plan checks and the
`Provider Tests` gate run on `ubuntu-24.04`. Cluster GPU Tests shard 2 runs on
`blacksmith-12vcpu-macos-27` and is not routed ([Job sizes](#job-sizes)). A lane without a size gets the
every macOS job reads its lane of the plan's one route request (the plane
routes a run attempt once); the plan's own bookkeeping (the tree lookup, the
component choice), the CI plan checks and the `Provider Tests` gate run on
`ubuntu-24.04`. A lane without a size gets the
approval's pinned image size for its profile (one for macOS, one for Linux).
The macOS one measured 12 vCPU / 32 GiB on 2026-11-05 (run 42105290034,
attempt 1), the class of the Blacksmith 12-vCPU fallback; it is not a fixed
Expand All @@ -588,7 +586,7 @@ repository variable `DARKBLOOM_JOB_SHAPES` is exactly `on`. While it is off:
without sizes.
- Every lane asks without a size and gets the approval's pinned macOS size
([CI Runner Routing](#ci-runner-routing)): the 9 blocking test jobs, the
build jobs and Cluster Release Build Checks.
build jobs, Cluster Release Build Checks and the 3 GPU shards.
- Risk: the build jobs need a large Mac. If the approval pins a smaller macOS
size, they get that smaller size, and a cold build takes longer.
- A lane marked `required` keeps its fallback without asking. It takes no
Expand All @@ -597,7 +595,8 @@ repository variable `DARKBLOOM_JOB_SHAPES` is exactly `on`. While it is off:

The lane table in the `route` job of `provider-plan.yml` is the one place that
names each job's lane and size. The lanes are in cap order: the critical-path
test shards first, then the build jobs and Cluster Release Build Checks.
test shards first, then the build jobs and Cluster Release Build Checks, then
the GPU shards.

Each size is the smallest signed size (4x16, 4x24, 8x16, 12x32) that holds the
job's used memory times 1.25, on which the job takes at most 5% longer than on
Expand All @@ -624,14 +623,21 @@ and memory pressure stayed normal.
| `build-provider` | 1 | 12x32 | 17.50; 8x24 is not signed, and a cold build takes 20% longer on 8 vCPUs | asks without a size |
| `cluster-release-checks` | 1 | 8x16 | 9.65 with a reused build; a cold release compile (run 42041608780: 11.33 GiB, 11.4 busy vCPUs at p95 of 12) takes 26% longer on 4 vCPUs and 5.5% on 8 | asks without a size |
| `test-cluster-gpu-1` (GPU shard 1) | 1 | 4x24 | 14.33 in run 42737118357, on Blacksmith with 48 GiB; at most 2.6 busy vCPUs | asks without a size |
| `test-cluster-gpu-2` (GPU shard 2) | 1 | 4x24 | 17.42 in run 42924487818, on Darkbloom with 32 GiB, during `glm53-depth-invariance-widths` (one process of 10.23); 40.99 before the bench's cache bound (run 42917194201) | asks without a size |
| `test-cluster-gpu-3` (GPU shard 3) | 1 | 4x24 | 14.72 in run 42737118357, on Blacksmith with 48 GiB | asks without a size |

A run that tests every component asks for 14 macOS jobs, while sizes are on
or off. Cluster GPU Tests shard 2 is not routed: it runs on
`blacksmith-12vcpu-macos-27` (12 vCPU, 48 GiB). It uses 41.99 GiB (41.63 in
run 42737118357, 34.26 of it in the one process of `paged-verify-bench`), which
no signed size holds. Shards 1 and 3, which each run half of the real-geometry
rows check, have a lane each and fall back alone.
A run that tests every component asks for 15 macOS jobs, while sizes are on
or off. Each GPU shard has a lane of its own and falls back alone; shards 1
and 3 each run half of the real-geometry rows check. GPU shard 2 used 40.99
GiB in run 42917194201, 34.26 GiB of it in the one process of
`paged-verify-bench`. That bench attends random K/V of 4 layers at 30,720
tokens (0.5 GiB of KV), but MLX's freed-buffer cache kept every prompt chunk's
attention temporaries: they grow with the history, so the cache reuses none
of them, and its default limit is MLX's memory limit. The bench now bounds
the cache as a ready Qwen tensor-parallel rank does (1 GiB,
`QwenTensorParallelLaunch.freedBufferCacheBytes`). In run 42924487818 its
process peaked at 3.75 GiB (2.78 GiB active, at most 1.05 GiB cached) and the
shard at 17.42 GiB used.

A lane sent with a size uses a grant only when the grant's labels are its
profile's labels with the last one qualified by the size, such as
Expand All @@ -641,8 +647,12 @@ fallback. The plane names its reason, for example `shape_not_signed` (no signed
image of that size), `unavailable` (the plane cannot read its image catalog),
`unsupported_runner_class` (the size has no price), `image_not_available` (the
image is not staged) or `lane_not_enabled` (the approval does not name the
lane). For each lane, the route job's log and step summary show the size
asked, the runner, and the decision with its reason.
lane). A new lane routes only after the operator adds it to the approval's
`lanes`; until then it keeps its fallback. On 2026-11-10 the approval named
`test-cluster-gpu-1` and `test-cluster-gpu-2` but not `test-cluster-gpu-3`
(run 42924487818).
For each lane, the route job's log and step summary show the size asked, the
runner, and the decision with its reason.

## CI Caching

Expand Down
11 changes: 5 additions & 6 deletions docs/developer/test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test Provider And Native Contracts

> Last updated: 2026-11-09
> Last updated: 2026-11-10

Run isolated Swift, native-resource, public-fixture and landing tests here.
Backend integration and cross-implementation qualification are platform-owned.
Expand Down Expand Up @@ -1472,9 +1472,8 @@ shared build recipe. The
selected. A provider-only change runs 3 Macs (the provider build and the 2
provider shards). A cluster change adds 12 Macs (the cluster build, the release
build checks, 5 runtime shards, 2 focused shards and 3 GPU shards). Every
Mac job but GPU shard 2 is routed; GPU shard 2 runs on Blacksmith
([job sizes](build.md#job-sizes)). A change whose tree a successful run of the
same workflow already tested runs no test job at all
Mac job is routed ([job sizes](build.md#job-sizes)). A change whose tree a
successful run of the same workflow already tested runs no test job at all
(`scripts/ci-tested-tree.py`).

CI runs the runtime test target (`DarkbloomClusterRuntimeTests`) on the
Expand Down Expand Up @@ -2101,8 +2100,8 @@ only the labels of that size. It also covers bad sizes, the macOS cap order and
a `required` lane, which keeps its fallback without asking while sizes are off.
It also pins each routed job's lanes (one per provider or cluster shard,
matching the job's matrix), size, fallback, timeout and read-only permissions,
and keeps release workflows and Cluster GPU Tests shard 2 on literal Blacksmith
runners. No check contacts the real plane.
and keeps release workflows on literal Blacksmith runners. No check contacts
the real plane.

Docs-impact tests retain provider, protocol, privacy, native capacity, cache,
release/model publication and fixture mappings. Historical links need exact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,27 @@ struct CBv2PagedVerifyBench {
}

@Test(.enabled(if: enabled)) func verifyAndPrefillAttention() throws {
// The freed-buffer cache of a ready Qwen tensor-parallel rank
// (`QwenTensorParallelLaunch.freedBufferCacheBytes`). MLX's default
// cache limit is its memory limit, and it reuses a freed buffer only
// for a request of about the same size. A prompt chunk's attention
// temporaries grow with the history, so the cache kept every one of
// them: the process reached 34.26 GiB on a 48 GiB runner (run
// 42917194201), almost all of it freed buffers.
let previousCacheLimit = Memory.cacheLimit
Memory.cacheLimit = QwenTensorParallelLaunch.freedBufferCacheBytes(
allocatorHeadroomBytes: QwenDenseStageLoadPolicy.allocatorHeadroomBytes)
defer { Memory.cacheLimit = previousCacheLimit; Memory.clearCache() }
let gib = Double(1 << 30)
for paged in [true, false, true, false] {
Memory.peakMemory = 0
let r = try Self.run(paged: paged)
print("darkbloom-paged-bench \(paged ? "paged" : "contiguous") ctx=\(Self.context) layers=\(Self.layers)"
+ " width=\(Self.width) prefill_s=\(String(format: "%.3f", r.prefill))"
+ " window_ms=\(String(format: "%.3f", r.window * 1000))"
+ " mq=\(ProcessInfo.processInfo.environment["DARKBLOOM_PAGED_MTP_MULTI_QUERY"] ?? "default")")
+ " mq=\(ProcessInfo.processInfo.environment["DARKBLOOM_PAGED_MTP_MULTI_QUERY"] ?? "default")"
+ " peak_active_gib=\(String(format: "%.2f", Double(Memory.peakMemory) / gib))"
+ " cache_gib=\(String(format: "%.2f", Double(Memory.cacheMemory) / gib))")
}
}
}
11 changes: 4 additions & 7 deletions scripts/test-cluster-test-plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,13 @@ def test_jobs_run_every_shard_of_their_lane(self):
for _, route_lane in entries:
self.assertIn(f" {route_lane} macos_arm64 ", self.jobs["route"])
else:
# GPU shards 1 and 3 each read a lane of their own. Shard 2
# needs more memory than any signed Darkbloom size: it has
# no lane and keeps Blacksmith.
# Each GPU shard reads a lane of its own.
matrix = re.search(r"(?m)^ shard: \[([0-9, ]+)\]$", job).group(1)
self.assertEqual([int(shard) for shard in matrix.split(",")], plan.shards(lane))
self.assertIn(f" runs-on: ${{{{ matrix.shard == 2 && '{workflow.BLACKSMITH_MAC}' || "
f"fromJSON(inputs.routes)[format('{job_id}-{{0}}', matrix.shard)] }}}}\n", job)
for shard in (1, 3):
routed = f"fromJSON(inputs.routes)[format('{job_id}-{{0}}', matrix.shard)]"
self.assertIn(f" runs-on: ${{{{ {routed} }}}}\n", job)
for shard in plan.shards(lane):
self.assertIn(f" {job_id}-{shard} macos_arm64 ", self.jobs["route"])
self.assertNotIn(f" {job_id}-2 ", self.jobs["route"])
steps = {workflow.field(step, "name", indent=6): step for step in workflow.step_blocks(job)}
products = steps["Download cluster test products"]
self.assertEqual(workflow.field(products, "uses"), workflow.PRODUCTS_ACTION)
Expand Down
Loading
Loading