D3D12.X: the pieces of a split program read their slab from a root CBV #2633
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2633
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2633"
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?
@Kalmarv on GitHub · 2026-11-26 03:30 UTC · original
Kalmarv:chain-indirect-cbv→main· +1281 −29 · 10 files · 15 commits · draftStacked on #2404; only the top commit (
db34184) belongs here.A chained
ExecuteIndirect(#2404) records, for each round and piece, a UAV barrier, the piece's pipeline and anExecuteIndirectwhose command signature sets the slab's eight root constants. On the RTX 5070 Ti such anExecuteIndirectafter 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(db34184), inpso.rs,runner.rs,dispatch_chain.rsandreal.rs, with unit tests: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. Only blocks of 64 KiB are kept for use again, up to 8 MiB of them; bigger blocks and those past it are released at the reset (keep_free_constants; review by @luckyteagirl).pso::abi_signature_id, indriver_cache::name_for). A blob built for #2404's root constants is then not read and refused, and #2404's and this PR's files sit side by side in one cache (review by @KDenKC).Tested
db34184(on #2404's head5b9d4ff), on the GPU (debug):cargo test --workspace --no-fail-fast -- --test-threads=4: 1449 passed, 0 failed, 47 ignored, the newa_piece_is_named_after_the_root_signature_it_was_built_withamong them. 25 SKIPPED, as below.direct_dispatches_write_their_constants_in_blocks_used_again_after_the_allocator_reset, with the new assertions that no block bigger than 64 KiB is kept and the kept ones stay within 8 MiB: 1 passed. Withacba153's reset (every block kept): failed, "a block bigger than 65536 kept for use again".dispatch_chain,alloc_poolanddriver_cacheunit tests,--test-threads=1: 23 passed.dispatch_chain,split,execute_indirectandslabfilters with the debug layer and GPU-based validation,--nocapture, on the local build described below,--test-threads=1: 51 passed, 0 failed, 1 ignored. 1 SKIPPED:dispatch_chain_native_wave64_builds_whole(no wave64). During the tests: 1 error, 884, and 275 warnings (195 of 1328, 80 of 926), as on1202ac1below.a_piece_is_named_after_the_root_signature_it_was_built_withanda_file_is_named_after_its_dxil_and_flagsfailed with the piece's file named as before (no signature), and pass with it.acba153, this change before the two review fixes (on #2404's then head97a70a7):cargo test --workspace --no-fail-fast -- --test-threads=4: 1446 passed, 0 failed, 47 ignored, the newdirect_dispatches_write_their_constants_in_blocks_used_again_after_the_allocator_resetamong 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.1202ac1are of the same change before its rebase onto97a70a7(on551a75e).1202ac1, thedispatch_chain,split,execute_indirectandslabfilters withXCL_D3D12_DEBUG=1,--test-threads=4: 48 passed, 0 failed, 1 ignored. 1 SKIPPED:dispatch_chain_native_wave64_builds_whole(no wave64). Thedispatch_chainunit tests,--test-threads=1: 7 passed.dispatch_chain_divergent_forward_edges_3d, three runs: 1 passed each.--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, frommain'ssplit_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 #2404's head.1202ac1, on an RTX 2060 (NVIDIA 595.91) under Wine (wine-staging 11.21) + vkd3d-proton30b0eb9, a releasewindows-gnutest build,--test-threads=1, noXCL_D3D12_DEBUGor GPU-based validation set; correctness only: thedispatch_chainunit tests 7 passed; thedispatch_chain,split,execute_indirectandslabfilters 48 passed, 0 failed, 1 ignored, SKIPPEDdispatch_chain_native_wave64_builds_whole(no wave64);list_x41 passed;alloc_pool8 passed.acba153, AMD Radeon RX 6800M (driver 30.0.13002.13003), Windows 11 build 26200, debug (review):dispatch_chain_divergent_forward_edges_3dwithXCL_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.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=trueand two localfrom_ifacerelaxations),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.f29910f, on809da30):ExecuteIndirect, root constants (before)ExecuteIndirect, root CBV, Dispatch-only signatureDispatch, root constants (before)Dispatch, root CBV in the upload heapRegression run
scripts/smoke.ps1 -Seconds 60, the same retail title,XCL_DIRECT_DXIL=1, a private XCL cache started from the sameused-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 2 other jobs (builds, suites or precompiles; no other title run or timing job runs at the same time there).mainb49be18:this PR,
db34184:compute splitcounter at the end of each run:main:compute split: 171 programs split, 1811 pieces built, 0 chained dispatches issued in 0 slabs; scratch 0 MiB (most 0, largest dispatch 0 in one slab)compute split: 49 programs split, 465 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 wholeNot tested
DispatchorExecuteIndirecton either side, so it checks for regressions only; this PR's paths did not run in the title.Other branches
dispatch_chain.rs: both changeChain's fields and the read of its whole form inexecute_indirect, and #2629's test setsChain::signature, which this PR removes. Whichever lands second dropssignatureandbuild_wholethere and reads the whole form with.flatten(). With that, the merge builds (cargo check -p xcl --lib --tests).AI use
🤖 Generated with Claude Code
@luckyteagirl on GitHub · 2026-11-26 04:04 UTC · original
Focused RX 6800M check on clean PR head
acba153caf086ef0e0ebe4cda4e76b7216217fc3: Windows 11 Home build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver30.0.13002.13003, Rust 1.99.0 MSVC, DXC 1.9.2609.5 (debug test build).Result: 1 passed, 0 failed, 0 ignored, 1,346 filtered, 0
SKIPPEDnotices. The guarded run exited 0 with no memory guard trigger. The test printedCHAIN_GPU=AMD Radeon RX 6800Mand completed both split-chain forms:This is the focused synthetic split
ExecuteIndirectfixture. 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 on GitHub · 2026-11-26 05:00 UTC · original
Wine/NVIDIA cross-check of the new test — passes on the real adapter. Head
acba153caf086ef0e0ebe4cda4e76b7216217fc3(stacked on #2404's97a70a73c, 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 #175from_ifacerelaxations, 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, freshCompiling 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 logsFound 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
ExecuteIndirectclaim 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 on GitHub · 2026-11-26 05:01 UTC · original
@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.
@luckyteagirl on GitHub · 2026-11-26 05:57 UTC · original · reviewed
Could the free constants pool have a byte budget, or release oversized blocks on allocator reset? Every block removed from
CONSTANTSis retained in process-globalFREE_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 atacba153caf086ef0e0ebe4cda4e76b7216217fc3; no measured memory footprint or title run. AI-assisted review with Codex.@KDenKC on GitHub · 2026-11-26 06:25 UTC · original
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). Butdriver_cache::name_for(real.rs:4506) keys a piece's blob only on the DXIL hash, its length and the flags. So a.chain.psowritten by #2404 (ormain) 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 intoname_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 atacba153cand wrote this.acba153caftodb34184fe8@Kalmarv on GitHub · 2026-11-26 07:39 UTC · original
@luckyteagirl thank you for the review (6069221831): right, nothing ever released a block once it was in
FREE_CONSTANTS. Indb34184an allocator's reset keeps only blocks of the usual 64 KiB for use again, up to 8 MiB of them (keep_free_constants); bigger blocks and those past it are released there. The reuse fixture now also asserts that no block bigger than 64 KiB is kept and that the kept ones stay within the 8 MiB. With the old reset it fails ("a block bigger than 65536 kept for use again").@KDenKC thank you (7184414003), that was a real gap: the pieces' DXIL is the same under this PR, so a
.chain.psobuilt for #2404's root constants had the same name. Indb34184a piece's file also names the chain's root signature, as a hash of it serialized (pso::abi_signature_id), so-<sig>.chain.psofiles of #2404/mainand of this PR sit side by side instead of being read and refused. Test:a_piece_is_named_after_the_root_signature_it_was_built_with(one DXIL, two root signatures, two names); with the old name it fails. On a shared cache each side's first run still builds its own pieces once, but switching no longer makes the driver refuse and drop the other side's files, and no blob of the other layout can be accepted. Separate caches per side remain the cleaner A/B.AI use: Claude Code with Claude Opus 5.5 wrote both changes, their assertions and this reply, and ran the tests.
@SzczepanGrela on GitHub · 2026-11-26 07:59 UTC · original
RX 9070 / RADV paired check of #2633
db34184fe8c017347303433e714d2f6dd7fc5ee9against its stacked #2404 base97a70a73c96ee39cadffe1baafbc6725091277f6.Tested
Ryzen 7 7700, RX 9070, CachyOS Linux 7.3.0-5-cachyos, RADV Mesa 26.3.1-arch3.5, GE-Proton11-12 / Wine 11.0, vkd3d-proton
8293130ebe370b1+(local build with assertions disabled), DXC 1.9.2602.17, Rust 1.97.1. Windows GNU release binaries under Wine.Built both exact revisions with
cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run. Ranwine <unit-test.exe> <filter> --skip retail_ --nocapture --test-threads=1, then the same filters with--test-threads=4.The counts below were identical in both thread modes. Filters are under
hle::d3d12x:::real::dispatch_chain::tests::alloc_pool::tests::real::driver_cache::tests::Zero ignored tests and zero
SKIPPEDnotices. The updated constants-reuse test, root-signature cache-name test and whole-build queue test passed. The shared failure isa_recording_outlives_the_reset_of_the_titles_allocator:CreateCommandListreturns0x80070057, withd3d12_command_list_Reset: Invalid command allocatoron both revisions.dispatch_chain_divergent_forward_edges_3daborts on both revisions with0xc0000005atd3d12core.dll+0x2e7d48. Symbolized XCL frames lead toCreateComputePipelineStatefor a split piece inrunner::dispatch_split_samples, before the fixture's indirect cases. This fixture did not pass; no cause is attributed to this PR.Local GPU-timestamp diagnostic
Separate local copies add test-only repetition/timestamp instrumentation to
runner::dispatch_split_indirectand a synthetic DXC fixture. Production recording functions are unchanged from their respective revisions. Tencs_6_6pieces use the chain ABI, pass values through scratch and add 55 per active word per repetition. The 20 shader blobs, for 32- and 64-thread groups, are byte-identical between versions. Every result word, 16 guard words and the indirect tail were checked.Indirect samples cover the command-buffer transition back to UAV, the slicer and all 32 rounds of 10 pieces, with at most one group per slab. The direct control has 12 slabs of 10 pieces. PSO creation, allocation, initial uploads, final readback and CPU recording time are outside the timestamps. Five paired trials alternate A/B and B/A. Each case runs eight batches of 17 repetitions; discard two warmup batches and the first repetition of each remaining batch, keeping 96 samples per trial per case.
GPU microseconds per complete operation, median of the five trial medians; brackets give their min/max:
All ten diagnostic invocations passed: one test each, zero failed, ignored or skipped. Indirect operations take less GPU time in every paired trial. The 32-thread direct control takes 19.8% more at the reported medians, and more in every pair. The 64-thread direct result has larger variation. These are synthetic command-path results, not the author's per-step benchmark or a title-speed measurement; the direct-control difference has no established root cause.
Not tested
Native Windows, the full workspace suite, retail workloads or
scripts/smoke.ps1, gameplay/FPS, persisted driver-blob acceptance across layouts, or translated guest wave64 correctness. The diagnostic uses DXC-built pieces and bypasses runtime allocator reuse and the title pipeline-cache path. XCL application caches were separate per version; the vkd3d shader disk cache was disabled. GPU clocks were not fixed.AI use
OpenAI Codex (GPT-6; exact serving variant unavailable) audited the diffs, prepared and ran the comparisons and local diagnostic, checked the logs and drafted this report for user review.
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.