Shaders: precompile the compute passes of console mesh shaders #2236
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2246"
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?
Imported from ivall/xcl. Originally posted by MacieGx on 2026-11-25T11:12:40Z.
xcl shaders --precompile --pipelinesbuilt driver blobs for console compute shaders only. The compute pass of a console mesh shader (the two-pass path,real::finish_two_pass) was always compiled by the driver in the game. In the newer retail title (#505), whose world is drawn by thousands of console mesh pipelines, that was 3–9 s per pass on an RTX 5080, one at a time, while its draws were skipped. With this,--precompilemakes those passes too and keeps their blobs where the runtime looks for them. Part of #505.What is in it
crates/xcl/src/gpu/recomp/pso.rs:console_mesh_in(blob, ps, split, windows), the body ofconsole_meshwith the memory windows passed in;console_meshcalls it withmem_windows(), so the runtime is unchanged.crates/xcl/src/shaders.rs:--precompiletreats an MS the runtime builds in two passes like a CS. It translates it throughconsole_mesh_inwith no pixel shader (the compute pass does not depend on it, so its DXIL is the runtime's).--pipelinesit builds the pass with XCL's ABI root signature and the pass's static samplers, through the existingmake_with_cache_path(soXCL_PIPELINE_THREADSandXCL_PIPELINE_MAX_KBapply), and keeps the blob atreal::two_pass_compute_blob_path.--only msbuilds those alone.--sample Nstops after the first N programs--onlylets through (the option--directalready has; its default of 200 stays for the direct sweep).--used-onlypasses MSs over: a mesh pipeline's used key includes its PS, so the MS alone does not identify it.Pipelines::makeis now used only by tests (#[cfg(test)]); precompile callsmake_with_cache_path.crates/xcl/src/hle/d3d12x/real.rs:two_pass_compute_blob_pathis the filefinish_two_passreads. The pass's blob is now looked up before the huge-pipeline gate, and a pass with a blob no longer counts towards the gate's size (it is made in milliseconds).README.md: the--only msline.shaders::tests::an_ms_compute_pass_is_precompiled_under_the_runtimes_key. For no split / 4 windows, split / 4 windows and split / heap windows: the precompiled DXIL and static samplers equal what the runtime builds with a PS, and the blob path equalstwo_pass_compute_blob_path.console_meshwithmem_windows()gives the same pass asconsole_mesh_in, and a CS and a PS are not taken for mesh shaders.Tested
main8b957bec(nowb9f252e, no change to the code besides the rebase). The counts below are from949609b, before the rebase; the suite has not been rerun onb9f252eyet.stable-x86_64-pc-windows-msvc, release. On949609b(this PR, rebased ontomain6d12f58).cargo test --release -p xcl --lib shaders::on949609b: 11 passed, 0 failed, 0 ignored (the new test passed;pso_measurement_compiles_an_exact_synthetic_recordSKIPPED: the driver cache cannot be disabled without Developer Mode).cargo build --release --workspace && cargo test --release --workspace --no-fail-fast -- --test-threads=4on949609b: 1420 passed, 4 failed, 46 ignored.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState: out of memory (0x8007000E)), which fail onmainas well.rerouted_disk_entries_follow_the_direct_translatorandpc_resource_desc_strips_uav_on_unsupported_formats_and_msaa, reported in the comments, are not in this diff; they failed on the oldermainc9a5d58without this change and pass in the run above.main): 21 "no wave64" (recomp::lower::tests×4,recomp::lower_dxil::tests×14,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,dxil::kernel::dispatch_chain_native_wave64_builds_whole), 3 "refused by the per-lane form",heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record.xcl shaders <the title's shaders.rpf> --precompile --only ms --pipelines --sample 50(on8d49cf1, before this rebase): 50 compiled, 0 errors, 50 pipelines made, 0 refused, 8.1 s.main(where the title reaches its world), the same change made 9282 compute passes in 25 min (--only ms --pipelines). There, blobs that game runs had kept were found by the precompile under the same files (11 of the first 50), which shows that the two keys agree.Regression run
main:
this PR: pending for the rebased head. Since #2624 a PR that changes the translator first prepares all ~26,500 shaders with a cold cache, about 70 min on this machine before
smoke.ps1sees the title start; I'll add the block after that run. Anyone with the title is welcome to runscripts/smoke.ps1on this head and post the block.Not tested
--only msrun onmainitself.AI use
mainand ran the whole suite and the sample precompile.🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by itsSio on 2026-11-25T11:36:31Z.
Tested
Independent debug check on clean
696a222a597cfe1f3e86db9d0c2b732f8177156f. Windows 11 Pro 26200 on both PCs, x64 MSVC, unoptimized dev/test profiles with debug info off.cargo build --workspace --lockedpassed on both.cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocaptureexited 101 on both:SKIPPED32.0.16.108832.0.16.1088Both logged 20 native-wave64 skips, three per-lane f16/f32 refusals, unavailable driver-cache control and unavailable heap windows. The RTX 2080 SUPER also logged two tests skipped for the missing D3D12 debug layer.
cargo test -p xcl --lib --locked shaders::tests:: -- --test-threads=1 --nocapturegave 8 passed / 0 failed / 0 ignored on each RTX card and on the Radeon RDNA2 iGPU (driver32.0.21043.5001, Ryzen 7 system). This includedan_ms_compute_pass_is_precompiled_under_the_runtimes_key. On each adapter, the driver-cache measurement logged one runtimeSKIPPED, and the optional pack test did no work becauseXCL_SAMPLE_RPFwas unset.The two workspace failures were
rerouted_disk_entries_follow_the_direct_translator(68 instead of 1) andpc_resource_desc_strips_uav_on_unsupported_formats_and_msaa(format 85, got 28). Both match the previously independently reproduced assertions on5478c4a7(evidence); that was not an exact-parent comparison for this PR. The workspace results above remain failing.Not tested
Retail smoke, a full
--only mspack run, full AMD workspace, Intel, or performance.AI use
Ran via Samaritan:
openai/gpt-6.2-sol): ran the independent checks, verified logs on both PCs and wrote this report. No subagents contributed to this check.upstream-sync referenced this pull request2026-11-25 14:08:43 +00:00
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T16:23:25Z.
amd-win test report — 2026-11-26
Tested
Clean PR head
949609b2ee210e68ed28ac8197a4a9e5d0a52dfeand its exact parent6d12f58a229bc73889878a448c64dc3af25eeba0. Debug builds on AMD Radeon RX 7800 XT (driver32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 Pro build 26200, Rust 1.100.0 MSVC x64, and DXC/DXIL 1.8.2502.11.cargo build --locked -j 4 --workspacepassed on both revisions.cargo test --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 --nocaptureexited 101 on both withXCL_ADAPTER=Radeon RX 7800 XT,XCL_PSO_DISK_CACHE=1, a freshXCL_DXIL_CACHEper revision, and noXCL_SAMPLE_*inputs.Both runs failed
gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1at seed 722 (res[30]was0x1on the GPU and0x7fffffffon the CPU). Both logged the same six unsupported per-lane f16/f32 notices and one unavailable heap-window notice. The harness counted the three tests that emitted these notices as passed.On the head,
cargo test --locked -j 4 -p xcl --lib an_ms_compute_pass_is_precompiled_under_the_runtimes_key -- --test-threads=1 --nocaptureran in two separate processes with fresh cache directories:XCL_PSO_DISK_CACHE=1: 1 passed, 0 failed, 0 ignored, 0 skip notices.XCL_PSO_DISK_CACHE=0: 0 passed, 1 failed, 0 ignored, 0 skip notices. The fixture failed atassert!(path.is_some())inshaders.rs:2193.Earlier evidence (2026-11-25): on
696a222a597cfe1f3e86db9d0c2b732f8177156f, the focused fixture passed and the workspace suite reported 1226 passed, 4 failed, and 46 ignored. That workspace run used the then-current merge base as its comparison.Not tested
Retail smoke on this head, a full shader-pack precompile, and creation and subsequent runtime reuse of a saved driver blob.
AI use
Codex (gpt-6.2-sol) ran and verified the 2026-11-26 tests and wrote this update. Claude Code (Claude Sonnet 5.5) ran and wrote the 2026-11-25 report.
Imported from ivall/xcl. Originally posted by thiagocalile on 2026-11-25T16:25:47Z.
Independent test and 60 s smoke report for head
696a222a597cfe1f3e86db9d0c2b732f8177156fon an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native wave64).Tested
32.0.21045.29003,XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11.XCL_ADAPTER=radeon cargo test --no-fail-fast -p xcl --lib -- shaders --test-threads=4: 16 passed, 0 failed, 0 ignored (1SKIPPED:pso_measurement_compiles_an_exact_synthetic_record, Windows Developer Mode not enabled).Regression run (
scripts/smoke.ps1 -Seconds 60, release builds,XCL_ADAPTER=radeon)main(06c9f55):PR
#2246(696a222):Not tested: full workspace test suite on this head, offline
--precompileof mesh compute passes on the retail shader pack, NVIDIA/Intel GPUs, or Linux/Wine.AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting.
Imported from ivall/xcl. Originally posted by kole07139 on 2026-11-25T16:34:28Z.
The full
--only ms --pipelinespass on this head, which the description and the three reports above leave untested, on an RTX 3070 8 GB: 9 282 compute passes compiled with 0 errors, 9 282 pipelines made and 0 refused, in 42.7 min at a 3.2 GB peak. A second pass on that cache took 40 s and loaded all 9 282 from the driver cache.Setup
696a222, not merged with anything.shaders.rpf(26 503 records).XCL_HEAP_WINDOWS=1 XCL_NETWORK=0, HLSL path (XCL_DIRECT_DXILunset), one process.XCL_DXIL_CACHE; private bytes sampled every 5 s.xcl shaders <pack> --precompile --only ms --pipelines, run twice on the same cache.Results
compiledalready cached 0for the translations. It still took 40 s instead of 43 min, and every pipeline came from the driver cache, which is the part that matters for the title. I did not look into why the translation counter shows 0.cargo test --release -p xcl --lib shaders::on this head: 10 passed, 0 failed, 0 ignored, includingan_ms_compute_pass_is_precompiled_under_the_runtimes_key. 1 SKIPPED:pso_measurement_compiles_an_exact_synthetic_record, which needs Developer Mode, as in the description.main(65fc114).Not tested
mainthis title stops before its world on this card, where the mesh pipelines are built.XCL_DIRECT_DXIL=1.AI use: Claude Code (Claude Opus 5.5) built the head, ran the two passes and the tests, and wrote this report. I checked it before posting.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T16:42:04Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 2 real failures, deterministic (also fail--test-threads=1):Same pair of failures across this batch of PRs — looks like a shared feature area with two broken assertions. Needs fixes before merge.
— Devin
Imported from ivall/xcl. Originally posted by MacieGx on 2026-11-25T20:57:24Z.
@DavidM1911
pc_resource_desc_strips_uav_on_unsupported_formats_and_msaais not touched by this PR: it failed onmainat the time too (checked alone onc9a5d58), and it passes on the rebased head (full suite in the description).Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:09:13Z.
Review: COMMENTED
No concrete source defect found. Precompile root-signature/two-pass DXIL/cache path logic matches runtime behavior. Material validation gap: unit tests prove equality but do not create a driver blob and have finish_two_pass reuse it; add GPU integration coverage for precompile blob -> runtime cache hit and stale-blob retry. Current head has no visible Windows CI and reported workspace failures, so provide fresh current-head required evidence before merge.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:59:30Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-26T02:08:40Z.
Independent Windows check of #2246 head
949609bon an RTX 3080 Ti (driver 621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC and DXC 1.8.2502.11.Tested:
cargo build --offline --locked --workspacepassed. Thencargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4passed on the unchanged head: 1,424 passed, 0 failed, 46 ignored, 25 SKIPPED notices. The newan_ms_compute_pass_is_precompiled_under_the_runtimes_keytest passed 1/0/0 with disk caching enabled.I found one test configuration failure. In a separate process with
XCL_PSO_DISK_CACHE=0, that new test fails 0/1/0 at the unconditionalpath.is_some()assertion. This is a supported setting: both path helpers returnNonewhen the disk cache is off. A local test-only removal ofassert!(path.is_some())passed the focused test 1/0/0 in separate cache-off and cache-on processes; the next assertion still compares the producer and runtime paths. No production change or commit was made.Not tested: a title run, AMD/Intel, or whether a precompiled driver blob is accepted and reused by
finish_two_passon this GPU. The checked-in test compares translated DXIL, samplers and cache paths; it does not create and consume a saved driver blob. Synthetic tests only. AI-assisted: Codex (GPT-6.2 Sol) reviewed the diff, ran the checks, verified the local test-only change and drafted this report.Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-27T14:59:44Z.
Independent RTX 3080 Ti check of #2246 head
b9f252e7. Windows 11 build 26300, driver 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, DXC 1.8.2502.11.cargo build --offline --locked -j 4 --workspacepassed. After the build,cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 --quietpassed 1,447 / 0 / 47 across 38 targets, with 25 GPUSKIPPEDnotices (21 unavailable native wave64, three unsupported per-lane forms, one heap-windows opt-in). The new mesh cache-key test passed 1 / 0 / 0 with disk caching on.XCL_PSO_DISK_CACHE=0, the focused test fails 0 / 1 / 0 atassert!(path.is_some()). Both path helpers returnNonein that supported mode. Compare the precompile and runtime paths in both modes, and requireSomeonly when disk caching is enabled; that preserves the default key check.shaders <sample pack> --precompile --only ms --pipelines --sample 10on the clean head made 10 pipelines, with zero errors and zero refusals. Two repeats using the same cache made 10 each and loaded 8, then 9 driver blobs. These are offline preparation results, not runtime blob-reuse or gameplay measurements.Smoke: clean
main81693f02, release, 60 s, RTX 3080 Ti,XCL_PREPARE=0,XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=1,XCL_PSO_PRELOAD=0, retained cache:The same bounded invocation on the clean PR head did not produce a PR smoke block: it began the full 26,503-record startup preparation and did not enter the title before the startup timeout. This head predates #2976, so it ignores
XCL_PREPARE=0; currentmainhonors it. Rebase on currentmainand I can rerun the matched clean-head smoke. The offline sample above exercises this PR's precompile path separately.One source-review point:
--sample Nincrements its limit after parallel workers load and parse records. A later record can take a slot while an earlier one is still loading, so the documented first N matching records are not deterministic. Selecting the bounded matching records in pack order before parallel compilation would make warmups reproducible; a two-record delayed-first regression would cover it. The varying cache hits above are consistent with this path, though they do not alone identify the selected records.Not tested: a clean PR-head title smoke block, runtime acceptance of a precompiled mesh blob, world-load speed, AMD or Intel. AI use: Codex (GPT-6.2 Sol) ran and checked the tests and drafted this report; Codex (GPT-6.2 Astra) independently reviewed the mesh precompile path.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T15:42:39Z.
Tested
Clean detached
b9f252e7ffb8e3c3a8f4e890b8a38d226d075080on native Windows 11 build 26200, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC, and DXC/DXIL 1.9.2602.17. I reused the pinned exact-head CLI and an external synthetic runtime probe linked against the exact-head XCL library. All three GPU runs usedXCL_ADAPTER=A770under separate shared Arc mutex acquisitions. Device identification confirmed the A770, and binary hashes matched before, under, and after the lock.xcl shaders <synthetic-fixture-dir> --precompile --only ms --pipelines --sample 1 --windows 4compiled one mesh shader and created one compute PSO with four memory windows and split wave64. Zero errors, refusals, skips, or offline cache hits. The 17,203-byte blob130ea4ec7f63a32a-19b0-0.psohad SHA-256a66650fc575ac3a89a15c5ea0ac0b9e1fcd0f0dd34ae62904889233c6cca5da2.offline_mesh_probe.exe --exact offline_mesh_compute_blob --nocapture --test-threads=1used the normal D3D12.X pipeline hook with PSO preload disabled. The fresh runtime reported 1 disk hit, 0 rejects, 0 stores from the offline cache. The blob hash stayed unchanged. A separate fresh runtime with an empty cache and disk caching enabled reported 0 hits, 0 rejects, 0 stores.Not tested
Retail, stale-blob retry, performance, driver-internal caching, other adapters, and the full workspace suite.
AI use
T3 Code / Codex (
gpt-6.2-sol) built the original artifacts, independently reran the three cases, and wrote this report.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:40:01Z.
Triage (#1607) – head
b9f252e#3498 (merged, commit
69f704e) already does this on main:xcl shaders --precompile(and launch preparation) translates the compute producer pass of every console MS with an NGG variant. It usespso::console_mesh_cs_inand with--pipelinesbuilds its driver compute PSO sofinish_two_passfinds the blob. The rest of this PR (--sample Nfor--precompile, the--only msREADME line) is small and would be a separate change.Recommendation: close (superseded by #3498 / main commit
69f704e).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:50:59Z.
Closing as superseded: this change is already on
main(69f704e). shaders.rs precompile loop calls recomp::pso::console_mesh_cs_in for mesh producer passes into translated/v2 and (with pipelines) the driver cache, per69f704e(#3498); PR adds the same console_mesh_in/precompiled_compute ideaTwo independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed