Repository navigation
Conversation
Every translated program carried PRELUDE and PRELUDE_MEM whole: 91 helper functions, about 31 KB, of which a program calls a few. The DXIL cache is keyed on the HLSL, so a change to any one helper changed the key of every program and a title recompiled all of them: xcl-dev#587 (frexp_mant), xcl-dev#2334 (msad_u8, pk_sad_u16) and xcl-dev#2247 (rla) each did on the retail pack. finish() now puts placeholders where the two preludes go and replaces them with the globals and only the functions the program reaches: those named outside the two preludes and, in turn, those the kept functions name. A name counts wherever it appears as a word, so a stray match keeps a function it need not, never the other way round. DXC drops unreached functions, so the DXIL does not change. Measured on a retail shader pack (26 698 programs), main b49be18 against this commit: `xcl shaders --recomp` gives the same report (same programs translated, same refusals). 671 of its programs dumped by both (one in 40) and compiled with dxc.exe with the same flags: 671 / 671 byte-identical DXIL. Their HLSL is 6.6 % smaller (27.6 % for the 439 under 200 KB). Of those 671, frexp_mant and pk_sad_u16 are now in none (before: all 671) and rla in 487. Two pixel shaders drop below the 1 MiB line where XCL picks -O1, so DXC compiles them at -O3: 0.5 s more each, 0.2 - 1 % smaller DXIL. gpu_mad_nf_f16_rounds_intermediate_in_binary16 calls mad_nf_f16 in code it adds to a translation; it now adds the definitions with it (missing_prelude_functions, test only). Assisted-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
RDNA4 / Wine check of the HLSL prelude pruning, including byte comparisons with the current main. Tested
Results
Eleven original GPU tests were then run serially in three fresh processes per source copy, alternating source order. Each process: 11 passed, 0 failed, 0 ignored. The set covers frexp f32/f16 sign handling, f64 exponent/mantissa, f32 denorm modes, QSAD/MQSAD, integer multiply/shift/BFE, format packing/saturation, global/LDS atomics, permlane/WQM and the f16 intermediate-rounding probe changed in this PR. Native wave64 ran; the tests that explicitly request wave32 also ran. From those GPU processes:
The atomic fixture deliberately does not initialize its LDS counter. Its 64 All summaries, skip checks, captured files, source inventories and executable hashes were independently verified. Build: Inherited Not tested Retail inputs, AI use OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, added the local observation hooks, ran the original tests on all three source copies, independently verified the evidence and drafted this report. Publication authorized by the account owner. |
|
AMD run with native wave64 (listed as untested), and an RTX 3060 in the same PC: no change from Tested: pass, head
On both cards the only result changes are the two new tests, Not tested: the retail shader pack or a title on AMD, AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report. |
|
Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2827 at Setup
Targeted RTX 4060 release unit & GPU tests (
|
…eludes reachability + split/whole round-trip tests)
Every translated program carries
PRELUDEandPRELUDE_MEMwhole – 91 helper functions, about 31 KB – and calls a few of them. The DXIL cache is keyed on the HLSL, so changing any one helper changes the key of every program, and a title then recompiles all of them, whether or not they use that helper. #587 (frexp_mant), #2334 (msad_u8,pk_sad_u16) and #2247 (rla) each did this on the retail pack. A program's HLSL now contains the globals and only the prelude functions it reaches. Changing a helper then recompiles only the programs that use it. DXC drops unreached functions, so the DXIL does not change. Part of #1269 and #2088.What is in it
crates/xcl/src/gpu/recomp/emit.rs:finishputs placeholders where the two preludes go.with_preludesreplaces them with the globals and the functions the program reaches: those named outside the two preludes, and in turn those that the kept functions name. A name counts wherever it appears as a whole word, so a stray match keeps a function it does not need, never the other way round.prelude_itemssplits a prelude into its functions, each with the comment lines above it, and the rest. Unit tests: the split puts the prelude back together exactly and finds every braced block; a program gets the functions it reaches and their dependencies, no others, and the globals; a program that names every function gets the preludes whole.crates/xcl/src/gpu/recomp/tests.rs:gpu_mad_nf_f16_rounds_intermediate_in_binary16adds calls tomad_nf_f16to a translation. RDNA2 has no instruction that emits it, so the test now adds the definitions it needs with the probe (missing_prelude_functions, test only). Its assertions are unchanged.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4: 1437 passed, 0 failed, 47 ignoredV_CVT_F16_F32,V_PK_MUL_F16,V_MUL_F16), andpso_measurement_compiles_an_exact_synthetic_record("cannot disable the driver cache", no Developer Mode)xcl shaders --recomp: the same report from both (the same programs translated, the same refusals); the whole pass took 544 s on main and 553 s here (one run each, run at the same time).XCL_DUMP_HLSL,XCL_DUMP_EVERY=40: 671 programs, all stages) and compiled withdxc.exe1.8.2502.11 with the same flags: 671 / 671 byte-identical DXIL.dxc.exeat a time: 18.3 s → 17.4 s (5 % less).frexp_mantandpk_sad_u16are now in none (before: all 671), andrlais in 487.-O1, so DXC compiles them at-O3instead: 0.5 s more each, 0.2–1 % smaller DXIL.Regression run
The retail title on the RTX 3070 Ti, each run after a warm-up run of the same build:
Not tested
HANDOFF.mdnotes that a prelude change makes every title recompile (e.g. "Prelude changed: titles recompile"). After this PR that holds only for the programs that use the changed function.AI use
🤖 Generated with Claude Code