Repository navigation
cuda contract: release each case's buffers so the full run fits in memory (test-only) - #1845
Conversation
|
Thank you, @Maxrio9, and thanks for splitting this out of #1730/#1731 as asked. You were first to this. @BlivionIaG's |
c506264 to
40a2db2
Compare
|
@ashhart rebased onto main now that #2042 is in; head On a host without a GPU, |
|
Thanks @Maxrio9. Everything from our last note is in, and folding |
|
Our GB10 run of the full kernel contract on this head ( One thing we said we'd post and haven't: peak memory per case. Our contract job doesn't record it yet, so these numbers don't show the saving itself. I'll add a per-case memory reading to the job and run it again on this head. |
|
@Maxrio9, here's the memory reading we owed. Our GB10 job now samples MemAvailable through the whole kernel contract run, on this head (
So releasing each case's buffers cuts the run's peak by about 31.5 GB, or 58%. Nothing new fails: 384 FAIL lines on each run, all shared with main, and 2 limit lines on each. That was the last thing on our side. If you mark it ready for review, it goes in the landing queue. |
|
Thanks @Maxrio9 for marking it ready. The 09:55 update only carries main's |
|
/atc exchange 19208e74fc1102cd6905274a24254d0292f0aa8388185774ddb050443be6d3d1 |
034ac09 to
ca3973f
Compare
|
Thanks @Maxrio9. The branch's merge commits kept it from replaying onto today's main, so I put your three commits together as one ( |
…registered owners so the full run fits in memory The three commits of this branch (7ab0e70, 40a2db2, d3b4d57) as one, on current main: each case releases its buffers and host copies, registered owners are scoped to their case, and the contract's closing phase moves to contract_finish.zig so contract_tests.zig stays under 600 lines.
ca3973f to
557bb78
Compare
|
Thank you @Maxrio9. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
|
Thanks @Maxrio9! This is in TensorFold 1.2.4, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.4 |
Test-only change, requested as its own PR in #1730 / #1731, rebased onto #2042.
#2042 frees each kernel's device buffers through
Rig.resetin thereleasehook. This keeps that hook and extends what it frees:Rig.finishGatesfrees the device buffers and the host copies (seen,outs,host,slots) of a finished kernel.releasecalls it where the Rig has it, andresetwhere it does not.registered(), so their destructors run before the standalone suites allocate theirs. The closing phase moved tocontract_finish.zig, socontract_tests.zigstays under 600 lines (597).Math, shapes, name-derived seeds, controls and bounds are unchanged. No production code is touched.
Checked on current main (
7eae7dc0):zig build test-kernel-contractand the newtest-cuda-contract-lifetime-hostpass on a host without a GPU, and the lean check adds no new problem. Tests added: the Rig test (each buffer freed once, reusable afterwards) and a gates test thatreleaseruns once after success, failure and a planted control.Not run: the full GPU
kernel-contracton this rebased version. My earlier GPU run (511 kernels passing gates 1-4, 340/340 controls caught, nvcc 13.0.88) was on the pre-#2042 version of this change, so I haven't measured peak memory since the rebase. It does not fix the limit-record problems that untouched main reports.