Repository navigation
Shaders: make static-sampler root signatures first, in one order - #2326
CowboyBingus wants to merge 1 commit into
Conversation
`xcl shaders --precompile --pipelines` now translates the compute programs first, writes the distinct static-sampler sets of the programs it translated (and those of an earlier file), sorted, to `sampler-sets.txt` in the DXIL cache, and makes those root signatures before any pipeline, in the file's order. At device creation the runtime reads the same file from its DXIL cache, makes the same root signatures in the same order, and keeps them in `ABI_RS_SAMPLERS`, so pipelines with one of these sets use them. A set that is not in the file is still made when a pipeline first needs it. Measured on an RTX 5070 Ti with XCL's blob files off (XCL_PSO_DISK_CACHE=0), with an earlier local version of this change (XCL_SAMPLER_REGISTRY=<file>, on main 689f2db plus three other PRs and local changes, largest-first pipeline order): after a full prebuild and two title runs that all made these root signatures in one order, two prebuilds were each stopped early. With that order, six compute pipelines with three static samplers took 14.9-33.9 ms each; with the reverse order, the same six took 27.9-73.2 s each. Part of xcl-dev#2088. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent Radeon and RTX 5090 sampler-order check of Tested
Not tested Cold driver-cache timings, retail shader packs, retail smoke and the full workspace suite. AI use OpenAI Codex (GPT-6.2 Sol) ran the checks and wrote this report. |
|
@nnonno91 thanks for running the tests on both cards. AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
Tested: current PR head merged onto current
No new tests in the PR; the suite result is the whole data point: nothing regresses on the Wine lane with the static-sampler sets made first. Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
@SlopTart thanks for the Wine/RADV run. One correction: the PR does add two tests, AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
xcl shaders --precompile --pipelinesnow writes the static-sampler sets of the compute programs it translates (and those of an earlier file), sorted, tosampler-sets.txtin the DXIL cache, and makes their root signatures before any pipeline, in the file's order. At device creation the runtime makes the same root signatures, in the same order, from that file and uses them for every pipeline with one of these sets. Part of #2088 (plan in this comment).Why: measured on an RTX 5070 Ti with XCL's blob files off (
XCL_PSO_DISK_CACHE=0), with an earlier local version of this change (XCL_SAMPLER_REGISTRY=<file>, on main 689f2db plus three other PRs and local changes, largest-first pipeline order). After a full prebuild and two title runs that all made these root signatures in one order, two prebuilds were each stopped early. With that order, six compute pipelines with three static samplers took 14.9 to 33.9 ms each; with the reverse order, the same six took 27.9 to 73.2 s each (the only 6 creates that run logged before its 150 s limit).Related: #1420 (XCL's blob file name by sampler state, a different problem). #2290 turns more S# words into static samplers: the sets in the file are taken from the programs each prebuild translates, and a set that is not in the file is still made when a pipeline first needs it, as before.
What is in it
crates/xcl/src/gpu/recomp/pso.rs:SAMPLER_SETS_FILE,sampler_key,sampler_sets_text(sorted, each set once),parse_sampler_sets, andsampler_set_signatures, which makes the file's root signatures in file order. Unit test of the writer and the reader.crates/xcl/src/shaders.rs: with--pipelines, the pipelines are made after all programs are translated.Pipelines::first_signatureswrites the file (this pass's sets plus those of an earlier file) and makes those root signatures first;make_allthen makes the pipelines onXCL_PIPELINE_THREADSthreads. GPU test: the pass writes the file and makes the root signatures in the same order assampler_set_signatures, the function the runtime calls.crates/xcl/src/hle/d3d12x/real.rs:make_sampler_set_signaturesat device creation puts them inABI_RS_SAMPLERS;abi_rs_forusessampler_key.README.md: the file and what it does.Tested
d65ae60on main06c9f55.cargo build --workspace(debug) andcargo build --release -p xclbuild.cargo test -p xcl --lib sampler_set -- --nocapture: 2 passed, 0 failed, 0 ignored; noSKIPPEDline in the output (runner::skip_testprints one when there is no D3D12 device).cargo test -p xcl --lib -- shaders:: recomp::pso::: 31 passed, 0 failed, 1 ignored.cargo test -p xcl --lib -- pipeline_cap_tests finish_two_pass: 3 passed, 0 failed, 0 ignored.cargo test --workspace --no-fail-fast -- --test-threads=4: 23test resultlines, 1,262 passed, 5 failed, 46 ignored.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3(CreateComputePipelineState: Not enough memory resources are available to complete this operation. (0x8007000E), seeds 70, 545, 1019, 1507) andhle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory(assertion atkernelx.rs:2328, left 0, right 1).06c9f55:cargo test -p xcl --lib -- fuzz_validate_and_gpu xmem_virtual_query_marks_cpu_readable_memory: 0 passed, 5 failed.SKIPPEDlines: 21no wave64; 3 inlower_dxil::testsper-lane forms,refused (unsupported V_MUL_F16 …),(unsupported V_PK_MUL_F16 …)and(unsupported V_CVT_F16_F32 …); 1no heap windows(heap_window_out_of_memory_falls_back_to_the_switch_form).exe\xcl.exe(sha256 3be124…), which the session log records as built after commite723784(this change on main1a0bbe3). Frome723784(parent1a0bbe3) to the head (parent06c9f55),git range-diffshows: the commit message, the README bullet, one doc comment inpso.rs, one context line inpso.rsthat main changed, and the GPU test setting thedispatch_chainfield that Recompiler: split large direct compute pipelines at CFG edges #2080 added toCompiled.exe\xcl.exe, sha256 3be124…) at one exe path, built after commite723784per the session log, withXCL_PSO_DISK_CACHE=0(XCL's blob files off),XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=1and a newXCL_DXIL_CACHEfolder in all three:xcl shaders <pack> --precompile --only cs --pipelineswithXCL_PIPELINE_THREADS=8: compiled 2,689, errors 0; pipelines made 2,689, refused 0; 85 static-sampler root signatures made first; wall 2,945.8 s.sampler-sets.txthad the same SHA-256 after both passes.85 static-sampler root signatures made firstlogged at 0.470 s. 474 compute pipeline creates logged; 2 took 1 s or more (5,278 ms and 4,791 ms, started at 64.9 s and 70.8 s). The translation-cache files of both programs were written during the title run, not during the prebuilds (31 compute translation files were written during the run). 1 graphicsdriver compile finishline, 2,566 ms. The last 2-s activity window with presents is logged at 62.0 s.mainfor comparison: release build (sha256 ca17a157…), built from1a0bbe3per the session log, at its own exe path,XCL_PSO_DISK_CACHE=0,XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=1, its own newXCL_DXIL_CACHEfolder holding a copy of theused-pipelines.txtwritten by the PR's title run above. Earlier, a full-pack prebuild with XCL's blob files on, at the same exe path and into another DXIL cache folder, ended with exit code -1 after 1,692.4 s without a summary line (last progress line: 1,575 pipelines made, 0 refused).xcl shaders <pack> --precompile --only cs --pipelines --used-onlywithXCL_PIPELINE_THREADS=8: compiled 445; 2,244 compute programs passed over; pipelines made 445, refused 0; wall 610.2 s.driver compile finishlines of 1 s or more, 42 are programs whose translation-cache files the prebuild wrote. The last 2-s activity window with presents is logged at 70.1 s.XCL_PSO_DISK_CACHEat its default (on): the sameexe\xcl.exeand DXIL cache folder as the PR's runs above, other settings as there.pipelines loaded from the driver cache 88(XCL's blob files; the folder that holds them was created during this pass); 85 static-sampler root signatures made first; wall 10.0 s.driver compile startlines: 207 withdriver blob supplied, 2 withdriver blob absent. 14 graphicsdriver compile finishlines, 11 of them 1 s or more (max 10,179 ms). The last 2-s activity window with presents is logged at 72.1 s.Regression run
main
1a0bbe3:this PR's head
d65ae60:Both smoke runs used the default DXIL cache (no
XCL_DXIL_CACHE); neither log has astatic-sampler root signaturesline.Not tested
mainwithXCL_PSO_DISK_CACHEat its default (on); its full-pack prebuild ended with exit code -1 after 1,692.4 s.mainafter a full-pack prebuild with blobs off (it was compared after a--used-onlyprebuild).d65ae60(only the smoke run above).AI use
🤖 Generated with Claude Code