Skip to content

D3D12.X: XCL_RT_LEAVE_OUT leaves out named compute programs while rays cannot hit - #3026

Open
VolenNakov wants to merge 7 commits into
xcl-dev:mainfrom
VolenNakov:c3-rt-leave-out
Open

VolenNakov wants to merge 7 commits into
xcl-dev:mainfrom
VolenNakov:c3-rt-leave-out

Conversation

@VolenNakov

@VolenNakov VolenNakov commented Nov 27, 2026 •

Copy link
Copy Markdown

Part of #3011 (C3). Ports Vice-Tay's ray-tracing leave-out: while a title builds no acceleration structure, its ray hit-shading and ray-start compute programs have nothing to do, so they are not translated, compiled or dispatched. Off by default.

XCL_RT_LEAVE_OUT=<fragment>[,<fragment>…]: a console compute program whose shader container holds one of the fragments (at least 6 bytes each) gets the dummy program that an untranslatable console shader already gets, so its dispatches are skipped. The shader preparation and xcl shaders --precompile pass it over. The fragments come from the user, and XCL's source names no title's programs. The program names are in the containers' debug data: xcl rpf <pack> --find <name> lists them.

Why it is safe to leave them out, and how XCL notices when it no longer is: XCL keeps the acceleration structures the title's views name (D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE in the coherent window). Every 300 frames it checks their headers. When one gets a root node (header dword 0x30, as gpu/bvh.rs reads it), it warns once that rays can hit now and that the setting should come off for this title. On main a structure outside the coherent window is given to the shaders as an empty one, so it can produce no hits either.

