Repository navigation
ci: sample macOS job memory by class; bound update hash memory - #1829
Merged
Merged
Conversation
The resource sampler's "memory in use" (active + wired + compressed) mixed file cache into app memory and missed inactive anonymous pages, and its largest-RSS figure missed Metal memory. Sizes were picked from it. Sampler (report-only, never fails a job): - vm_stat classes: app (anonymous less purgeable), wired, file cache, compressed, used = app + wired + compressed; swap in use. - Per-process physical footprint from proc_pid_rusage (includes IOAccelerator memory) with lifetime peaks; the top three, their sum. - /usr/bin/footprint breakdown at new 2 GiB highs, at most twice a job. - Busy vCPUs from host CPU ticks instead of the ps %cpu averages. - Selection marks from run-provider-tests.sh and cluster-test-plan.py, so each large process and the peak name their test selection. - summary.json, and the sampled time scaled to 4 and 8 vCPUs. Provider (production change, memory only): UpdateAtomicFilesystem's sha256(file:) and treeHash(root:) read each 1 MiB chunk in its own autorelease pool, as WeightHasher does. On a Swift concurrency thread the autoreleased chunks otherwise stay resident: "Update rollback end to end" hashes the debug CLI many times and its test process held 15 GiB (provider shard 1, run 42041608780). The hashes are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Run 42105290034 showed the GPU lane's Metal buffers as app (anonymous) memory: 35 GiB app against 12 GiB wired, with a 34 GiB IOAccelerator footprint. The sampler's text, the build doc and the changelog said wired held the GPU memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The sampler parses the marks file in one place (read_marks); a row with a bad time or pid is skipped by both readers, so a torn row can no longer stop the report. The capture threshold is named captured_bytes. - run-provider-tests.sh names the exclusive GPU filter once. - UpdateAtomicFilesystem calls autoreleasepool directly, as the rest of ProviderCore does; the hashed bytes and digests are unchanged. - build.md gives the measured per-class peaks (runs 42105290034 and 42123224100) in place of the old 21.5 / 18.8 / 32.8 GiB figures, and says when a footprint capture runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#1821 sizes the macOS lanes from the sampler's "peak memory in use". That figure (active + wired + compressed pages) counts active file cache as app memory and misses inactive anonymous pages. Its largest-RSS figure misses Metal memory. This PR records the right classes, so the sizes can come from data. It also fixes the 15 GiB process in provider shard 1.
The 15 GiB process in provider shard 1 (run 42041608780)
resource-samples-test-provider-0) put the jump in RSS between 14:21:10 and 14:21:20 UTC: 0.9 GiB to 14.5 GiB. It stays until 14:23:41. A per-test timeline from the log puts it in selection 2-of-6, Swift Testing,Update rollback end to end(UpdateRollbackEndToEndTests), from offset 40.9 s to 75.7 s = 14:20:47 to 14:21:22. The timeline is serial under--no-paralleland anchored on the run's XCTest end and printed end. Selection 1 ended at 14:23:06 while the 15 GiB stayed, and the RSS fell when selection 2 ended (14:23:42).UpdateAtomicFilesystem.sha256(file:)andtreeHash(root:)read 1 MiB chunks withFileHandle.read(upToCount:). On Darwin that call returns autoreleased storage. On a Swift concurrency thread no autorelease pool drains between jobs, so every hashed byte stays resident. The test installs and rolls back two bundles of the debug, coverage-builtdarkbloomCLI. Every manifest and verify step hashes the CLI twice (bundle tree and binary), about a dozen reads in total.WeightHasheralready does (fix(provider): bound weight hash memory growth #358). This changes production code, but only in memory use: the bytes hashed and the digests are the same. In production the provider's updater hashes the release bundle the same way, so an update keeps several times the bundle size resident while a model may be loaded. The test is unchanged; it needs the real built CLI.UpdateFileHashMemoryTestshashes a sparse 256 MiB file with both functions. It checks the digests against known values and that the process footprint grows less than 64 MiB. Before the fix it grew by about 512 MiB.ManifestBuilder.hashOne(model weights,darkbloom-publish, 64 KiB chunks in an async build),SpecDecStore.digestRegularFile(drafter weights, 1 MiB),BinaryHasher.sha256Digest(of:)and the metallib copy loop. Each keeps the whole file resident when it runs in async code.Sampler (report-only, never fails a job)
vm_stat: app (anonymous less purgeable), wired (holds resident GPU memory), file cache (file-backed + purgeable), compressed, used = app + wired + compressed (Activity Monitor's sum). Swap in use fromsysctl vm.swapusage.proc_pid_rusage(ri_phys_footprint, which includes IOAccelerator/Metal memory). This is the counter thatfootprintand Activity Monitor print, read in every sample. It also keepsri_lifetime_max_phys_footprint, so a peak between samples counts. The report shows the top 3 processes by peak, with their names, and the sum./usr/bin/footprint, where present, writes a category breakdown (IOAccelerator and others) at a new 2 GiB high, at most twice a job. The report says if the tool is present.host_statistics), so short compile processes count. It falls back to thepssum.run-provider-tests.shandcluster-test-plan.pymark each selection's start and end with its PID. The report names the selection of each large process and the selections that ran at the peak.summary.jsonin eachresource-samples-*artifact. The sampled time is scaled to 4 and 8 vCPUs: each interval is stretched by busy / vCPUs where busy is more than the vCPUs.Before / After
flowchart LR subgraph Before A1[vm_stat active+wired+compressed] --> R1[peak memory in use] B1[ps RSS] --> R2[largest RSS: misses Metal] C1[ps %cpu averages] --> R3[busy vCPUs] end subgraph After A2[vm_stat classes] --> S2[used / app / wired / file cache / compressed / swap] B2[proc_pid_rusage footprint + lifetime peak] --> T2[top 3 processes + sum] M2[selection marks from the runners] --> T2 F2[/usr/bin/footprint at highs/] --> T2 C2[host CPU ticks] --> U2[busy vCPUs + time at 4 and 8 vCPUs] S2 & T2 & U2 --> J2[report + summary.json] endflowchart LR subgraph "Before: update hash" H1[read 1 MiB chunk] --> P1[autoreleased Data kept on the thread] --> H1 end subgraph "After: update hash" H2[read 1 MiB chunk in autoreleasepool] --> P2[chunk released after hashing] --> H2 endHooked up
startexportsCI_RESOURCE_SAMPLESthroughGITHUB_ENV. The workflow's sampler steps are unchanged.run-provider-tests.sh(each selection, isolated filters, exclusive GPU test) andcluster-test-plan.py execute()(Popen keeps thesubprocess.runkill-on-interrupt behaviour).provider-plan.ymlis not touched.Results (run 42105290034; attempt 1 on Darkbloom/Blacksmith, attempt 2 on Blacksmith 12x48)
Peak GiB per class (worst attempt). Used = app + wired + compressed. The file cache is reclaimable. Busy vCPUs come from host CPU ticks. Pressure stayed normal (1) and swap at 0 in every job.
"Fit" means used × 1.25 ≤ RAM, and the job, scaled to that vCPU count, takes at most 5% longer. All test jobs scale to 4 vCPUs within 1.2%.
Build time scaled to fewer vCPUs: every sample interval inside the build step is stretched by busy / n where busy > n. Serial phases keep their time. Cold runs predate this PR, so their busy figure is the
ps%cpu average.Validation
Update file hash memoryandUpdate rollback end to end(34.8 s). Attempt 1's 7 Darkbloom-routed test jobs waited for sandbox runners. One runner lost communication (Cluster Runtime 1), and the coordinator cancelled the attempt and re-ran it./usr/bin/footprintis present on both runner types.scripts/test-ci-resource-sampler.py, in Check the CI plans) cover parsing, attribution, capture limits, summary and marks. No local builds or tests.🤖 Generated with Claude Code