Repository navigation
compute: prepare the compute pack on several threads (--jobs) - #3472
Conversation
Leyukaka
left a comment
There was a problem hiding this comment.
Diff reading only at 788ff2e; nothing built or run.
Checked:
- Output order is fixed: workers write only
records[i]; the pack, counts and errors are assembled afterwards in sorted marker order. - The size cut is unchanged: a record is 8 (key) + 64 (digest) + 4 + 4 + payload, the old
80 + payload. - The per-request calls already run in parallel on main:
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 4 comparison 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.
|
Thanks. Both nits:
|
e2b8e02 to
f99cacf
Compare
compile_dxil --prepare-compute-pack translated the requests one at a time. 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, or on --jobs N, and their records are appended in the sorted request order: the pack is the same for every thread count. native_compute_pack builds eleven requests with 1, 4 and the default count and compares the bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The --jobs 1 / --jobs 4 comparison caught a completion-order append only when the one prepared request finished after the refusals that sort after it. Read the record keys from the --jobs 4 pack and require them in sorted request order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f99cacf to
ec8030b
Compare
|
Rebased onto
|
Leyukaka
left a comment
There was a problem hiding this comment.
Re-read at ec8030b3, diff only. The workers fill only records[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.
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 compute pack: a startup capture of 2689 compute requests exceeds the 256 MiB pack limit; 28 requests are left out #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