Shaders: -O0 compiles leave out DXC's debug no-ops #1932
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!1932
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1932/head"
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?
@Royalflamejlh on GitHub · 2026-11-24 23:41 UTC · original
Royalflamejlh:shader/o0-no-debug-nops→main· +18 −1 · 1 files · 1 commits · merged 2026-11-25 02:02 UTCdxc.rscompiles sources over 8 MB at-O0, and at that level DXC adds loads ofdx.nothing.aas no-ops for its debugger. In one 12.5 MB compute program of a retail pack that is 197,453 of the 780,095 instructions in its DXIL. Such sources are now compiled with-opt-disable debug-nopsas well. The six programs of that pack that are over 8 MB come out 22.7 % smaller; DXC's time was measured for one of them only (79 s with the option against 70 s, below). Part of #1269.Everything under 8 MB is compiled as before. The larger a program's DXIL, the longer the driver takes over it, and on Linux dxil-spirv before it.
What is in it
crates/xcl/src/gpu/recomp/dxc.rs,compile_here:-O0comes with-opt-disable debug-nops. One test,a_source_compiled_at_o0_has_no_debug_noops: the same shader padded past 8 MB compiles to the size it has with the option given by hand, not to its size at a plain-O0. It fails without the change, and it skips on a DXC that gives the same size either way (one that does not know the name).Tested
b937c33:f34ef26without four comment lines. The numbers below were taken onf34ef26, or onc29f7cfwhere it says so.x86_64-pc-windows-gnu.main(689f2dbfor four of them,20cf130for the 88,863- and the 44,430-instruction ones, which are byte-equal on both; no recompiler file changed between the two) and once with the change,xcl shaders <folder with one record> --precompile --only cs --split 1, from an empty cache, HLSL path:mainmain, 79 s with the option (one compile each, on a shared machine).--precompile --only cs --limit 22600 --split 1(443 compute programs, none over 8 MB) wrote the same 436 DXIL files onmain20cf130and onf34ef26, 76,597,968 B, equal file by file by SHA-256. One pass each.f34ef26, debug) the new test passed by comparing sizes, not by skipping: that DXC knows the switch too.cargo test --workspace --release --target x86_64-pc-windows-gnu --no-fail-fast -- --test-threads=8under Wine with Mesa's CPU Vulkan driver only, so every GPU test printedSKIPPED(265 such lines on each tree): 973 passed, 4 failed, 45 ignored onc29f7cf(the head before the test learned to skip;f34ef26differs from it only in that test and a comment, and the test passes there); 972 passed, 4 failed, 45 ignored onmain20cf130. The same four fail on both:disk_free_space_ex_reports_pls_quota,test_title_runs_and_game_folder_is_untouched,gpu_depth_buffer_created_for_unordered_access_is_placed,directed_reference_basics. The new test: 1 failed without the change, 1 passed with it.Regression run
Native Windows, RTX 5070 Ti, the retail title, 60 s.
mainwas run twice, before and after the head: 1,024 frames and 16,535 MB the first time, and the block below the second time. The head's block is its only run; the head before it (f34ef26) showed 1,640 frames. So the firstmainrun was the odd one, and the difference is between runs, not between the trees.main (
20cf130):PR (
b937c33):Not tested
-O0, and forXCL_DIRECT_HUGE=0.-opt-disabletakes a name it does not know without an error (tried with a made-up name on 1.9.2609.5), so a DXC without the switch would compile as before, and the test skips there.AI use
@nnonno91 on GitHub · 2026-11-25 01:01 UTC · original
Tested
Independent Windows/D3D12 check on
b937c3373af532f8f09f57a731e166378ed829de. Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62), and GeForce RTX 5090 (32.0.16.1742). Rust 1.100.0 x64 MSVC, unoptimized dev/test profiles with debug info off, and Windows SDK DXC 1.8.2502.11.cargo build --workspace --lockedpassed.cargo test --locked -p xcl --lib gpu::recomp::dxc -- --test-threads=4 --show-outputpassed all 15 tests, with 0 failures, 0 ignored, and no skip messages. This includes the new debug no-op test.cargo test --locked -p xcl --test debug_noops_gpu_probe -- --exact oversized_debug_noops_preserve_gpu_outputs --test-threads=1 --nocapturepassed once on each adapter, with 0 failures, 0 ignored, and no skips. This temporary probe compiled the samecs_6_6compute shader with a comment padding it to exactly 8 MiB or one byte above. It uses 128 unsigned arithmetic steps per lane and writes one word per lane viau2. All five compiled variants validated, and each variant returned all 128 expected values on each GPU. The expected values were computed independently in Rust.-O1-O0-O0 -opt-disable debug-nopsThe automatic and corresponding explicit modes produced byte-identical DXIL at each input size. For the larger input, the output was 484 bytes smaller (9.2%) than the plain
-O0control.Not tested
Full workspace test suite, real-title smoke runs, gameplay performance, and other DXC versions. The input size was created by padding a synthetic shader with a comment.
AI use
OpenAI Codex (GPT-6 family, exact variant unavailable) prepared and ran the temporary probe, checked the output, and drafted this report.
@WebIdentity1 on GitHub · 2026-11-25 01:01 UTC · original · edited 2026-11-25 01:04 UTC
This adds an Ampere cost comparison to @nnonno91's new AMD/RTX 5090 correctness report.
Native RTX 3090 check of the affected automatic
-O0path: parent20cf13022f764208384c610c2ae6a3f4eed201a2against headb937c3373af532f8f09f57a731e166378ed829de, each with the same synthetic diagnostic appended torunner.rs.The fixture contains 1,024 dependent arithmetic/memory/conditional steps, 64 threads, and a CPU
u32oracle. Active HLSL is 125,528 bytes, padded with spaces to 8,388,609 bytes to select the real automatic policy. This tests that policy and GPU execution; the padding does not model the complexity of an 8 MiB retail shader. No game data.Tested — Windows 10 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74, Rust 1.98.1 MSVC, DXC 1.8.2502.11, debug host build:
XCL_DIRECT_DXILunset; both versions usedxc::compilewith empty explicit arguments, so the runtime's source-size policy supplies the options. Three uncached DXC calls per fresh test process, baseline then PR; nine GPU timestamps per version (one 64-thread group, no uploads/PSO creation/CPU waits in the timestamp).Both runs: 1 passed / 0 failed / 0 ignored, zero skips. Both 310-file manifests matched before/after and both builds recompiled XCL. Process peak commit includes the fixture, worker and retained DXIL; it is not DXC-exclusive allocation. The timing/commit differences are observations from one ordered pair, not a general speedup estimate.
Cold driver timing unavailable:
ShaderCacheControl(DISABLE)returned0x887A002Don both. The diagnostic therefore did not run or report cold PSO measurements; no settings were changed to work around that.Not tested — retail shader complexity, native AMD, full workspace suite, retail smoke, cold driver cost, or world-load improvement. The smaller DXIL preserves output and shows no dispatch slowdown for this fixture. It does not resolve the description's open question about cold driver cost on the large retail shaders.
AI use — Codex (GPT-6) reviewed the change, wrote the diagnostic/CPU oracle, ran the native comparison and prepared this report.
Reproducible synthetic diagnostic (78 added lines, test-only)
@DavidM1911 on GitHub · 2026-11-25 02:41 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!