Repository navigation
CUDA: retain pinned peaks and scoped process memory receipts - #865
Conversation
|
Thanks, @jayleaton. The locked device/pinned interval counters and sampler-before-reap change look right at 6b73325. One shutdown race needs fixing: |
|
Thanks, @ashhart. Fixed in New regression: |
|
Thank you, @jayleaton, for disarming signal forwarding before reaping the child and adding the regression. We merged your work for 1.1.0 in 21e8058. CUDA keeps pinned-host peaks beside device peaks, and The receipt tool runs a command for each rank and context, keeping RSS and device counts separate. This adds counters and collection tooling; it does not change a family's inference arithmetic. Posted by Ash's AI Assistant Synthena |
…y_receipts.py reads, and a follower frees what it owns before it leaves With TF_CUDA_MEMORY_RECEIPTS=1 (ashhart#865) each rank prints load_begin before NCCL and its weights, load_end once every rank has loaded, and cleanup_begin and cleanup_end around freeing its buffers, so the wrapper records one complete lifecycle a rank. A follower used to leave without freeing anything; after the end step it now frees its link, image rows, engine and group as rank 0's close does, so its cleanup receipts measure that. A follower that fails still leaves with _exit(1).
…y_receipts.py reads, and a follower frees what it owns before it leaves With TF_CUDA_MEMORY_RECEIPTS=1 (ashhart#865) each rank prints load_begin before NCCL and its weights, load_end once every rank has loaded, and cleanup_begin and cleanup_end around freeing its buffers, so the wrapper records one complete lifecycle a rank. A follower used to leave without freeing anything; after the end step it now frees its link, image rows, engine and group as rank 0's close does, so its cleanup receipts measure that. A follower that fails still leaves with _exit(1).
…hart#887, in landing order
…shhart#865), the 27B's K splits (ashhart#887), drafter releases (ashhart#893, ashhart#894), GLM's split check (ashhart#899) and Intel Arc (ashhart#802)
…y_receipts.py reads, and a follower frees what it owns before it leaves With TF_CUDA_MEMORY_RECEIPTS=1 (ashhart#865) each rank prints load_begin before NCCL and its weights, load_end once every rank has loaded, and cleanup_begin and cleanup_end around freeing its buffers, so the wrapper records one complete lifecycle a rank. A follower used to leave without freeing anything; after the end step it now frees its link, image rows, engine and group as rank 0's close does, so its cleanup receipts measure that. A follower that fails still leaves with _exit(1). Source-Commit: 80517fc Port-Changes: source-only; upstream raw receipt files omitted.
…y_receipts.py reads, and a follower frees what it owns before it leaves With TF_CUDA_MEMORY_RECEIPTS=1 (ashhart#865) each rank prints load_begin before NCCL and its weights, load_end once every rank has loaded, and cleanup_begin and cleanup_end around freeing its buffers, so the wrapper records one complete lifecycle a rank. A follower used to leave without freeing anything; after the end step it now frees its link, image rows, engine and group as rank 0's close does, so its cleanup receipts measure that. A follower that fails still leaves with _exit(1).
…y_receipts.py reads, and a follower frees what it owns before it leaves With TF_CUDA_MEMORY_RECEIPTS=1 (ashhart#865) each rank prints load_begin before NCCL and its weights, load_end once every rank has loaded, and cleanup_begin and cleanup_end around freeing its buffers, so the wrapper records one complete lifecycle a rank. A follower used to leave without freeing anything; after the end step it now frees its link, image rows, engine and group as rank 0's close does, so its cleanup receipts measure that. A follower that fails still leaves with _exit(1).
…y_receipts.py reads, and a follower frees what it owns before it leaves With TF_CUDA_MEMORY_RECEIPTS=1 (#865) each rank prints load_begin before NCCL and its weights, load_end once every rank has loaded, and cleanup_begin and cleanup_end around freeing its buffers, so the wrapper records one complete lifecycle a rank. A follower used to leave without freeing anything; after the end step it now frees its link, image rows, engine and group as rank 0's close does, so its cleanup receipts measure that. A follower that fails still leaves with _exit(1).
What this changes
Pinned HostBuffer allocations now retain a high-water mark, and an atomic interval snapshot preserves device and pinned peaks before resetting them. Add an opt-in per-process lifecycle receipt API and a Linux child-process collector so each rank can retain load/reset/cleanup boundaries without an HTTP endpoint.
The shared API is dormant until a caller opts in and emits boundaries. Family-specific DeepSeek lifecycle wiring is kept on a separate local candidate branch; this PR does not qualify that family or rewrite its cumulative stack. The collector starts only the supplied local command and provides no machine admission, service control or remote access. Use the owner's existing guard for any future device run.
Receipt
{"device":0,"host":0,"peak":0}with no pinned peak. After: seven direct Zig tests pass, covering pinned transient/reset accounting, concurrent reset exclusion, atomic completed-interval capture and both-rank JSON serialization.6b73325e90eb17685b2825cf4e1bf25555287997, tree673e573c7bfc000d62f4cdb738b0a2ae382bbe69, clean index. Build 10/10 steps; host test 46/46; frozen goldens 4/4; fuzz 3/3; CUDA-host 27/27; server CPU 3/3. Some test executions are cached; no skipped test was relabeled. Formatting/diff checks pass; lean 527 inherited, zero new by identity.Additional pinned-allocation accounting uses the existing counter mutex; diagnostic output can affect host timing when enabled. These are owned logical buffer counts, excluding arena reservation/slack, driver, NCCL and other untracked allocations. Linux wait4 RSS includes fork/exec/startup, is lifetime-scoped and cannot establish a unified-memory physical-footprint peak. Raw process logs require publication review.
Checklist
"draft": false, resumed equals fresh, concurrent equals solo. (Unrun.)