D3D12.X: cache per-list ABI bindings and lock-free UMA VAs #667
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!667
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-667"
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?
@RandomGithub12309 on GitHub · 2026-11-24 03:09 UTC · original
RandomGithub12309:d3d12x/cache-abi-bindings→main· +536 −59 · 4 files · 1 commits · openCache per-command-list PC ABI root-signature (
u2..u5) and PSO bindings inbind_abiand publish UMA window VAs lock-free to reduce per-draw / per-dispatch CPU overhead on translated pipelines.What is in it
crates/xcl/src/hle/d3d12x/bind.rs:bound_rs_gfx,bound_rs_compute, andbound_psoper command list so consecutive translated draws/dispatches reuse the bound ABI root signature,u2..u5UMA window UAVs, and PSO while updatingu0/u1per draw.bind_abi(preservingIO_UMA_BASE_HI).Reset,ClearState,ExecuteBundle, mid-list splits (inherit_for_split), nativeSetGraphicsRootSignature/SetComputeRootSignature(external_root_signature), and untranslated title draws /ExecuteIndirect(bind_title_graphics_signature).ClearState/ native setters /ExecuteIndirect/ExecuteBundle, and stack SGPR packing.crates/xcl/src/hle/d3d12x/console_list.rs: stack-allocatedwrite_user_data_gfx/write_user_data_forhelpers avoiding per-drawVecallocations.crates/xcl/src/hle/d3d12x/list_x.rs: invalidate cached PC bindings and recordinit_psoafterKickoffXreset ontarget.crates/xcl/src/hle/d3d12x/real.rs: publish UMA window VAs lock-free once initialized (uma_window_vas_fast,uma_va_of_in) while keepingheap_windows()descriptor-heap setup intact.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)stable-x86_64-pc-windows-msvc(debug for unit tests, release forsmoke.ps1).cargo test -p xcl --lib hle::d3d12x::bind -- --test-threads=1 --nocaptureat3d60ee9: 9 passed, 0 failed, 0 ignored (0 skipped).cargo test --workspace -- --test-threads=4 --skip fuzz_validate_and_gpuat3d60ee9:xcllib 941 passed, 0 failed, 25 ignored (SKIPPEDon this adapter: wave64-only GPU tests andpso_measurement_compiles_an_exact_synthetic_recordbecause Windows Developer Mode is off;gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0..3}excluded due to pre-existing0x8007000ECreateComputePipelineStateOOM on this adapter).scripts/smoke.ps1release build at3d60ee9vsmain(8e87fc7).Regression run
Not tested
ID3D12GraphicsCommandList9, Wine / Linux, and multi-hour gameplay beyond the 60 s smoke window.AI use
main, ran the tests andscripts/smoke.ps1on the hardware above, and updated this description. OpenAI Codex (GPT-6) contributed the native root-signature /ExecuteIndirect/ExecuteBundleinvalidation fixes in the earlier revision.@MonkeyPython on GitHub · 2026-11-24 03:45 UTC · original
AMD / wave64 data point (the "Not tested" axis): the console-list tests pass on an AMD Raphael iGPU (RDNA2, native wave64) and on NVIDIA wave32 at this PR's head.
Setup: Windows 11 Pro 26300, Ryzen 7 7800X3D, 32 GB; AMD Radeon(TM) Graphics (Raphael iGPU, 485 MiB, wave64, no mesh shaders) and RTX 3080 Ti 12 GB (driver 621.01, wave32). PR head
487cc5b, release.Runs (
cargo test -p xcl --release --lib list_x::):XCL_ADAPTER=Radeon(iGPU; the selector errors on no match, so a pass means it ran there): 16 passed / 0 failed, 0.20 s.Not tested: long sessions, other titles, the perf claim itself (no retail timing measured here).
AI use: Gentle Shell (Pi coding agent), model qwen4-max: ran the tests and wrote this report from their logs; a human reviews it before posting. No code changes.
@CryingLaughing on GitHub · 2026-11-24 03:47 UTC · original
Tested
487cc5b88cb8f9a8b9096d0d919e318a0e4e1a99with a scratch-only test inbind.rs. NVIDIA GeForce RTX 4080, driver 621.01, Intel Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, debug.XCL_ADAPTER=4080,XCL_REQUIRE_GPU=1, allXCL_SAMPLE_*variables unset.cargo test -p xcl --lib --locked -j 4 --no-run --message-format=jsonand ranhle::d3d12x::bind::tests::pc_root_signature_changes_leave_stale_abi_bindings --exact --test-threads=1 --nocapture. The observation test passed 1/1 with zero skips.bind_abipopulated both cache entries on an adopted native DIRECT list. The probe then called PCSetComputeRootSignatureandSetGraphicsRootSignaturewith a second, distinct native root signature. Both cached values still pointed to the XCL ABI root. A subsequent real PCClearState(None)zeroed both entries and the cached PSO.The cached values after the PC setters still compare equal to the ABI root in
bind_abi, so the next translated bind can skip its root setup and the associated UAV bindings. Invalidating the corresponding cache entry on each native root-signature setter would cover this path. Root comparison in the tested revisionNot tested
AI use
@mastrr9 on GitHub · 2026-11-24 03:54 UTC · original
Code audit + NVIDIA RTX 5080 test run on
487cc5b88cb8f9a8b9096d0d919e318a0e4e1a99:One real bug found in
bind.rsbound_rs_gfxinvalidation inexecute_indirect(crates/xcl/src/hle/d3d12x/bind.rs:235-239):graphics_boundproperly clearss.bound_rs_gfx = 0before binding the title'srs_gfxfor an untranslated pipeline, butexecute_indirecthas the exact same untranslated-pipeline branch (list.SetGraphicsRootSignature(r)) and does not clears.bound_rs_gfx.bound_rs_gfx = abi_rs) -> (2) untranslatedExecuteIndirect(PC list switches tors_gfx,bound_rs_gfxstaysabi_rs) -> (3) translated draw, thenbind_abiseesneed_rs == false, skipsSetGraphicsRootSignature(abi_rs)andu2..u5, and bindsu0/u1against the title's root signature instead.s.bound_rs_gfx = 0insideexecute_indirectwhens.rs_gfx != 0(just likegraphics_bound), and add a unit test case covering that sequence.real.rs:open_uma/uma_window_vas_fast:open_umatemporarily storesUMA_WINDOW_COUNT = 0while updatingUMA_WINDOW_VAS_FAST, during whichuma_window_vas_fast()returns([0; 4], 0)instead of falling back toUMA_BUFFER.lock()likeuma_window_vas()does — harmless whileopen_umaruns once at startup, just worth keeping in mind ifopen_umais ever called concurrently.)Tested
rustc 1.100.0(MSVC), debug build.cargo build --workspace && cargo test --workspace -- --test-threads=4: 692 passed, 0 failed, 41 ignored.hle::d3d12x::bind::tests::bind_abi_caches_root_sig_u2_to_u5_and_pso_across_dispatchesandbinding_cache_flags_invalidate_on_reset_clear_state_and_external_calls: passed.SKIPPEDGPU tests (2, wave32-only adapter):gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64.Not tested
scripts/smoke.ps1run (test suite only).AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.
@eizispark on GitHub · 2026-11-24 04:41 UTC · original
Hardware check of
f84935a76c373563a10dd524f2cd5801c5b20c17(verified clean merge withmain64b3f35): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:694 passed, 0 failed, 41 ignored(GPU tests skipped on this adapter:none)cargo test -p xcl --lib -- --test-threads=1 binding_cache_flags_invalidate_on_reset_clear_state_and_external_calls translated_draw_rebinds_after_indirect_draw_and_bundle bind_abi_caches_root_sig_u2_to_u5_and_pso_across_dispatches stack_sgprs_match_the_padded_heap_payload:4 passed, 0 failed, 0 ignoredRegression run
main(f4ce27c):PR (
f84935a):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.@JoaoPauluu on GitHub · 2026-11-24 04:11 UTC · original · edited 2026-11-24 04:52 UTC
Update: rerun on the new head
f84935a(adds "restore cached ABI bindings after native state changes"), againstmain64b3f35, same setup, alternating base / PR / PR / base:64b3f35f84935aStill no regression. The draw totals vary with how far the title gets in 60 s (one PR run did 42428 draws / 2313 dispatches, the other 12006 / 330), so they don't compare the two builds.
Test report: #667 under Wine (Linux, NVIDIA): GTA VI regression run
A retail-title run of this PR under Wine / vkd3d-proton, base
main63cdc25against head487cc5b. No regression: no device removals or crashes, and frames within the run-to-run spread.Setup
experimental-11.0-20261112(wine-11.0), vkd3d-proton v3.1 (4522cc1a) + the patch from #257, DXVK from Proton, DXC 1.9.2609,DXVK_CONFIG="dxgi.hideNvidiaGpu = False"x86_64-pc-windows-gnu(mingw-w64-gcc 16.2.0), release buildsscripts/linux/smoke.shfrom #257,XCL_NETWORK=0, alternating base / PR / PR / base63cdc25487cc5bThe second PR run did more work in total (984 dispatches against 300–350 in the other three), so the runs did different amounts of work and I don't read a speed difference into the draw totals. The title presents about 60 per 2 s in the steady parts on both builds, so a lower CPU cost per draw wouldn't show in the frame count here.
(The first pair.
peak commit: 0 MBis XCL reading 0 MB committed under Wine, see #257.)Not tested
bind_abi(only frame and draw counts above); the pictureAI use: Claude Code (Claude Opus 5.5) built both commits, ran every run above on the machine above and wrote this report. The blocks and counts are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.
@ryosen0 on GitHub · 2026-11-24 05:16 UTC · original
The red PR description check on
f84935ais the smoke-block head match, not the code (Build and test is green):scripts/pr_check.pyrequires anxcl-smokeblock whosecommit:starts with the live PR head, and the description's head block still names487cc5b— the pre-rebase commit. After the rebase ontodd2ae9athe head becamef84935a, so the check reports "no block for head commit f84935a…".Fix: rerun
scripts/smoke.ps1onf84935a(no uncommitted changes) and replace the second block; the main block (dd2ae9a) is fine as it is. The check reruns on the description edit.AI use: GPT-6.2 Astra (API model selector) in DSH read the check annotations and
scripts/pr_check.pyand drafted this comment; the human contributor reviewed it before posting.@milas6669 on GitHub · 2026-11-24 06:01 UTC · original
Regression run of
f84935a76c37(PR head, built as it is, not merged onto main) againstmaine50836b, on a retail title.Tested
scripts/smoke.ps1 -Seconds 60, the same title and time for both, one run each, main first:main (
e50836b):this PR (f84935a):
What this does and does not say
Not tested
cargo teston this head (I did not run the test suite for this report)AI use
@thehollowedone on GitHub · 2026-11-24 03:56 UTC · original · edited 2026-11-24 07:51 UTC
Tested
I extended the stale-root observation through the next translated compute dispatch on a native D3D12 list. A scratch fixture recorded a translated dispatch, called native
SetComputeRootSignaturewith a distinct empty signature, then recorded the translated dispatch again.mainatf4ce27crecorded both dispatches with zero InfoQueue errors.487cc5bintegrated, the first dispatch was clean. The second reported two out-of-range root UAV bindings (712) and a root-signature/PSO mismatch atDispatch(953).Closestill returned success.Each variant passed its expected assertions.
cargo test --offline --locked -p xcl --lib native_dispatch_after_pc_root_switch -- --nocapture --test-threads=1. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug. The D3D12 debug layer was active and the device stayed healthy.Not tested
GPU execution or readback, graphics root switching, and retail behavior. The fixture recorded and closed the lists without submitting them.
AI use
Codex with GPT-6.2 Sol wrote the scratch fixture, ran the tests, and drafted this report.
GPU readback on the updated head
On
f84935a, I submitted the same compute root-switch sequence on one native DIRECT list. A synthetic ABI-compatible compute shader incremented a coherent output once per dispatch. The fixture used XCL's dispatch hook, a UAV barrier between dispatches, and the native setter to bind a different root signature before recording the second dispatch. After the queue fence, the GPU output was 2 as expected. The D3D12 InfoQueue had zero errors or corruption messages before and after submission.cargo test --locked --offline --release -p xcl --lib native_readback_after_cached_compute_root_switch -- --nocapture --test-threads=1passed 1/1 with zero skips on the same RTX 3080 Ti / 621.35 and Windows 11 build 26300, with DXC 1.8.2502.11 and Rust 1.99.1 MSVC. The scratch fixture used a test-only registration of the synthetic PSO. This checks the compute binding path on the exact PR runtime with Graphics Tools enabled.AI use for this update: Codex (GPT-6, exact variant unavailable) wrote the scratch fixture, ran the test and drafted this update.
@RandomGithub12309 on GitHub · 2026-11-25 00:57 UTC · original · edited 2026-11-25 01:03 UTC
Updated at
3d60ee9(squashed and rebased ontomain8e87fc7):IO_UMA_BASE_HI,heap_windows()setup,KickoffXtarget handling, and mid-list split binding invalidation (inherit_for_split) frommain.xcl-smokeblocks to match the currentmain(8e87fc7) and head (3d60ee9) commits (fixing the stale-headPR descriptioncheck flagged by @ryosen0).@JJAutoCompare on GitHub · 2026-11-25 06:30 UTC · original
Empirical test report (
3d60ee94)Hardware / environment
3d60ee94bd4ae5d37bba44347ff2ce599a7fa5c6, clean detached HEAD.0ef1bc386, stable x86_64-pc-windows-msvc), Cargo 1.100.0, DXC 1.9.2609.5. Unoptimized test profile.Commands and results
cargo test --workspace --no-runoutside the Arc lock. Exit 0.cargo test --workspace --lib --bins -- --test-threads=4 --exact %XCL_PR667_CPU_ARGS%outside the lock withXCL_ADAPTER=NONE_CPU_ONLYandRUST_TEST_NOCAPTURE=1. The variable expanded to 50--skip <full test name>pairs for tests that can initialize hardware outside the adapter gate. Exit 0. Libtest reported 898 passed, 0 failed, 22 ignored and 50 filtered out. The log has 256 case-sensitive^SKIPPEDlines and three additional markers interleaved with test status output. Libtest includes self-skips in its pass count.& $testExe --exact --test-threads=2 $gpuTestsinsideInvoke-ArcTest.ps1, withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1.$testExewas the prebuilt library harnessxcl-77aca8ccb20e299f.exe.$gpuTestscontained:hle::d3d12x::bind::tests::bind_abi_caches_root_sig_u2_to_u5_and_pso_across_dispatcheshle::d3d12x::bind::tests::translated_draw_rebinds_after_indirect_draw_and_bundleExit 0. 2 passed, 0 failed, 0 ignored and 0 skip markers.
Observed behavior
The CPU counts come from the rerun after filtering a texture-mirroring test that initialized the real backend through adapter fallback.
Both new CPU tests passed, covering binding invalidation and padded SGPR payloads. The Arc tests checked dispatch bind counts, draw rebinding and UMA window VA agreement. D3D12.X opened three sparse windows and logged a successful UMA import check.
Not tested
Full GPU workspace suite and game smoke runs.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr667-focused.log and published.
@DavidM1911 on GitHub · 2026-11-25 12:21 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.