Skip to content

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

Open
VolenNakov wants to merge 1 commit into
xcl-dev:mainfrom
VolenNakov:c3-rt-leave-out
Open

VolenNakov wants to merge 1 commit into
xcl-dev:mainfrom
VolenNakov:c3-rt-leave-out

Conversation

@VolenNakov

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; 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 unified memory). 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. Unlike VIctory, XCL runs the title's own structure builder (XboxBvhBuilder.dll), so this is a real check and not a formality.

What is in it (one commit, +224 / −2, about half of it the new module and its tests)

  • gpu/rt_leave_out.rs (new): the fragments, the match, the counters and the structure watch, with the provenance header. 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 that 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.
  • README.md: the switch. THIRD_PARTY.md: the Vice-Tay entry.

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.

Tested

The gate first (a local probe, not in this PR, logging the structures the views name every 300 frames, 900 s): the title names 5 acceleration structures from about 170 s in the world. None ever has a root node, so every ray misses. One disassembled hit-shading program contains no image_bvh*_intersect_ray: these programs shade hits that tracing programs found; they do not trace.

A/B, back to back, nobody at the controller, same build, the switch the only difference:

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.
  • An earlier single run with the switch on, where a person played part of the time, showed the same pattern for 4 minutes (6.1–6.3 against 4.4–4.6 fps) and no warning either.

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 runs on my machine. I chose the claim and reviewed the result.

🤖 Generated with Claude Code

…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>
@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.

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.

2 participants