Shaders: cache HLSL mesh compute passes in ShaderCache and translated/v2 #2040
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!2040
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2040/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?
@RandomGithub12309 on GitHub · 2026-11-25 01:33 UTC · original
RandomGithub12309:shaders/cache-hlsl-mesh-cs→main· +163 −48 · 1 files · 1 commits · merged 2026-11-25 01:53 UTCPart of #1269. Route the default HLSL path (and
XCL_DIRECT_DXIL=1HLSL fallback) ofconsole_meshthroughShaderCache,shader_flightcompile coalescing, and thetranslated/v2disk cache underStage::Mesh.After #1836,
console_meshcached its compute pass only inside theXCL_DIRECT_DXIL=1direct-translation branch. On the default HLSL path and on any direct-DXIL fallback, every(MS, PS)pipeline pairing sharing a mesh shader still re-rantranslate_meshanddxc::compile_cachedwithout touchingShaderCacheortranslated/v2. Unifying both paths throughcompile_console_mesh+console_mesh_withmatchescompile_console_shader's caching behaviour (withBackend::current()keeping HLSL and direct-DXIL disk entries in separatetranslated/v2namespaces).What is in it
crates/xcl/src/gpu/recomp/pso.rs:finish_two_pass_compiled(shared byfinish_two_passandconsole_mesh_with) andcompile_console_mesh(handlingXCL_DIRECT_DXIL=1withdxc::defer()and HLSL fallback, plus the default HLSL path).console_meshthroughconsole_mesh_withso both direct-DXIL and HLSL mesh compute passes shareShaderCache,shader_flightcoalescing, andtranslated/v2(Stage::Mesh) across(MS, PS)pairings.console_mesh_caches_hlsl_compute_pass_in_memory_and_on_diskusing a synthetic console MS container (PSV0kind 13 +OSG1SV_Position+ NGGFSSMhw 7) to verify in-memory cache reuse, cold-RAMtranslated/v2disk reuse, anddxc::cached_onlyhit on the publicconsole_meshentry point.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)stable-x86_64-pc-windows-msvc, Windows SDK DXC 1.8.2502.11 (debug for workspace build/tests, release forsmoke.ps1).cargo build --workspace: ok.cargo test -p xcl --lib gpu::recomp::pso -- --test-threads=1at4b0af47: 16 passed, 0 failed, 1 ignored (0 skipped).cargo test --workspace -- --test-threads=4 --skip fuzz_validate_and_gpuat4b0af47: 1091 passed, 0 failed, 46 ignored across all workspace targets (xcllib:1042 passed, 0 failed, 26 ignored; integration + e2e targets:49 passed, 0 failed, 20 ignored, includinge2e:3/0/0).SKIPPEDon this adapter (wave32-only, Developer Mode off,XCL_HEAP_WINDOWSunset): wave64-only GPU tests (gpu::recomp::lower,gpu::recomp::lower_dxil,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware), per-lane wave32 f16/f32 conversion refusals,shaders::tests::pso_measurement_compiles_an_exact_synthetic_record, andheap_window_out_of_memory_falls_back_to_the_switch_form.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0..3}due to the pre-existing RTX 500x8007000ECreateComputePipelineStatefailure tracked by #1905.scripts/smoke.ps1release build at4b0af47vsmain(bf9eebd).Regression run
Not tested
XCL_DIRECT_DXIL=1fallback caching under a retail shader pack, Wine / Linux, and gameplay beyond the 60 s smoke window (the 60 s startup run does not isolate mesh-pipeline compile time).AI use
scripts/smoke.ps1regression runs were executed on the hardware listed above.@raylitebull on GitHub · 2026-11-25 01:39 UTC · original
Diff audit passed on
4b0af47(compile_console_mesh,console_mesh_with,finish_two_pass_compiled, andconsole_mesh_caches_hlsl_compute_pass_in_memory_and_on_diskrouting both HLSL and Direct DXIL mesh compute passes throughShaderCache,shader_flight, andtranslated/v2while preservingdxc::cached_onlyparity).Build and test (Windows, no GPU)andPR descriptionare both green, and RTX 5050 passed (1091workspace +16/16gpu::recomp::pso).Remaining before merge: one independent AMD verification pass on
4b0af47.@WebIdentity1 on GitHub · 2026-11-25 01:44 UTC · original · edited 2026-11-25 01:46 UTC
Independent AMD check of exact
4b0af4783135891fa08b8406735083404be6af6b, with a local test-only overlay below; runtime unchanged.Tested
Windows 10 Home 19045, Ryzen 7 7800X3D, AMD Radeon(TM) Graphics iGPU driver
32.0.21030.2001, native wave64. Rust/Cargo 1.98.1 x64 MSVC, DXC/DXIL 1.8.2502.11, debug test profile. The probe prints and verifies successful initialization of the selected AMD adapter. All 317 source hashes matched before/after and match the local snapshot; XCL recompiled.The committed cache test never dispatches a shader. The added probe wraps a public synthetic NGG program in the same container helper, then calls
console_mesh_withthrough first compile, RAM reuse, and fresh-RAM disk reuse. Each returned compute shader runs on AMD and checks the allocation header(3 vertices, 1 primitive)and all 12 vertex-position components against CPU values. Whole mesh-record bytes and compute DXIL match across all three cache states. The translation closure executes once, not three times; both hits avoid translation. No runtime patch was needed.XCL_ADAPTER=AMD,XCL_DIRECT_DXIL=0and1in separate processes:cargo test --locked -p xcl --lib -- gpu_cached_mesh_compute_records_match --test-threads=1 --show-output1 passed / 0 failed / 0 ignored / 0 skipped each. Three compute dispatches per process. Compute DXIL sizes were 4,408 bytes with HLSL selected and 2,836 with Direct DXIL selected.
XCL_DIRECT_DXIL=0:cargo test --locked -p xcl --lib -- gpu::recomp::pso --test-threads=1 --show-output17 passed / 0 failed / 1 ignored / 0 skipped, including the new probe and the committed RAM/disk/public
cached_onlyregression. The existing ignored test iscompile_time_bench::repeated_pso_shader_compile. This adds three more successful compute dispatches.Not tested
Full workspace suite, parent baseline, retail smoke/gameplay, rasterization of the returned mesh shader, concurrent compile coalescing under load, forced direct-to-HLSL fallback, discrete AMD or NVIDIA in this pass. These are compute-record checks, not pixel-output checks. No cold-driver PSO, peak-memory, or general speedup claim: the diagnostic wall timers include cache lookup and pass-through compilation, and the DXC/driver caches were not cleared. The explicit temporary translated-cache directory was fresh per probe; the wrapper's
XCL_CACHE_DIRvariable is not a recognized DXC override, so DXC used its existing default cache. The local probe intentionally fails without its GPU prerequisites; it is a reproduction diagnostic, not proposed unchanged for GPU-less CI. Existing required full-suite/retail gates remain separate.AI use — Codex (GPT-6) inspected the code, wrote this test-only probe using the project's existing synthetic NGG fixture pattern, ran native Windows checks, verified hashes/output, and drafted the report.
Local test-only reproduction patch (one file)