Upstream and credit: Vice-Tay (https://github.com/TaynanGT/Vice-Tay, GPL-3.0-or-later) 1f69d67, crates/victory-gpu/src/pipeline/make.rs, left_out (VICTORY_RT_RESOLVE, VICTORY_ACTIVATE_RAYS, VICTORY_BVH_BUILDER), added there in codec_d's 8cc31ab. Thanks to codec_d and @TaynanGT, and to @throny for the candidate list. Changes from upstream:

  • the programs are named by the user's fragments, not by names in the source;
  • one switch instead of three;
  • the structure watch and its warning are new;
  • the preparation and the precompile skip the programs too.

What is in it (four commits: the change, +224 / −2; its end-to-end test, +103; a fix found in review, +21 / −8; and the staged corpus, +4 / −1)

  • gpu/rt_leave_out.rs (new): the fragments, the match, the counters and the structure watch, with the provenance header. Unit tests: fragments_are_trimmed_and_short_ones_dropped, a_container_is_matched_by_any_fragment_anywhere, a_header_without_a_root_has_none, a_built_structure_from_the_builder_has_a_root (the watch reads the root XCL's own BVH builder writes).
  • hle/d3d12x/real.rs: dev_create_compute_pso takes the existing failed-console-shader path for a program left out (dummy program, note_console_compute), without the fallback warning. The acceleration-structure SRV path notes the structure.
  • hle/d3d12x/present.rs: the check, next to the 300-frame rate line.
  • shaders.rs: the preparation / precompile loop passes the programs over and prints how many.
  • tests/gpu_compute_e2e.rs: rt_leave_out_skips_the_named_program_and_builds_the_other. Two console compute programs, one with a test fragment in its container. Through the CreateComputePipelineState hook (a child process with the switch set), the named one gets the dummy console pipeline and is not translated, and the other is translated. Through xcl shaders --precompile --pipelines, 1 pipeline is made and 1 program passed over.
  • The fix from review (@fromthemoonx): a desc without a root signature (a title whose containers carry theirs) made the left-out program's dummy pipeline fail with E_INVALIDARG. The dummy now gets XCL's ABI root signature in that case; it binds nothing, and its dispatches are skipped. The end-to-end test covers that desc and fails without the fix with 0x80070057.
  • shaders/pso_corpus.rs: main's staged pipeline corpus (new since the first version of this PR) builds compute pipelines through its own call; a program the switch leaves out is not built there either.
  • README.md: the switch. THIRD_PARTY.md: the Vice-Tay entry.

Tested

off (run 84) on (run 85)
presents/s in the world, mean over ~310–840 s 3.98 5.25
300-frame lines over that stretch 4.1, 4.0, 3.8, 3.8, 3.9, 4.0, 4.3, 4.0 5.1, 5.2, 5.1, 5.2, 5.3, 5.4, 5.3, 6.0, 4.9, 4.9
driver compiles started during the run 957 418
GPU busy in the world (nvidia-smi every 5 s, 200–880 s) 96 % 98 %
peak commit / video memory 31.0 / 12.4 GB 29.7 / 11.9 GB
programs left out (log) – more than 512 (logged at powers of two)
warning "has a root node" – none
errors / removals / GPU wait timeouts 0 / 0 / 0 0 / 0 / 0
  • On this GPU-bound machine, the time the dispatches of these programs took goes to the rest of the frame.
  • A cold off/on pair (D3D12.X: XCL_RT_LEAVE_OUT leaves out named compute programs while rays cannot hit #3026 (comment)): xcl shaders <the pack> --precompile --pipelines from an empty XCL cache at 94fdaa31. With the switch: 8,232 s, 1,005 compute programs passed over, 1,682 pipelines. Without it: more than 18,167 s, still building ray-tracing pipelines when stopped. The switch ran first, so the driver cache favoured the run without it; the saving is a lower bound.
  • Other testers' results are in the comments below: @throny (RTX 4080, nvidia-dev), @pvfreis (RTX 3060, main, cold cache), @fromthemoonx (workspace suite) and @ClosetPie107 (RX 9070, Linux).

Regression run
scripts/smoke.ps1 -Game <the title> -Seconds 60 for both, rerun after merging main (493dbd3d) into this branch, the same title (ea3b5e4d), with XCL_PREPARE=0 for both (without it main's startup preparation runs cold for this build, for hours, beyond the script's startup limit), after an unrecorded warm-up run, so both start from the same cache. The switch is unset: this is the default path, meant to be unchanged.

Why 60 s and not 180 s: a 180 s pair on earlier builds of both showed the PR with 2,294 frames and 30.4 GB of commit against main's 4,573 and 21.2 GB. The logs show both at 28–30 fps through the intro; the PR run (and the warm-up, with the same build) left the intro for the world loading at ~80–100 s and main's at ~170 s, depending on when the scripted presses skip the cutscene. The loading runs at ~6 fps and fills memory, so at 180 s the two runs compared different parts of the game. At 60 s both are in the intro.

main:

xcl-smoke v1
commit: 493dbd3dd0cd50b4c3e8d28f73ab9b504fcd8158
gpu: NVIDIA GeForce RTX 4060 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1563 (PresentX 1563)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 15408 MB

PR:

xcl-smoke v1
commit: d59642d7b463ecfe3a7353e8883f7e7335f282c7
gpu: NVIDIA GeForce RTX 4060 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1545 (PresentX 1545)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 17333 MB

Peak commit differs this time: the PR's warm-up and recorded runs peaked at 18,650 and 17,333 MB, main's three runs of 493dbd3d (warm-up, one recorded run started from the wrong folder, this one) at 15,187-15,408 MB. Both builds were still in the intro at 60 s (~60 presents per 2 s). The previous pair (9d52ec26 vs d8bd9a38) peaked at 15,222 and 15,308 MB; one pair can't tell whether the difference is the merge or the run.

Not tested

AI use

  • Claude Code (Claude Opus 5.5): read Vice-Tay and XCL, wrote the port, its tests and this description, and ran the tests and the runs on my machine. I chose the claim and reviewed the result.

🤖 Generated with Claude Code

@TaynanGT

Copy link
Copy Markdown

@VolenNakov Thanks for carrying the attribution over. The opt-in name matching fits the experiment. Since the title builder can become active during a run, the structure check is important; keep testing the point where a valid root first appears and how that changes the skip decision.

@throny

throny commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Test on nvidia-dev, RTX 4080 16 GB (driver 621.40, 2 GiB shader-heap profile), i9-12900K, Windows 11 26300. Your diff is against main, so I fitted its code by hand onto nvidia-dev 3f39671d with my other test patches (the README / THIRD_PARTY hunks left out; in that tree the compute pipeline body lives in compute_pso, and note_structure went inside the branch that has XCL_BVH_EMPTY). The PR's 4 unit tests pass there. Not your exact head, so take it as a functional check, not as a test of 721121b1.

Same build, same save, warm caches, 600 s each, the switch the only difference (two fragments, derived from the rule in another project's make.rs; XCL_COHERENT_HEAPS=sparse XCL_SPARSE_SYSMEM=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_CS_PSO_WAIT_MS=200 XCL_TWO_PASS_MB=3072):

switch off XCL_RT_LEAVE_OUT set
presents per second in the world (from 240 s after the first frame) 1.75 1.99 (+14 %)
driver compiles finished in the run / time in the driver 721 / 988 s 482 / 7 s
compute programs left out - more than 1,024 (the log line counts in powers of two)
device removals, crashes, pipeline wait timeouts 0 0
process commit / video memory (local) at the end - 45.7 GB / 17.9 GB

So it does what it says here: the cold-compile load of those programs disappears almost entirely (988 s → 7 s of driver time in 10 minutes) and the world gets somewhat faster. The gain in presents is smaller than your +32 %, which fits a card that is GPU-bound elsewhere.

Not tested: the picture (the world is black on this machine on every build, see #505, so I cannot say whether leaving the programs out changes it), a cold cache, a run longer than 10 minutes, whether an acceleration structure ever gets a root node here (the warning did not appear in the log), AMD.

Numbers are from the logs of these two runs. AI use: Claude Code (Claude Fable 5.2) ran the tests and wrote this; a Claude Sonnet 5.5 sub-agent fitted the diff.

@TaynanGT

Copy link
Copy Markdown

@throny The 988-to-7-second driver-time change is a strong result for the nvidia-dev adaptation. Thanks for pinning the revision and scope. Before recommending the switch, I’d compare the same visible scene after a ray structure can be used. That’s the check that can show whether a skipped program changes the picture.

@pvfreis

pvfreis commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Test report for 721121b1 on main alone (one of the gaps in Not tested), empty DXIL cache, 12 GB card. The title did not reach the world on this tree in any run, so this says nothing about world frame rates; what it shows is the switch on the cold start.

Tested

  • RTX 3060 12 GB (driver 617.14, Resizable BAR on), Ryzen 9 5900XT, 32 GB RAM, Windows 11 26300, release build of 721121b1 (on main 06f90c19, nothing else applied), no uncommitted changes.
  • The retail title, Series X profile, XCL_PREPARE=0 XCL_NETWORK=0 XCL_ACTIVITY=1, an empty DXIL cache for every run, the driver's own shader cache not cleared (the same 1,802 files before each run), A pressed every 4 s from 6 to 300 s, 600 s each, nobody at the controller. Four runs of one build in the order off, on, on, off; the switch the only difference. On: the two program-name fragments of Vice-Tay's left_out.
off (run 1) on (run 2) on (run 3) off (run 4)
last present 90 s 95 s 91 s 99 s
frames shown in 600 s 1,407 1,405 1,415 1,472
driver compiles started in 600 s 446 597 651 446
translated compute pipelines created 312 444 504 307
programs left out (log) – 512 to 1,023 512 to 1,023 –
peak private memory 30.3 GiB 30.7 GiB 32.3 GiB 31.1 GiB
crashes / device removals / ExecuteIndirect counts out of range 0 / 0 / 0 0 / 0 / 0 0 / 0 / 0 0 / 0 / 0
  • In all four runs the title stops presenting at 90–99 s and spends the rest of the 600 s creating compute pipelines (the log's driver compile lines run to the end), with almost no dispatches after 300 s. It never reaches the world here, with or without the switch.
  • With the switch on, the log's count of programs left out reaches tests: when the test title does not finish, print the exit code and the log tail #512 by 7.9 s in both runs, and Implement XSystemGetDeviceType/PLS thunks and Opus audio carrier parsing #1,024 is never logged. In the same 600 s the title gets through 597 and 651 driver compiles against 446 and 446 without it, and 444 and 504 translated compute pipelines against 312 and 307.
  • No "has a root node" warning in either on run; since the world was never reached, that is not evidence either way.
  • After 200 s, 106 and 6 translated compute pipelines were created without the switch, 196 and 238 with it.
  • Peak memory is not lower with the switch here.

Not tested

  • Frame rates in the world, and the picture (the world was not reached on this tree).
  • A warm DXIL cache, and a cleared driver cache; the shader preparation on (XCL_PREPARE unset); a tree with the other PRs of your runs.
  • More than two runs per side; AMD.

AI use: Claude Code (Claude Opus 5.5) built the commit, ran the runs on this machine and wrote this report; Claude Fable 5.2 rechecked it against the logs.

@TaynanGT

Copy link
Copy Markdown

@pvfreis These four exact-head runs give us a cold-start reference. The switch completed 444 and 504 translated compute pipelines versus 312 and 307 with it off. World entry, image quality and world frame rate are still open on this setup. I’ll keep those numbers tied to the 600-second startup window.

@fromthemoonx

fromthemoonx commented Nov 27, 2026 •

Copy link
Copy Markdown

Rerun on the new head 9d52ec2 (main d8bd9a3 merged in; the four commits are unchanged): passes on NVIDIA, and the hand-resolved conflict in real.rs keeps the switch's hook.

result
cargo test --workspace --no-fail-fast -- --test-threads=4, 9d52ec2 2623 passed, 0 failed, 49 ignored; 28 SKIPPED lines. main d8bd9a3 here: 2618 passed, 0 failed, 49 ignored
rt_leave_out_skips_the_named_program_and_builds_the_other alone 3 of 3

git merge-tree of 94fdaa3 and d8bd9a3 conflicts in dev_create_srv_inner (the raytracing-structure SRV). The merge keeps main's new body (view_want, XCL_BVH_EMPTY, bvh_want::view_made) and calls rt_leave_out::note_structure(va) where a real structure is written. So with XCL_BVH_EMPTY=1 no structure is noted, which fits rays that cannot hit. Same RTX 3060 (driver 610.88), Rust 1.100.0, debug.


Rerun on the new head 94fdaa3 (rebased onto main e429936, plus the pso_corpus.rs commit): no new failure on NVIDIA. The 9 that fail are main's own here (#3093). No test reaches the new corpus skip.

result
cargo test --workspace --no-fail-fast -- --test-threads=4 (head = merged) 2131 passed, 9 failed, 48 ignored; 25 SKIPPED lines. The 9 are the 3 e2e title tests and 6 split-wave64 GPU tests listed in #3093
rt_leave_out_skips_the_named_program_and_builds_the_other alone 3 of 3
scratch: the new if !rt_leave_out::left_out(&code) in pso_corpus.rs replaced by if true the suite gives the same counts (2131 passed, the same 9 failed), so no test reaches the staged-corpus path with the switch set

Same RTX 3060 (driver 610.88), Rust 1.100.0, debug.


Rerun on the new head 2217336: the no-root-signature case is fixed on NVIDIA too. The extended test passes, and with the fix's block disabled it fails with 0x80070057, as in my scratch run.

result
cargo test --workspace --no-fail-fast -- --test-threads=4, 2217336 (based on 6089122) 1470 passed, 0 failed, 47 ignored; 25 SKIPPED lines
same, merged onto current main 2c717a0 (#3043, merges clean) 1471 passed, 0 failed, 47 ignored; 25 SKIPPED lines
rt_leave_out_skips_the_named_program_and_builds_the_other alone, merged tree 3 of 3
the same with the new if left_out && … pRootSignature … == 0 block disabled (scratch) fails 3 of 3: compute PSO rejected (0x80070057), the fallback version too

Same RTX 3060 (driver 610.88), Rust 1.100.0, debug.


Rerun on the new head 358e420 (rebased onto main 6089122, plus the enabled-path test): passes on NVIDIA, and the new test fails when the hook ignores the switch. The pRootSignature-null case below is unchanged: real.rs and rt_leave_out.rs are the same as on 721121b.

result
cargo test --workspace --no-fail-fast -- --test-threads=4 (head = merged) 1470 passed, 0 failed, 47 ignored; 25 SKIPPED lines
rt_leave_out_skips_the_named_program_and_builds_the_other alone 3 of 3
the same with left_out forced to false in dev_create_compute_pso (scratch) fails 3 of 3: the named program is left out

Same RTX 3060 (driver 610.88), Rust 1.100.0, debug.


Update, on the enabled path TaynanGT asked about: a scratch GPU check (never pushed) through the CreateComputePipelineState hook. With XCL_RT_LEAVE_OUT set, the named program is left out and the next one is still translated and runs correctly. One case differs: with no root signature in the desc, the left-out create fails with E_INVALIDARG.

Scratch test in gpu_compute_e2e.rs on 721121b, same RTX 3060. The test runs itself as a child process, because the switch is read once per process. Two console programs (the wave64 mirror program from console_wave64_compute_through_the_pso_hook_dispatch_and_read_back), one with the marker bytes ScratchLeaveOutMarker appended to its container. 3 runs each:

marked program unmarked program
XCL_RT_LEAVE_OUT=Other_Fragment,ScratchLeaveOutMarker left out: left_out_count() 1, translated_pipelines +0, not in TRANSLATED_COMPUTE translated, dispatched, every thread's output checked; left_out_count() stays 1
switch unset (control) translated (translated_pipelines +1) the same
pRootSignature null, switch set (2 runs) CreateComputePipelineState returns E_INVALIDARG (0x80070057) not reached
pRootSignature null, switch unset (2 runs) created and translated not reached

With the switch set, a left-out program gets the dummy program with the desc's root signature. When the desc has none, the driver refuses it, while the translated program brings its own. A title whose console containers carry their root signature and that passes none would get a failed create for each program left out. I do not know whether #505's title creates its pipelines that way. The nvidia-dev and main title runs above do not mention failed creates.


Full workspace suite on NVIDIA (the PR's Tested has only cargo test -p xcl --lib): passes at the head and merged onto current main. The 4 new tests ran and passed.

Tested: 721121b (its base is main 06f90c1, so head = merged then), and 721121b merged onto current main 81693f0 (#1824, merges clean). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, 16 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug.

cargo test --workspace --no-fail-fast -- --test-threads=4 result
721121b 1462 passed, 0 failed, 47 ignored; 25 SKIPPED lines (no wave64, refused per-lane forms)
721121b + main 81693f0 1464 passed, 0 failed, 47 ignored; 25 SKIPPED lines

From reading: with XCL_RT_LEAVE_OUT unset, rt_left_out returns before it reads the desc, and note_structure / check_structures return at once, so the default path is unchanged. No test reaches the switch's shipped paths: the leave-out in dev_create_compute_pso and the skip in precompile. The new tests cover the helpers (fragments_of, holds_any, root_of).

Not tested: a title, the switch set (on this machine), a release build, AMD / Intel.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

@TaynanGT

Copy link
Copy Markdown

@fromthemoonx The 1,464 passing tests on the merged tree cover the workspace integration. The gap you found is the enabled path. A synthetic check that skips one named compute pipeline and compiles a second one would exercise the PSO and preload entry points before another gameplay comparison.

@ClosetPie107

ClosetPie107 commented Nov 27, 2026 •

Copy link
Copy Markdown

Update for head 358e4207 (rebased onto main f9a0cb80; earlier results for 721121b below). git range-diff: the XCL_RT_LEAVE_OUT commit's code is unchanged apart from comments; the head adds the #880 commit (now in main) and a tests commit. Same machine and setup as below (RX 9070 16 GB / Mesa 26.3.1 RADV / Proton Experimental experimental-11.0-20261112, vkd3d-proton master ec207194 without the allocator / command-list lpVtbl checks, DXC 1.9.2609.5, Rust 1.96.0, x86_64-pc-windows-gnu debug build). The head itself, with main f9a0cb80 the same session as the baseline.

Tests (XCL_REQUIRE_GPU=wave64, --test-threads=1)

  • cargo test -p xcl --lib -- rt_leave_out: 4 passed, 0 failed, 0 ignored.
  • cargo test -p xcl --lib -- recompiler_statistics_count_wave32_by_the_header_flag: 1 passed, 0 failed, 0 ignored.
  • cargo test -p xcl --test gpu_compute_e2e -- rt_leave_out: 1 passed, 0 failed, 0 ignored (rt_leave_out_skips_the_named_program_and_builds_the_other, on the GPU).
  • Lib with --skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole (the first loses the RADV device here, the other two run out of memory under Wine): 1328 passed, 9 failed, 27 ignored; main f9a0cb80 lib the same session: 1323 passed, 9 failed, 27 ignored (--test-threads=1 and two --test-threads=4 runs). All failures are among main's. In the 4-thread workspace run the lib binary ended partway with a device removal (0x887a0005), which main also does here (1 of its 3 four-thread runs). The other binaries fail the same 3 tests as on main here (e2e, pls_quota, predication_e2e). d3d12_resource_and_sync: 3 passed, 0 failed.

Not tested on this head: a retail run (the runs below are for 721121b, whose switch code is the same); native Windows, NVIDIA / Intel.

AI use: Claude Code (Claude Opus 5.5) ran the builds and tests on my machine and wrote this update.


Tested on AMD / Linux: 721121b (RX 9070 16 GB, RDNA4, Mesa 26.3.1 RADV; Ryzen 5 9600X, 32 GB; CachyOS, Proton Experimental experimental-11.0-20261112 with vkd3d-proton master ec207194; x86_64-pc-windows-gnu cross build)

Tests (on 721121b itself)

  • cargo test -p xcl --lib -- rt_leave_out --test-threads=1: 4 passed, 0 failed, 0 ignored.
  • cargo test -p xcl --lib -- --test-threads=4 --skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole: 1,323 passed, 8 failed, 27 ignored. All 8 also fail on main here (main 83b00818: 9 failures, the same 8 plus one in acphal). Skipped tests:
    • compositor_…: RADV loses the device in it on this machine.
    • The two uma_driver tests: under Wine their child processes, which reserve the free address space, use about 23 GB each, and when both run at once the machine runs out of memory.

Retail title, A/B of the switch (the title of #505, same binary, only XCL_RT_LEAVE_OUT differs). The binary is this commit cherry-picked onto main 83b00818 (only THIRD_PARTY.md conflicted; I kept main's), because 06f90c19 changes comments in recomp/emit.rs and so the shader cache identity, and filling the cache again here takes over 40 minutes. Release build, warm cache, XCL_DIRECT_DXIL=1 XCL_PREPARE=1 XCL_PSO_PRELOAD=1 XCL_PSO_WAIT_MS=50 XCL_TEXTURE_LEVEL_PAGES=1 XCL_COHERENT_MB=1024, 300 s, A pressed every 10 s, each run from a fresh copy of the same state, off and on alternating. The fragments named the ray hit-shading and ray-start programs; the title stays in the intro the whole time.

off (3 runs) on (3 runs)
compute driver compiles during the run (start lines) 295–302 78–79
their retries 289–296 75–76
first present ~35 s ~27 s
intro starts drawing (first 2 s with >500 draws) ~45 s 37–39 s
presents, whole run 2,132 / 2,114 / 2,103 2,120 / 1,983 / 2,056
presents 100–200 s 331 / 298 / 276 117 / 80 / 153
programs left out – more than 1,024 (last log line #1024)
"has a root node" warning – none
video memory at 90 s / peak ~10.1 GiB / 16.3 GiB (card full) ~10.1 GiB / 16.3 GiB (card full)
crashes / device removals 0 / 0 0 / 0
sparse: the queue has not reached fence value … after 5 s 0 / 0 / 0 0 / 543 / 147 (from ~210 s, when video memory is full)

So on this card it cuts the compute compiles by about three quarters and the intro starts 6–8 s earlier. It does not raise the present rate in the intro: fewer presents between 100 and 200 s with the switch on (it may only be the title being further along by then; 3 runs each cannot tell). The sparse-queue warnings came only in runs with the switch on, but earlier runs without this PR had a few too (up to 27), so I don't count them as caused by it.

Cold cache, switch on, 1 run (empty XCL shader cache, the same state otherwise): the startup preparation took ~43 min; the leave-out lines came only in its last ~40 s (2,539–2,547 s), and until then it wrote cache files at the same pace as main's cold runs here this morning (~14,300 vs 14,100 at 1,200 s). The first present came at 2,583 s, then the title crashed ~75 s later in ucrtbase.dll+0x171d9 (a write into title memory), which also happens here without this PR. No "has a root node" warning.

Not tested

  • The picture: XCL draws no 3D scene in this intro on this machine with or without the switch, so a missing ray effect would not show.
  • The world (these runs stay in the intro); a cold run with the switch off for comparison (main's cold runs here were stopped after 20 min); more than 3 runs per arm; Windows; NVIDIA.

AI use: Claude Code (Claude Opus 5.5) ran the builds, tests and runs on my machine and wrote this report.

@TaynanGT

Copy link
Copy Markdown

@ClosetPie107 The AMD runs show earlier intro drawing and fewer compiles. The later presents and sparse-queue warnings are the reasons to compare the same scene rather than the same wall-clock window. The cold-cache run also pins down how late the skip begins during preload.

VolenNakov added a commit to VolenNakov/xcl that referenced this pull request Nov 27, 2026
…ecompile

Two console compute programs, one holding a test fragment in its container: through
the CreateComputePipelineState hook (a child process with the switch set) the named
one gets the dummy console pipeline and is not translated, the other is translated;
`xcl shaders --precompile --pipelines` makes one pipeline and passes one over.
Asked for in review of xcl-dev#3026.

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

Copy link
Copy Markdown
Author

Thanks @throny, @pvfreis, @fromthemoonx, @ClosetPie107 for the runs, and @TaynanGT for the review. Updated:

  • Rebased onto main 6089122a. The only conflict was the precompile loop, where main dropped --used-only; the leave-out check sits in the same place as before.
  • The enabled path now has a test, as @TaynanGT and @fromthemoonx asked: rt_leave_out_skips_the_named_program_and_builds_the_other in tests/gpu_compute_e2e.rs. Two console compute programs, one with a test fragment in its container:
    • through the CreateComputePipelineState hook, in a child process with the switch set: the named one gets the dummy console pipeline (is_console_compute, not is_translated_compute, translated_pipelines unchanged, left_out_count 1), and the other is translated;
    • through xcl shaders --precompile --pipelines: 1 pipeline made, 1 program passed over.
  • Tested at the new head, release, RTX 4060 Ti 16 GB (driver 610.88), Windows 11 26200:
    • cargo test -p xcl --lib: 1,340 passed, 0 failed, 27 ignored;
    • cargo test -p xcl --test gpu_compute_e2e: 8 passed, 0 failed, including the new test;
    • the new test fails if the switch is ignored, since left_out_count stays 0.

On the cold preparation (@ClosetPie107's "the leave-out lines came only in its last ~40 s"): the skip applies to each record as the loop reaches it. In this title's pack the ray-tracing records come late in the loop's order, so the saving shows at the end, not as a lower pace earlier. A cold run of mine on nvidia-dev d1be8103 (the diff fitted there, with #2987) showed the same: about 1 h 52 min for 26,503 records, leave-out lines from 6,625 s on. I have no cold run with the switch off to compare yet.

@TaynanGT, on comparing the same scene once a structure can be used: agreed, that is the check that would show a picture change. No run here has reached a point where a structure gets a root node (runs 82–87 here, 10–180 min, no warning), so I can't make that comparison yet. When the warning fires in someone's run, the frame dumps from just before and after it, with and without the switch, are the comparison to make.

Not tested (unchanged): the picture (grey or black world on the testers' NVIDIA trees); a scene with built structures; a cold run with the switch off as a baseline.

AI use: Claude Code (Claude Opus 5.5) wrote the test, rebased, ran the tests and wrote this reply.

@TaynanGT

Copy link
Copy Markdown

@VolenNakov That covers the enabled path I asked for. The hook and precompile both skip the named program and still build the other one. The picture comparison can wait for a run that reaches a usable root on the same revision. A cold off/on pair would give the preload saving its own measurement.

@VolenNakov

Copy link
Copy Markdown
Author

@Lakanya thanks, that is a real limit of the check, and your GPU readback is the better measurement. How it applies to this PR, which targets main:

  • On main the warning reads memory the GPU writes into directly. note_structure is called only where dev_create_srv finds the structure inside the coherent window (uma::get().contains(va)). On main that window is system memory the GPU reads and writes in place (D3D12.X: UMA windows in a driver heap on NVIDIA, 4.9x FPS (0.62 -> 3.03) #2844's CUSTOM write-back heap), so a root the builder writes there is what check_structures reads.
  • A structure outside the coherent window gets no hits on main anyway: that branch writes an empty BVH descriptor (… is not in unified memory – writing empty BVH descriptor), and nothing is noted. So on main, either the warning can see the root, or the shaders are given an empty structure. Leaving the programs out cannot hide hits in that case.
  • On nvidia-dev your point holds. There, view_want makes a structure in a GPU view count as present, and its tiles can live in a sparse window whose GPU writes the CPU does not see. My runs 86–87 here were on such a fit (nvidia-dev d1be8103 + D3D12.X: sparse tiles outside the GPU heaps can live in system memory #2987, XCL_COHERENT_HEAPS=sparse), so their silent warning is no evidence. The main-based runs in the description (82–85) are, for the reason above. Before this goes to nvidia-dev, check_structures should read the header through a GPU readback, like your diagnostic does with sparse::readback_now.

Your readback also answers the gate itself: bottom levels get bounds and a node count, but byte 0x30 stays 0xFFFFFFFF in every structure, and the top level stays nearly empty. So on that tree too the rays have no root to start from, and leaving out the programs that would shade their hits changes nothing.

I'll add a line to the PR description: on trees whose structures can live outside the coherent window, the warning needs a GPU readback.

AI use: Claude Code (Claude Opus 5.5) checked the code paths and wrote this reply.

@TaynanGT

Copy link
Copy Markdown

@VolenNakov The coherent-window check answers the question for main. The sparse path needs evidence from the GPU side before the warning can stand in for a scene comparison there. The enabled-path test still covers the skip decision, and you can keep that result alongside the scope note in the PR.

VolenNakov added a commit to VolenNakov/xcl that referenced this pull request Nov 27, 2026
…when the desc has none

A title whose console containers carry their root signature can create a compute
pipeline with none in the desc. The translated program brings XCL's, but the dummy a
left-out program gets kept the desc's (none), and the driver refused the pipeline with
E_INVALIDARG. It now gets XCL's ABI root signature (it binds nothing; its dispatches are
skipped). The enabled-path test covers a desc without a root signature and fails
without this change with 0x80070057.

Found by @fromthemoonx in review of xcl-dev#3026.

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

Copy link
Copy Markdown
Author

@fromthemoonx thanks, the null-pRootSignature case was a real hole: fixed in 22173361.

  • Fix: a left-out program from a desc without a root signature now gets XCL's ABI root signature for its dummy pipeline. The dummy binds nothing, and its dispatches are skipped, so any root signature does. The desc's own root signature is kept when there is one, as before. Only the left-out path changes; a console shader that fails translation still takes the old path.
  • Test: rt_leave_out_skips_the_named_program_and_builds_the_other now also creates the named program from a desc without a root signature. It passes with the fix, and without it fails with 0x80070057, as in your scratch run.
  • At the new head, RTX 4060 Ti 16 GB (driver 610.88), release: cargo test --release --workspace -- --test-threads=4: 1,470 passed, 0 failed, 47 ignored. The PR's smoke block was redone on 22173361 (5,070 frames against main's 4,789 in 180 s, no removal or crash), and the description is updated.

AI use: Claude Code (Claude Opus 5.5) wrote the fix and the test, ran them on my machine and wrote this reply.

VolenNakov and others added 4 commits November 28, 2026 08:47
…s cannot hit

Port of Vice-Tay's ray-tracing leave-out (crates/victory-gpu/src/pipeline/make.rs,
`left_out`, commit 1f69d67; added in codec_d's 8cc31ab), GPL-3.0-or-later. The programs
are named by the user's fragments (XCL_RT_LEAVE_OUT), not by names in the source. A
watch of the acceleration structures the title's views name warns once when one gets a
root node. The shader preparation and --precompile pass the programs over.

Part of xcl-dev#3011 (C3).

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

Two console compute programs, one holding a test fragment in its container: through
the CreateComputePipelineState hook (a child process with the switch set) the named
one gets the dummy console pipeline and is not translated, the other is translated;
`xcl shaders --precompile --pipelines` makes one pipeline and passes one over.
Asked for in review of xcl-dev#3026.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…when the desc has none

A title whose console containers carry their root signature can create a compute
pipeline with none in the desc. The translated program brings XCL's, but the dummy a
left-out program gets kept the desc's (none), and the driver refused the pipeline with
E_INVALIDARG. It now gets XCL's ABI root signature (it binds nothing; its dispatches are
skipped). The enabled-path test covers a desc without a root signature and fails
without this change with 0x80070057.

Found by @fromthemoonx in review of xcl-dev#3026.

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

main's new corpus preparation (shaders/pso_corpus.rs) builds compute pipelines through
its own call; a program the title's pipeline would leave out is not built there either,
as in the pack precompile.

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

Aniseto commented Nov 28, 2026

Copy link
Copy Markdown

Ran the ray leave-out tests at 94fdaa31 on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib gpu::rt_leave_out:: -- --test-threads=1
4 passed; 0 failed; 0 ignored; 0 measured; 2029 filtered out      (exit 0)

XCL_ADAPTER=NVIDIA cargo test -p xcl --test gpu_compute_e2e rt_leave_out_skips_the_named_program_and_builds_the_other -- --test-threads=1
1 passed; 0 failed; 0 ignored; 0 measured; 7 filtered out      (exit 0)

All four unit tests pass, and the end-to-end test passes: through the CreateComputePipelineState hook the named program is left out while the other is translated. I did not run a retail title with XCL_RT_LEAVE_OUT set, so the structure-watch warning was not exercised. The thread has runs on RTX 4080, RTX 3060 and RX 9070, but no 5070 Ti.

Not tested: a real title with named fragments, the structure watch, a paired smoke run, the full workspace suite and its seven known failures, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

@VolenNakov

Copy link
Copy Markdown
Author

@TaynanGT the cold off/on pair you suggested: with the switch, a first-time preparation of the whole pack took 2 h 17 min; without it, over 5 h 3 min, and it was still building ray-tracing pipelines when I stopped it. So the off time below is a lower bound.

Setup

from an empty XCL cache switch on switch off
total 8,232 s > 18,167 s (stopped, not finished)
translation stage (the loop's time) 6,330 s 8,681 s (+37 %)
programs translated 24,989 25,994
compute programs passed over 1,005 –
GPU pipelines 1,682 made, 0 refused, finished 400 made, 0 refused, after ~2.6 h of the pipeline stage
cache written 4.2 GB 6.4 GB (unfinished)
errors 0 0
  • The switch saves at least 2 h 46 min here, and the off run's pipeline stage was going at ~150 pipelines an hour on the left-out programs when I stopped it.
  • A side finding, not this PR's: the off run logged one direct DXIL fallback stage=CS reason="direct DXIL builder error: instruction after a terminator in block Block(0)" on one of the left-out programs; it fell back to the HLSL path, so the loop counts no error. With the switch, that program is not translated.

Not tested: more than one pair; the off run to its end; a cleared driver cache; another machine.

AI use: Claude Code (Claude Opus 5.5) ran the pair on my machine and wrote this.

main's acceleration-structure SRV path (view_want, XCL_BVH_EMPTY, bvh_want) is kept; the structure is noted for XCL_RT_LEAVE_OUT inside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the area:d3d12 D3D12.X runtime, command lists, resources, sparse memory label Nov 29, 2026
@github-actions github-actions Bot added area:docs-ci Documentation, scripts, workflows, repo governance area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation area:tests Unit, integration, e2e tests, or testtitle gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Nov 29, 2026
@TaynanGT

Copy link
Copy Markdown

Thanks for running the cold comparison. Saving at least 2h46m even with the driver cache favoring the off run is a strong result. The unfinished off run is a lower bound, not a completed benchmark pair.

@VolenNakov

Copy link
Copy Markdown
Author

The red Build and test on 9d52ec26 (run 46256841607) is not this PR's: four of main's own tests in shaders::pipeline_library and shaders::warm_library failed together.

  • The first, builder_deduplicates_names_and_atomically_replaces_output, got 4 entries where it expects 2 (pipeline_library.rs:414). The other three, graphics_pipeline_round_trips_through_serialized_library, mesh_pipeline_round_trips_through_serialized_library and cold_publish_makes_an_unchanged_corpus_reusable, then failed on a PoisonError, the lock the first one left behind. That looks like tests sharing state across test threads.
  • This PR touches neither file. The same tests passed on Shaders: xcl pipelines --shard k/n splits the journal over processes #1826's run on the same main (d8bd9a38), and locally on this head: cargo test -p xcl --lib -- --test-threads=2, 2483 passed, 0 failed.

I can't re-run checks on this repository. Could someone with the rights re-run the failed job?

AI use: Claude Code (Claude Opus 5.5) read the CI log and wrote this; I checked it.

@VolenNakov

Copy link
Copy Markdown
Author

@fromthemoonx thank you for the rerun on 9d52ec26, and for checking the merge in dev_create_srv_inner.

@Aniseto your Blackwell report was on 94fdaa31, before main (d8bd9a38) was merged in. If you have time, a rerun on the current head 9d52ec26 would be the second report on this head. The four commits of the change are unchanged; the merge resolved one conflict, in the acceleration-structure SRV path (note_structure now sits inside main's new body). The red Build and test is main's flaky pipeline_library tests (comment above), not this PR.

AI use: Claude Code (Claude Opus 5.5) drafted this; I checked it.

@Aniseto

Aniseto commented Nov 29, 2026

Copy link
Copy Markdown

Re-ran the ray leave-out tests at 9d52ec26 after the merge of main into the branch; this is a new response in the same thread, not an edit of my earlier report at 94fdaa31: #3026 (comment)

System

  • GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, mesh shaders), driver 32.0.16.2140 (621.40)
  • CPU: Intel Core i5-12400F, 64 GB RAM
  • OS: Windows 11 Pro build 26200 x64
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5
  • Build: debug

Results

  • XCL_ADAPTER=NVIDIA cargo test -p xcl --lib gpu::rt_leave_out:: -- --test-threads=1: 4 passed, 0 failed, 0 ignored.
  • XCL_ADAPTER=NVIDIA cargo test -p xcl --test gpu_compute_e2e rt_leave_out_skips_the_named_program_and_builds_the_other -- --test-threads=1: 1 passed, 0 failed, 0 ignored.

What this adds
The same four unit tests and the same e2e test pass on the merged head, so this is the second report on 9d52ec26 from a Blackwell host. It does not exercise a retail title with XCL_RT_LEAVE_OUT set or the structure-watch path.

Not tested
A retail title, the structure watch, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - ran the commands above on this machine and wrote this report; no game data was used.

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

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head d59642d

Closest open overlap is #2527 (XCL_REFUSE_CS): it also keeps listed compute programs from the driver and skips their dispatches, but selects them by record hash for driver compiles that never end. This PR selects them by container name fragment, adds the acceleration-structure root watch, and skips them in the precompile and staged corpus too. amd-dev already carries a version of gpu/rt_leave_out.rs (plus XCL_RT_LEAVE_OUT_COUNT); main does not.
No problems found in the diff: compute_pso takes the existing untranslatable-console-shader dummy path, and a desc without a root signature gets the ABI root signature.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: 493dbd3
head: d59642d
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2905 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (+344/-3). With XCL_RT_LEAVE_OUT=<fragments> set, compute programs whose names match are left out, and a check warns if rays could hit. Unset, it costs one cached check. Findings: (1) The safety check can't see the structures on current main. Main now also records acceleration structures that sit in the title's GPU-only memory (real.rs ~3291-3306), which the CPU can't read (uma.rs ~474). check_structures skips those silently (rt_leave_out.rs ~171), so the "rays can hit" warning can never fire; the description's argument that main gives such structures an empty one is out of date. #3521 would move build outputs to video memory too. (2) "While rays cannot hit" isn't enforced: programs are left out for the whole process and the check only warns. (3) The ray-start program is left out too. The "no root, no hits" argument covers only the hit-shading programs, so the skipped dispatches' outputs stay stale for later passes (unverified that any read them). (4) The structure list never forgets an address, so reused memory can raise a false warning. A program seen by both startup preparation and pipeline creation is counted twice. (5) The branch carries three merges of main and a separate fixup commit for the root signature; CONTRIBUTING asks for a rebase and squash. Fine: dispatch and ExecuteIndirect skips go through the existing paths (bind.rs ~3772, ~4788), the null-root-signature case is fixed and tested, and the end-to-end test fails when the switch is ignored. #2527 (XCL_REFUSE_CS, by hash) overlaps. The smoke below is the unset default path, run to check the +12.5 % peak commit in the PR's own pair; the diff has no cause for it.
performance: 60 s smoke of a retail title, main 493dbd3 vs this merge (d59642d): 1670 -> 1689 frames shown (101 %; last presents per 2 s: 61 60 60), peak commit 17083 -> 17033 MB, 0 device removals, 0 crashes. Unset default path only. The first run of this merge reached 18878 MB peak commit before its lib tests hit an unrelated abort; this rerun is 17033 MB, so the +12.5 % peak in the PR's own pair looks like run-to-run variation rather than this diff.
verdict: not yet: the "rays can hit" check can't see the acceleration structures main now records in GPU-only memory, so its warning can never fire (finding 1); and the branch needs a rebase with the fixup squashed (finding 5). Default path: no change
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

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

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:docs-ci Documentation, scripts, workflows, repo governance area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation area:tests Unit, integration, e2e tests, or testtitle gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants