Skip to content

D3D12.X: the pieces of a split program read their slab from a root CBV - #2633

Draft
Kalmarv wants to merge 12 commits into
xcl-dev:mainfrom
Kalmarv:chain-indirect-cbv
Draft

Kalmarv wants to merge 12 commits into
xcl-dev:mainfrom
Kalmarv:chain-indirect-cbv

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2404; only the top commit (acba153) belongs here.

A chained ExecuteIndirect (#2404) records, for each round and piece, a UAV barrier, the piece's pipeline and an ExecuteIndirect whose command signature sets the slab's eight root constants. On the RTX 5070 Ti such an ExecuteIndirect after the barrier takes 15.3 µs of GPU time, empty or not, so 32 rounds of 10 pieces cost 4.9 ms every time. With a Dispatch-only signature it takes 0.41 µs. The pieces read only the slab's size and origin, the same for every piece of a round, so the chain's root signature now gives them as a root CBV (b0, space2, the register the pieces already read) instead of root constants. The pieces' code does not change.

What is in it

  • D3D12.X: the pieces of a split program read their slab from a root CBV (acba153), in pso.rs, runner.rs and dispatch_chain.rs, with a unit test:
    • ExecuteIndirect: the slicer writes one 256-byte command a round (the slab's constants, its Dispatch 32 bytes in) instead of one 44-byte command per piece. The CPU points the CBV at the round's command, and the pieces' ExecuteIndirects use the Dispatch-only signature. The commands buffer for 32 rounds is 8 KiB, whatever the number of pieces.
    • Dispatch: the CPU writes the slabs' constants into 64 KiB upload-heap blocks of the list's allocator, used again once it is reset. A list with no allocator runs the whole form, as without scratch.

Tested

  • Ryzen 9 9950X, RTX 5070 Ti (NVIDIA 610.74), Windows 11 build 26200, rustc 1.99.0, DXC 1.9.2609; tests in debug, the smoke runs from release builds.

  • On acba153 (on D3D12.X: an ExecuteIndirect of a split program runs its pieces #2404's head 97a70a7): cargo test --workspace --no-fail-fast -- --test-threads=4: 1446 passed, 0 failed, 47 ignored, the new direct_dispatches_write_their_constants_in_blocks_used_again_after_the_allocator_reset among them. 25 SKIPPED: 21 for no native wave64 on this card, three per-lane FP16 forms the per-lane lowering refuses, and no heap windows.

  • The runs below on 1202ac1 are of the same change before its rebase onto 97a70a7 (on 551a75e).

  • On 1202ac1, the dispatch_chain, split, execute_indirect and slab filters with XCL_D3D12_DEBUG=1, --test-threads=4: 48 passed, 0 failed, 1 ignored. 1 SKIPPED: dispatch_chain_native_wave64_builds_whole (no wave64). The dispatch_chain unit tests, --test-threads=1: 7 passed. dispatch_chain_divergent_forward_edges_3d, three runs: 1 passed each.

  • The same filters with the debug layer and GPU-based validation, --nocapture, on a local build of the test runner that switches GPU-based validation on and prints every layer message (neither is an XCL option): 48 passed, 0 failed, 1 ignored. During the tests: 1 error, 884, from main's split_compute_program_prebuilds_and_caches_chain_pieces, which feeds the driver a deliberately invalid blob; and 275 warnings: 195 of 1328 (a buffer's initial state ignored) and 80 of 926 (a root view's address in a heap), as on D3D12.X: an ExecuteIndirect of a split program runs its pieces #2404's head.

  • On 1202ac1, on an RTX 2060 (NVIDIA 595.91) under Wine (wine-staging 11.21) + vkd3d-proton 30b0eb9, a release windows-gnu test build, --test-threads=1, no XCL_D3D12_DEBUG or GPU-based validation set; correctness only: the dispatch_chain unit tests 7 passed; the dispatch_chain, split, execute_indirect and slab filters 48 passed, 0 failed, 1 ignored, SKIPPED dispatch_chain_native_wave64_builds_whole (no wave64); list_x 41 passed; alloc_pool 8 passed.

  • Tested by others: @luckyteagirl, on acba153, AMD Radeon RX 6800M (driver 30.0.13002.13003), Windows 11 build 26200, debug (review): dispatch_chain_divergent_forward_edges_3d with XCL_REQUIRE_GPU=wave64, --test-threads=1: 1 passed, 0 failed, no SKIPPED notice, both the 32- and 64-thread chains (3 pieces each). Not the whole suite.

  • Tested by others, on acba153: @pickles976, RTX 4060 Laptop GPU 8 GB (NVIDIA 590.48.1) under Wine 11.0 + vkd3d-proton 3.2.0, a local diagnostic build of it with relaxed checks (-Db_ndebug=true and two local from_iface relaxations), x86_64-pc-windows-msvc, one test thread (review): direct_dispatches_write_their_constants_in_blocks_used_again_after_the_allocator_reset: 1 passed, on the NVIDIA device. Correctness only, with no timing or title run.

  • GPU timestamps, 16 rounds × 10 pieces, median per piece step, in a local-only test not in this PR, on the same change before its rebase (f29910f, on 809da30):

    empty one group
    ExecuteIndirect, root constants (before) 15.3 µs 15.6 µs
    ExecuteIndirect, root CBV, Dispatch-only signature 0.41 µs 1.01 µs
    Dispatch, root constants (before) 0.25 µs 0.61 µs
    Dispatch, root CBV in the upload heap 0.25 µs 0.61 µs

Regression run

scripts/smoke.ps1 -Seconds 60, the same retail title, XCL_DIRECT_DXIL=1, a private XCL cache started from the same used-pipelines.txt. Both ran back to back in one queue job on the machine under Tested, from release builds of clean trees, in the queue's title lane beside 3 to 4 other jobs (builds, suites or precompiles; no other title run or timing job runs at the same time there).

main b49be18:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1550 (PresentX 1550)
presents per 2 s (last 3): 21 49 52
device removals: 0
crashes: 0
peak commit: 17807 MB

this PR, acba153:

xcl-smoke v1
commit: acba153caf086ef0e0ebe4cda4e76b7216217fc3
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1555 (PresentX 1555)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16398 MB

compute split counter at the end of each run:

  • main: compute split: 11 programs split, 72 pieces built, 0 chained dispatches issued in 0 slabs; scratch 0 MiB (most 0, largest dispatch 0 in one slab)
  • this PR: compute split: 11 programs split, 72 pieces built, 0 chained dispatches issued in 0 slabs; scratch 0 MiB (most 0, largest dispatch 0 in one slab); ExecuteIndirect: 0 chained (0 of them whole, 0 slabs lost), 0 whole

Not tested

  • This 60 s run reaches no chained Dispatch or ExecuteIndirect on either side, so it checks for regressions only; this PR's paths did not run in the title.
  • The GPU time saved in a title: only the local test above measured it.
  • AMD beyond that one test on an RX 6800M; other NVIDIA generations than Blackwell.

Other branches

AI use

  • Claude Code with Claude Opus 5.5 wrote the code, the tests and this description, and ran the tests and the regression run on the hardware above.

🤖 Generated with Claude Code

Kalmarv and others added 12 commits November 25, 2026 19:49
An ExecuteIndirect of a compute program that the recompiler split into
pieces fell back to the program's whole form, and that form was compiled
on the recording thread when first needed. On an RTX 5070 Ti with
XCL_DIRECT_DXIL=1 a retail title stalls its world load on it: 11
per-material programs, 9-14 pieces each, each dispatched through
ExecuteIndirect, each whole form 690-950 KB of DXIL taking 16-40 s to
compile, one after another from 326 s to past 600 s.

The title's ExecuteIndirects of split programs all have one command
signature: one Dispatch, stride 12, MaxCommandCount 1, no count buffer
(150 of them in 360 s). Their group counts are written on the GPU, so
the CPU cannot slice them when recording.

The ExecuteIndirect now runs the chain on the GPU. A small compute pass
(pso::record_slicer) reads the title's arguments (and count) and writes,
for a fixed number of rounds, one command per piece of each slab of
dispatch_slabs (the root constants of record_dispatch_chain, then the
slab's group counts); unused rounds get empty dispatches. Each piece then
runs one ExecuteIndirect per round with the chain's command signature,
with UAV barriers between them, in the bounded scratch.

The rounds come from the arguments the CPU sees now and the most slabs an
earlier ExecuteIndirect of the program had, plus a quarter (2 to
XCL_SPLIT_INDIRECT_ROUNDS, 16). When the arguments need more slabs and
the whole form is built already, the slicer leaves the rounds empty and
writes the title's Dispatch arguments after them, and the whole form runs
on those through a command signature of one Dispatch; otherwise it leaves
those empty. So one of the two runs, without predication: under one
predicate, two NVIDIA Ampere cards (RTX 3080 Ti, RTX 3070) ran some of
the rounds and not the whole form (xcl-dev#2404). The whole form's
ExecuteIndirect is recorded first, and the rounds' UAV barriers follow
it: on the RTX 3080 Ti it ran right after the slicer alone but not
after the pieces' ExecuteIndirects. If the whole form is not
built, the rounds run, the lost slabs are counted and warned about once
per program, the whole form is built on another thread for the next
ones, and the next rounds are sized from the count. The title's own
predication holds for the slicer too, so the same choice is made under
it. Bundles, lists without scratch and
other command signatures keep the whole form. The 'compute split' line
counts chained, whole and lost ExecuteIndirects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runner::dispatch_split_indirect records a chain's ExecuteIndirect the way
the runtime does: the slicer, the whole form on the slicer's arguments
when there is one, then the rounds' ExecuteIndirects.
dispatch_chain_divergent_forward_edges_3d runs it with one command,
several with empty commands and a count buffer that leaves the last out,
and a stride of 20 bytes, in slabs of 1 to 12 groups and 1 to 16 rounds,
each without and with a whole form. It checks the memory against the
whole program and the slicer's slab count. With more slabs than rounds
it checks that the slicer says so and that the whole form runs instead
(the memory would not match if the rounds had run too). Without a whole
form it checks that only the rounds' groups run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s whole form

A chained ExecuteIndirect whose arguments have more slabs than its
rounds runs the program's whole form instead, but only when that form is
built already. Until then the slabs past the rounds are lost, counted and
warned about. Across ten title runs of the earlier version, 158 slabs were
lost in six, in 73,714 chained ExecuteIndirects. In each run it was one
program with 17 slabs: 15 at its first ExecuteIndirect, whose arguments
read 0 when it was recorded and which so got 2 rounds, then 1 at each
later one (at most 16 rounds) until its whole form was built.

- An ExecuteIndirect of a program none of whose ExecuteIndirects has been
  read back yet gets the most rounds. After that, the most slabs any of
  them had (not only those that lost some) size the rounds. This costs
  the empty rounds of a program's first ExecuteIndirects: one
  ExecuteIndirect and one UAV barrier per piece and round. The scratch
  does not grow with the rounds; the command buffer does, by 44 bytes a
  piece and round.
- XCL_SPLIT_INDIRECT_ROUNDS defaults to 32, not 16. Rounds are sized from
  the slabs read back, so the cap matters only for programs that need
  more. With both, none of those runs would have lost a slab.
- The whole form is asked for at the program's first chained
  ExecuteIndirect, not after a loss is read back. It is built on an
  xcl-pso-chain-whole thread, so a huge whole form waits for its turn
  (driver_compile) as the workers' builds do. Before, it was built on a
  thread named xcl-chain-whole, which the huge-build gate did not hold
  (pvfreis, xcl-dev#2404). It is bound only when an ExecuteIndirect has more
  slabs than its rounds.

More than 32 slabs before the whole form is built are still lost, counted
and warned about. Waiting for the whole form when the ExecuteIndirect is
recorded would make it exact. But the precompile does not build the whole
forms of split programs, so that wait is a cold compile on the title's
thread: the 16-40 s stalls this chain removes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot read back

The slicer's words after the rounds size the next ExecuteIndirects of
the program: the most slabs one had, and whether any had been measured
at all. Under the title's predication (SetPredicationBufferX) the slicer's
Dispatch may be skipped, and its words then stay as the buffer was
created, all 0. read_back still took them as a count: the program counted
as measured with 0 slabs, so its next ExecuteIndirect whose arguments read
0 on the CPU got 2 rounds instead of the 32 of one never measured.

A chained ExecuteIndirect recorded while the title's predication is set
is no longer read back, as one whose binding failed. Its slicer still
runs the same choice under the predicate.

Reported by @thehollowedone (xcl-dev#2404).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nature

a_chained_execute_indirect_keeps_its_commands_when_binding_fails records
two chained ExecuteIndirects whose binding succeeds, but its bind closure
did not set the chain's root signature, as bind_abi does. The pieces'
ExecuteIndirects then ran under the slicer's root signature: with the D3D12
debug layer and GPU-based validation, 258 messages (953, 744 and 712). The
test still passed; the runtime's path sets the root signature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Indirect sizes the rounds

A chained ExecuteIndirect records rounds x pieces ExecuteIndirects, each
after a UAV barrier, also when the slicer leaves them empty. On an RTX
5070 Ti (NVIDIA 610.74) such a step takes 14.4 us of GPU time with the
chain's command signature (eight root constants and a Dispatch): 144 us a
round for 10 pieces, 2.3 ms for 16 rounds, 4.6 ms for 32, empty or not.
Without the barrier it is 0.17 us, and with a Dispatch-only signature
0.41 us; a count buffer of 0 makes it 11.5 us. The rounds came from the
most slabs any ExecuteIndirect of the program had, so one large one kept
every later one at that size.

Until the whole form is built that is needed, since the slabs past the
rounds are lost. Once it is built, an ExecuteIndirect with more slabs than
its rounds runs the whole form, so the rounds now follow the last one
read back (and the arguments seen when recording), not the most.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chain's root signature indexes the descriptor heaps directly, so setting it on a list
without heaps is a debug-layer error (1419, four of them under GPU-based validation at
809da30). A title's list has its heaps set when XCL binds the ABI; the test's `bind` now sets
two shader-visible heaps before the root signature, as that list has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…track

With the allocator pool on, `execute_indirect` kept the recording with the
PC allocator the list records on (`alloc_pool::recording_backing`). For a
list the pool does not track it got 0, so it returned Ok(false) and the
ExecuteIndirect ran its whole form. XCL makes such lists itself: a mid-list
split's next list is created on `alloc_pool::current(alloc)` with no
`created_on`. Under Wine + vkd3d-proton on an RTX 4060 Ti, this branch
chained 2 ExecuteIndirects and ran 26-30 whole in three runs of a title,
and the title presented nothing after its loading burst. In a fourth run
with a log line, all 32 that declined did so for this reason.

Such a list is now taken on by the pool, on the PC allocator the title's
allocator stands for, which is the one the list was made on
(`alloc_pool::recording_backing_or_take_on`), and the recording is kept
there. xcl-dev#2333 keeps these recordings with the title's allocator instead
(its `resolve_allocator`). The pool then knows nothing of the list, so it
can take that allocator for free and release the recordings (scratch and
commands buffer) while the list still records or runs on the GPU. Taken
on, the list keeps its backing busy until it is reset elsewhere or
released, and its submits mark the backing like any other list's.

The title's allocator also gets the list's type, so that a Reset while
the list holds its backing swaps it like the title's own lists.

Reported by @Royalflamejlh (xcl-dev#2404). With xcl-dev#2333 merged under this branch
and its fallback in `execute_indirect`, every ExecuteIndirect chained in
four runs (22 to 70,341 of them, 0 whole).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chains of one recording share one scratch, which `dispatch_chain`
finds by the list's address (`SHARED`). Only a list's Reset forgot it.
Addresses are reused (xcl-dev#2588). A list created at the address of a
released one, on the same allocator while the old recordings were still
held, found the old list's scratch and shared it with work the GPU may
still be running. A chained ExecuteIndirect takes its scratch the same
way. `list_x` now forgets the entry when a list is created and when it
is released, with a unit test that fails without the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e free

A chained ExecuteIndirect keeps its slicer scratch and commands buffer
with the recording of its PC allocator until that allocator is reset
(dispatch_chain::allocator_reset, from reset_pc_allocator) or released.
When the title resets an allocator whose recording is still held or on
the GPU, alloc_pool puts the PC allocator aside and gives the title
another. The one put aside is reset only when the same title allocator
is reset again and reuses it, which may never happen. Until then its
recordings, and the memory they keep, stay.

dhillonjagdeep650-boop found it on an RTX 3080 Ti (xcl-dev#2404): 1,887
recordings under 48 allocators at 110 s, local and non-local memory
growing about 150 MB/s, then a device removal at 110.8 s. The allocator
log said 119 made and 119 put aside.

Every title Reset now also releases the recordings of each PC allocator
put aside that nothing holds any more: no list records on it and its
submits are done. This happens outside the pool's lock.
allocator_reset of an allocator without recordings does nothing, and
the allocator is reset as before when it is reused.

This relies on every chained recording being filed with the PC
allocator its list records on, and on that list being known to the pool
(an earlier commit here takes on the lists it had not seen). A recording
filed with a title's allocator, as xcl-dev#2333's lines file one, would go when
that allocator is free, while its list still records or runs on the GPU
elsewhere.

The first test fails without the sweep: the free allocator put aside still
holds its recordings after another title allocator's Reset. Two more
show that a taken-on list's recording stays while the list records on
its allocator put aside and while its submit runs, and goes after both;
and that a free title allocator put aside does not take a live list's
recording with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s turn

`want_whole` builds a split program's whole form on `xcl-pso-chain-whole`, an `xcl-pso*` thread,
so a huge one waits in `big_compile_turn` for a background slot and 3 GB of free commit, with no
timeout. It waits holding `Chain::build_whole`, and nothing on that thread says a title thread
waits for it (`pso_async::build_is_wanted` reads only a worker's build). So a title thread that
needs the same whole form meanwhile (`bind.rs` for an ExecuteIndirect it cannot chain,
`dispatch` without scratch) blocked on the mutex until the background turn came. It got neither
the wanted cap nor the commit skip of a build the title waits for, where before `want_whole` it
compiled at once (found by @pvfreis in the review of xcl-dev#2404).

A title thread now counts itself in `Chain::waiting` while it waits for the whole form, and
`want_whole`'s build runs in `pso_async::build_waited_on`, so `build_is_wanted` is true on that
thread while one does. The background build then goes as one the title waits for, and the title
thread gets the form when it is built. The test fills the background slots, starts the build and
asks for the form on another thread: without the count it waited until the slots were freed
("the title thread waited for the background build's turn").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A chained ExecuteIndirect records, per round and piece, a UAV barrier, the piece's pipeline
and an ExecuteIndirect whose command signature sets the eight root constants of the slab. On
an RTX 5070 Ti (NVIDIA 610.74) such an ExecuteIndirect after the barrier takes 15.3 us of GPU
time, empty or not: 32 rounds of 10 pieces are 4.9 ms, every time (xcl-dev#2404). With a Dispatch-only
signature it takes 0.41 us; a barrier only to the scratch does not help (15.3 us).

The pieces read only the slab's size and origin (`split.rs`, `Slab::new`), the same for every
piece of a round. So the chain's root signature takes them as a root CBV (b0 space2, the
register the pieces already read) instead of root constants, and the pieces do not change:
- ExecuteIndirect: the slicer writes one 256-byte command a round (the slab's constants, its
  Dispatch 32 bytes in) instead of one 44-byte command per piece; the CPU points the CBV at the
  round's command, and the pieces' ExecuteIndirects take the Dispatch-only signature. The buffer
  for 32 rounds is 8 KiB, whatever the pieces.
- Dispatch: the CPU writes the slabs' constants into 64 KiB upload-heap blocks of the list's
  allocator, used again once it is reset; without one the whole form runs, as without scratch.

Measured on the RTX 5070 Ti, GPU timestamps, 16 rounds x 10 pieces, median per piece step:
  ExecuteIndirect, root constants (before)       15.3 us empty, 15.6 us with one group
  ExecuteIndirect, root CBV, Dispatch-only        0.41 us empty,  1.01 us with one group
  Dispatch, root constants (before)               0.25 us empty,  0.61 us with one group
  Dispatch, root CBV in the upload heap           0.25 us empty,  0.61 us with one group

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@luckyteagirl

Copy link
Copy Markdown
Contributor

Focused RX 6800M check on clean PR head acba153caf086ef0e0ebe4cda4e76b7216217fc3: Windows 11 Home build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver 30.0.13002.13003, Rust 1.99.0 MSVC, DXC 1.9.2609.5 (debug test build).

$env:XCL_ADAPTER = '6800M'
$env:XCL_REQUIRE_GPU = 'wave64'
cargo test --locked -p xcl --lib dispatch_chain_divergent_forward_edges_3d -- --test-threads=1 --show-output

Result: 1 passed, 0 failed, 0 ignored, 1,346 filtered, 0 SKIPPED notices. The guarded run exited 0 with no memory guard trigger. The test printed CHAIN_GPU=AMD Radeon RX 6800M and completed both split-chain forms:

Guest threads Pieces Scratch words per group Checked words Guard words
32 3 288 384 16
64 3 576 768 16

This is the focused synthetic split ExecuteIndirect fixture. I did not run the full workspace suite or reproduce a title-specific GPU fault on this PR head.

AI use: OpenAI Codex (GPT-6; exact serving variant unavailable) and a Luna subagent selected and ran the test, verified the live head and adapter, and prepared this report.

@pickles976

Copy link
Copy Markdown

Wine/NVIDIA cross-check of the new test — passes on the real adapter. Head acba153caf086ef0e0ebe4cda4e76b7216217fc3 (stacked on #2404's 97a70a73c, as described), RTX 4060 Laptop GPU 8 GiB, Wine 11.0, vkd3d-proton 3.2.0 diagnostic-relaxed build (same provenance commit as the stock DLL, -Db_ndebug=true + the two #175 from_iface relaxations, local-only; this test is not behind the vtable wall but the stack is uniform here), NVIDIA 590.48.1, --locked --target x86_64-pc-windows-msvc, one test thread, fresh Compiling xcl .../xcl-pr2633/... provenance.

direct_dispatches_write_their_constants_in_blocks_used_again_after_the_allocator_reset — 1/1 pass (0.65 s), with the real NVIDIA device opened (DXVK logs Found device: NVIDIA GeForce RTX 4060 Laptop GPU): the Dispatch-form slab constants go into 64 KiB upload-heap blocks of the list's allocator and the blocks are reused after reset, as the test's assertions check.

Scope: correctness fixture only — the 15.3 µs → 0.41 µs ExecuteIndirect claim remains the author's RTX 5070 Ti measurement; no perf numbers from this host, no title run. Log: .compat-xcl/logs/verify-pr2633-wine-cbv-slab-relaxed.log (local). AI-assisted verification and report (OpenAI Codex).

@Kalmarv

Kalmarv commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@pickles976 thank you for the Wine cross-check on acba153 (7183101906): the new test passing on the RTX 4060 Laptop's own device is the first run of it outside our machines. It is in the description under Tested, with your caveats: your local relaxed vkd3d-proton build, correctness only, no timing or title run.

AI use: Claude Code with Claude Opus 5.5 read the report and wrote this reply.

Kalmarv added a commit to Kalmarv/xcl that referenced this pull request Nov 26, 2026
With the CPU-scaled default, huge_pso_concurrency is 4 on a 16-thread
machine while huge_pso_wanted_concurrency stayed base.max(2), also 4: with
four background huge compiles running, a build a title thread waits for
had no slot of its own and queued behind them. The wanted default is now
one more than the background concurrency, as it was when that was 1.

Found by xcl-dev#2633's a_title_thread_does_not_wait_behind_a_background_whole_
build_waiting_for_its_turn, which fails with this branch merged and passes
with XCL_HUGE_PSO_CONCURRENCY=1 or XCL_HUGE_PSO_WANTED_CONCURRENCY=5.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@luckyteagirl luckyteagirl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the free constants pool have a byte budget, or release oversized blocks on allocator reset? Every block removed from CONSTANTS is retained in process-global FREE_CONSTANTS; reuse requires the same device and sufficient capacity, and I could not find a trim or device-cleanup path. A temporary burst of large slab constants can therefore leave its committed upload resources mapped for the rest of the process, even after the recording allocators retire. The reuse fixture could also assert that excess blocks are released. Exact-head source review at acba153caf086ef0e0ebe4cda4e76b7216217fc3; no measured memory footprint or title run. AI-assisted review with Codex.

@KDenKC

KDenKC commented Nov 26, 2026

Copy link
Copy Markdown

Source review of acba153c, no run yet. One thing for anyone A/B-ing this against #2404 on a warm cache:

The pieces' DXIL doesn't change here, only their root signature does (parameter 7 goes from 8 root constants to a root CBV in abi_signature). But driver_cache::name_for (real.rs:4506) keys a piece's blob only on the DXIL hash, its length and the flags. So a .chain.pso written by #2404 (or main) has the same file name under this head, and it was built against the old root signature. Expected effect: the driver refuses it ("a driver blob kept on disk was refused … compiled again"), so the first run after switching builds every piece cold. A comparison on a shared cache would then charge that to this PR. And if a driver ever did accept the mismatched blob, it would be running pieces against the wrong root signature. A different extension for the CBV layout (or a layout version folded into name_for) would keep the two apart.

When we run it, we'll give each side its own cache.

My 5090 and I await the root-CBV era.

AI use: Gemini (Antigravity) noticed the shared file name in a review; Claude Code (Claude Opus 5.5) checked name_for, the piece DXIL and the refusal path at acba153c and wrote this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants