compute: prepare the compute pack on several threads (--jobs) #3472
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3472"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-29T16:27:11Z.
Follows #3091, which added the pack.
compile_dxil --prepare-compute-packtranslated the requests one at a time, on one core. They are independent:the frontend keeps no state between them, and the IR cache publishes through unique temporary files. So they are
now prepared on every hardware thread (at most 64), or on
--jobs N, and their records are appended in the sortedrequest order. The pack is the same for every thread count;
--jobs 1is the old behaviour.--jobs 1)other there: use
--jobs 1with a debug build.change (the limit and its check are unchanged) and is filed as #3473.
docs/experiments/native-startup-request-cache.md(prewarming section).Tests:
native_compute_packbuilds eleven requests (one prepared, ten refused, mixed in the sorted order) with--jobs 1,--jobs 4and the default, requires byte-identical packs that the checker accepts, and refuses--jobs 0. Locally (Windows 10 19045, dev and release builds):ctest -R "^native_compute_pack$"passes.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T17:27:01Z.
Review: APPROVED
Diff reading only at
788ff2e1; nothing built or run.Checked:
records[i]; the pack, counts and errors are assembled afterwards in sorted marker order.80 + payload.translate_compute(req, 0, true)in--refusals,prepare_direct_compute(which goes throughcached_compute_ir) in--watch.NIT
src/direct_compute_cache.cpp:398-423: every record stays in memory until the assembly loop, including those past the 256 MiB cut, which the serial code dropped at once. Peak memory is the sum of all records, not the pack size. #3473 changes the same function.NIT
tests/native_compute_pack_check.py:43-51: the--jobs 1/--jobs 4comparison catches a completion-order append only through timing (the one prepared request has to finish after the quick refusals that sort after it). Two or more prepared requests, or a check that record keys follow the sorted marker names, would make it deterministic.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-29T23:52:52Z.
Thanks. Both nits:
e2b8e027): the check now reads the record keys from the--jobs 4pack and requires them in sorted request order (pack_keysintests/native_compute_pack_check.py). That no longer depends on the threads finishing in a particular order.--prepare-compute-packwith the default--jobstook 419 s at a peak of 1.43 GiB. #3484 keeps every part in memory until it publishes, so with both PRs the peak stays about one pack whichever merges first.ctest -R "^native_compute_pack$": passed on release and dev (Windows 10 19045).Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T09:33:51Z.
Rebased onto main after #3484. The threads now only translate; the records go into #3484's parts afterwards, in the sorted order, so the parts are the same as with
--jobs 1.jobsis the 5th parameter, afterpart_limit.native_compute_packandnative_compute_pack_partspass (dev + release).Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T10:42:19Z.
Rebased onto
maina27119db(headec8030b3). The only conflict was the usage text intools/startup/compile_dxil.cpp: #3539 added[--jobs N]to--index-graphics-interfaces, and this PR adds it to--prepare-compute-pack. Both are kept, and the code merged unchanged.native_compute_packandnative_compute_pack_partspass in dev and release.native_compute_pack_hardwarefails on this host as before (the adapter lacks Shader Model 6.6).Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T00:04:14Z.
Review: APPROVED
Re-read at
ec8030b3, diff only. The workers fill onlyrecords[i], and the parts are assembled afterwards in sorted marker order (src/direct_compute_cache.cpp:474-489), so the pack does not depend on--jobs.pack_keys(tests/native_compute_pack_check.py:15,:73) now checks that order directly, which closes my earlier test NIT.