Shaders: XCL_PREP_QUEUE_MB bounds the translated DXIL --precompile --pipelines holds #3212
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3212"
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 ivall/xcl. Originally posted by oni-swr on 2026-11-28T20:10:05Z.
Offline
--precompile --pipelinestranslates every compute record into oneVec<PipelineJob>and starts the driver builds only after the last record is translated, so all translated DXIL is resident at once (#3043 frees a job after its build, not before the builds start). Related to the peak-commit work around #2088.With
XCL_PREP_QUEUE_MB=<MiB>the builders start during translation and a translator waits when queued plus in-build bytes would pass the cap. A program over the cap is admitted only into an empty queue (it runs alone). Builders take used-earlier programs first, then the largest, among what is queued. Unset (default): unchanged behaviour. No overlapping open PR found (searched precompile memory, queue bytes, DXIL queue, peak commit,run_pipeline_jobs; #2070 only changes the builders' stack).What is in it
crates/xcl/src/shaders.rs:ByteQueue(push/take/close/cancel, byte high-water mark),prep_queue_cap, wiring in the precompile loop (builders spawned beside translators, queue closed or cancelled after they join), one "held at most" line.crates/xcl/src/shaders.rstests: slow-consumer cap, exactly-once completion, oversized job alone, used-first-then-largest order, cancel frees blocked pushes, cap parsing, a numbers fixture.README.md: the variable.Tested
cargo test -j 4 -p xcl --lib pipeline_selection_tests -- --test-threads=2: 9 passed, 0 failed, 0 ignored (run before the rebase onto currentmain).mainand a peak commit of 14647 MB vs 14565 MB, no device removal, no crash.--precompile --windows 4 --only cs --pipelines, each arm stopped at 7 min (not finished: 25 to 75 of 538 pipelines built, the largest first, 16 driver builds at once): peak process commit 25.4 GiB onmain, 26.1 GiB on this head without the variable, 23.4 GiB on this head withXCL_PREP_QUEUE_MB=256; peak system commit rise 28.7 / 27.3 / 23.5 GiB. One run each, no repeats, no device removal. So the peak in this window is the driver builds, not the queued DXIL; the cap's 360 MiB at most is inside the run-to-run noise here, and no gain is claimed.Regression run
main:
this PR's head:
Not tested
--precompile --pipelinesrun (the arms above were stopped early) and runs where translation is not already cached; with the variable set, driver builds overlap DXC compiles, which is untested.XCL_DXIL_CACHE, so any later arm of such a comparison may start warm; on AMD XCL's driver-blob disk cache is off by default.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T22:17:02Z.
The production admission charge on
dc6df62cuses onlyjob.compiled.dxil.len(). A split compute job also retainsdispatch_chain.pieces, the DXIL buffers thatmake_selectedactually feeds tomake_chain_pieces. Those bytes never enter the queue's accounting.I ran the exact
ByteQueueandbuild_from_queueimplementation on Windows with two builders, a gated first build, and 8 MiB capacity. The synthetic jobs allocated real byte vectors with these lengths:With the production charge, both builders entered simultaneously. 23 MiB of payload was live in the two builders while the queue reported a 5 MiB high-water mark. Charging the whole plus all pieces instead kept the second job out until the first finished. Both oversized jobs made progress and completed once; the resulting high-water mark was 13 MiB, consistent with admitting a single oversized job.
I'd count all retained DXIL lengths at the production push site and use that charge for scheduling and reporting. Document the metric as admitted queued + in-build DXIL: completed translations waiting inside
pushalso still own their buffers. The fixture exercised actual scheduling with synthetic payloads; I did not run a title or measure process peak RSS/commit.AI assistance: OpenAI Codex traced the production paths, wrote and ran the CPU controls, and drafted this report.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:39:08Z.
Review (head
dc6df62c, diff read, not a merge-check; draft, conflicts with main):worker_threadwith the pipeline workers' stack (WORKER_STACK,shaders.rs~1388-1394), because driver builds overflowed a default stack (#1269). The PR's queue build threads (s.spawn, ~3635) use the default stack, so with the variable set they lose that fix.job.compiled.dxil.len()(~3718). It doesn't count the DXIL pieces of split programs (dispatch_chain.pieces), or finished translations waiting to enter the queue. That fits andrewDoing's measurement: 23 MiB held while the queue reported 5 MiB.pushforever and the run hangs instead of reporting the panic. Otherwise it can't deadlock: a waiting translator holds no other lock, and an oversized job gets in once the queue is empty.Fine: it is off by default (unset or
0), and off for mandatory and startup preparation. Cancel and close on a translator panic are right, and the ordering and cap-parsing tests are good.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:44:37Z.
Triage (#1607) – head
dc6df62No open or merged PR adds
XCL_PREP_QUEUE_MBor a byte-bounded queue between translation and driver builds inshaders::precompile.Minor: with the queue on,
make_pipelinesstill runs afterwards on the emptypipeline_jobsand prints "pipelines: 0 compute programs"; the return value ofByteQueue::pushis ignored at the call site (only false after a cancel, so harmless). Ordering matchesorder_pipeline_jobs(used first, then largest) per take.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.