Repository navigation
compute: publish every compute pack record across numbered parts - #3484
Conversation
A pack file holds at most 256 MiB, the limit the shared cache lookup reads. When the next record would cross it, build_compute_frontend_pack now starts compute-<entry>.<n>.pack instead of leaving the record out. Part 0 keeps its name and records the part count; each part names the next part's id, so a missing, stale or swapped part, a key repeated across parts, trailing data or a part left past the count refuses the pack. Parts are written last to first, leftovers from a larger pack are removed, and pack_version moves to prepared-2. Only a single record over the limit still fails. The part limit is a writer parameter so native_compute_pack_parts crosses it with 13 source-built requests. Refs R0Y00#3473 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…essages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Leyukaka
left a comment
There was a problem hiding this comment.
Approve at 8d25453a. Reviewed by reading the diff only; nothing was built or run here.
Checked: part naming and the split are deterministic (sorted requests, greedy); a record goes into exactly one part, none lost or duplicated at a boundary; the single-record bound part_limit - 72 - 80 keeps every file within lookup's 256 MiB cap; the next-id chain and the part-past-the-count check refuse a missing, stale or swapped part; the reader and the prepared-2 bump refuse old packs; nothing changes when X2W_NATIVE_COMPUTE_PACK is unset.
Should:
tests/native_compute_pack_check.cpp:30passes the limit as the 4th positional argument, where #3472 addsunsigned jobs = 1. If the rebase misses that call it still compiles (size_ttounsigned) and the limit becomes the thread count. Suggest landing #3472 first, then the signature(requests, cache, entry, jobs, part_limit)with the test passing both.- A publish or
fs::removethat fails after a later part has been replaced leaves no loadable pack: the old part 0 then names a part whose id differs. That is safe (the load is refused and every request is a miss), but the doc only covers "every input fails"; one sentence would do.
Nits:
- The loader keeps the records of all parts, so the loaded pack is no longer bounded by one 256 MiB file. The doc could say so.
tests/native_compute_pack_check.py:177matchesstale compute pack partas a substring, while the PR body says every refusal is matched against the whole stderr line.lookupcompares a part's stored id with the id named by the previous part, but the id is not re-derived from the stored checksum. Hardening only.
|
Thanks for taking #3473. A real-data point for it: 4,352 compute requests from one local capture, through the current single-file writer (with #3472), gave 887 prepared, 2,742 unsupported and 723 left out as Agreed with Leyukaka on the order: #3472 first, then |
Fixes #3473. Follows #3091.
compile_dxil --prepare-compute-packleft out every record past 256 MiB. A pack is now written as numbered parts, each under that limit, so every record is published. The shared cachelookupand its 256 MiB cap are unchanged.Writer (
build_compute_frontend_pack)compute-<entry>.pack. Later parts arecompute-<entry>.<n>.pack.pack_version. Part n > 0 is published under the digest ofpack_versionand its payload's SHA-256, and the previous part names that id. So the existinglookuprefuses a missing, stale or swapped part without hashing a payload twice.invalid compute pack size.pack_versionmoves toprepared-2.part_limit, defaultcompute_pack_part_limit). Only the test lowers it. The command line is unchanged.Reader (
ComputeFrontendPack::load; the runtime caller is unchanged)X2W_NATIVE_COMPUTE_PACKstill names part 0.Tests (new
native_compute_pack_parts,tests/cmake/native_compute_pack_parts.cmake)The fixture is 13 source-built requests: 1 prepared and 12 refused. The prepared record sits between refused ones in the sorted order.
native_compute_pack_checkgains three modes:--build(the writer with a lowered limit),--same(per-key comparison of two packs) and--old(writes aprepared-1file).Positive.
prepared=1 unsupported=12 errors=0.other=0).--samegives the samelookupresult for all 13 keys as the one-part pack built bycompile_dxilwith no limit.Single record over the limit (limit − 1):
prepared=0 unsupported=12 errors=1, with exactly oneinvalid compute pack size.Negative controls. Each is refused with the stated message, and the restored pack loads again:
missing, stale or damaged compute packmissing, stale or damaged compute packinvalid compute pack recordtrailing compute pack datainvalid compute pack part countinvalid compute pack partstale compute pack part, and--buildremoves itprepared-1pack under this build's revisionmissing, stale or damaged compute pack, and a rebuild loadsRevert controls (run locally, not committed):
--buildgivesprepared=0 unsupported=12 errors=1, with the crossing record reported asinvalid compute pack sizeand left out.prepared-2reverted toprepared-1: theprepared-1file passes the version check and is parsed as the new layout. It fails only because a request-key word exceeds the count bound (invalid frontend cache count).Result: 2/2 passed (
native_compute_pack,native_compute_pack_parts). Windows 11 build 26300, MSVC (VS 2022, dev preset), Windows SDK 10.0.26100, Python 3.12. No GPU used.native_compute_pack_hardwarewas not run. The PR check skipsnative_*tests, so this local run is the evidence for both until a full workflow run.Measurement. Counts only. None of my own captures was rerun. The synthetic test above is the evidence. A rerun of the 2,689-request set from #3472, before and after, would show the 28 left-out records published as a second part.
Interaction with #3472 (open). Both change
build_compute_frontend_pack.unsigned jobs = 1as the fourth parameter, and this PR addssize_t part_limitthere. After both, the checker's--buildcall must passjobsexplicitly.AI-assisted.
🤖 Generated with Claude Code