Shaders: cache legacy ES+GS compute pass translation in RAM #2918
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!2918
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2918"
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?
@real-alponzo on GitHub · 2026-11-26 23:13 UTC · original
real-alponzo:fix/2876-cache-geometry-compute-pass→main· +105 −19 · 1 files · 1 commits · openCache the compiled ES+GS compute pass
(Compiled, MsInterface)inconsole_geometryacross legacy geometry pipelines that differ only in pixel shader or fixed-function state, matchingconsole_mesh.Fixes #2876.
What is in it
GeometryCache(cached_geometry_compute_in, capped at 256 entries, never caching errors ordxc::defer()misses) incrates/xcl/src/gpu/recomp/pso.rs, keyed by(vs hash, vs len, gs hash, gs len, mem_windows, split_wave64, direct_dxil).compile_console_geometryout ofconsole_geometry(respectingdxc::defer()on the direct DXIL path andcache_allowed(Stage::Mesh, ...)), reusingfinish_two_pass_compiledfor the pixel-signature-specific mesh passthrough and removing the now-unusedfinish_two_passhelper.shader_cache_tests::geometry_compute_cache_reuses_es_gs_and_skips_errors.Regression run
Base (
main):PR head (
4ddb971c):Tested
rustc 1.100.0, DXC 1.9.2602.17.cargo test -p xcl --lib geometry_compute_cache_reuses_es_gs_and_skips_errors -- --nocapture:1 passed; 0 failed; 0 ignored; 1345 filtered out..\scripts\smoke.ps1 -Game "C:\VIctory-SSD-test\game" -Seconds 60on8b957becand4ddb971c(blocks above).Not tested
cargo test --workspacelocally on this exact branch (targeted unit test and paired 60 s retail smoke verified; CI runs the full suite).AI use
console_geometrycompute-pass RAM cache, wrote the unit test, ran the test and paired smoke runs, and drafted this PR description.@JJAutoCompare on GitHub · 2026-11-26 23:27 UTC · original
Tested: Clean
4ddb971c748d0387cc7aed3da05e259cad255d78, Windows 11 25H2 26200.9974, Ryzen 7 3800X, Intel Arc A770 16 GiB (32.0.101.9175), Rust 1.100.0 MSVC, DXC/DXIL 1.9.2609.5, debug. Built withcargo test --locked --offline -p xcl --lib --no-run. Ran the resulting executable withgpu::recomp::pso::shader_cache_tests::geometry_compute_cache_reuses_es_gs_and_skips_errors --exact --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored, 0 skips. The helper test covers repeat lookup, failure retry, and a distinct key. WithXCL_ADAPTER=A770, rangpu::recomp::tests::gpu_geometry_mode_es_gs_strip --nocapture --test-threads=1: 2 passed, 0 failed, 0 ignored, 0 skips. The two geometry fixtures check ES+GS records and the mesh pass-through on device.Not tested: The two GPU fixtures exercise the translation/draw path without measuring the runtime cache hit rate or wall-time improvement. Full suite and retail smoke were outside this run.
AI use: T3 Code / Codex (
gpt-6.2-sol) ran the tests and wrote this report.@fromthemoonx on GitHub · 2026-11-27 00:17 UTC · original
Full suite on NVIDIA (listed under Not tested): passes. The helper test fails with the lookup disabled, but nothing in the suite calls
console_geometry, so the new cache and its key are not reached by any test.Tested:
4ddb971(its base is currentmain8b957be, so head = merged). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug, DXC 1.9.2602.17.cargo test --workspace --no-fail-fast -- --test-threads=4SKIPPEDlines (no wave64, refused per-lane forms)eprintln!on each hit / miss incached_geometry_compute_in,cargo test -p xcl --lib, plain and withXCL_DIRECT_DXIL=1get(&key)lookup replaced byNonegeometry_compute_cache_reuses_es_gs_and_skips_errorsfails 3 of 3 (repeated ES+GS key must hit RAM cache without retranslating)console_geometry's only caller is the translated GS pipeline path inreal.rs(real.rs:6307);gpu_geometry_mode_es_gs_striptakes another route. So a key that left out a field, or a hit that returned another program'sMsInterface, would pass the suite. A test that callsconsole_geometrytwice with the same VS/GS and different PS (expecting one translation), and once with a different GS, would cover the shipped path.Not tested: a title with legacy GS pipelines (no rebuild count was measured), AMD / Intel on this run.
AI use: Claude Code (Claude Opus 5.5) ran the tests and the scratch checks and wrote this report.
@andrewDoing on GitHub · 2026-11-27 00:33 UTC · original
On head
4ddb971c748d0387cc7aed3da05e259cad255d78, four concurrently requested native graphics PSOs sharing console VS/GS bytes but using different pixel shaders entered ES+GS lowering four times. Four additional PSOs with the same VS/GS and new pixel shaders entered lowering zero times. On an RTX 5070, all eight draws produced the color expected from their own PS. Four fresh processes reproduced the 4/0 counts, including three using an already populated DXIL cache.Reproduction. In
gpu_two_pass_cache_e2e, reusesynthetic_vs_gs_containers,build_gs_pso, anddraw_two_pass_and_read. Compile eight PS variants that add red-channel constants 1 through 8 to the incoming color. Release four workers simultaneously immediately before pipeline creation, wait for all four PSOs, then draw each. Repeat with the other four PS variants in the same process. Count entries tocompile_console_geometry. We used direct DXIL, RTX 5070 selection, a writable shader cache and no sleeps inside the compiler.Local fix experiment. Reuse the existing per-key in-flight mutex pattern from
cached_shader, keyed by the completeGeometryKey. Recheck the map after acquiring the per-key lock and before insertion. An ordinary worker compiles outside the cache mutex. A cached-only probe bypasses the in-flight lock. Once the 256-entry map is full, uncacheable misses bypass serialization, including when the last slot filled while a caller was waiting. Leave failed results uncached.The same four-process experiment produced 1/0 lowerings with the change, with correct readbacks for all 32 draws. The focused command
cargo test --locked --offline -p xcl --lib shader_cache_tests -- --test-threads=4 --show-outputpassed 26/26 tests, including new same-key sharing, unrelated-key progress, nonblocking cached-only miss and full-cache parallelism cases, plus the existing failure/retry test. The native probe wascargo test --locked --offline -p xcl --test gpu_two_pass_cache_e2e local_geometry_pso_concurrency -- --test-threads=1 --nocapturewith the local fixture described above.This measures redundant lowering in a controlled workload. Retail overlap frequency, wall-time improvement and the full workspace suite on the local fix remain unmeasured. AI use: OpenAI Codex with GPT-6.2 Astra prepared and ran the probes and implemented the local experiment; Codex coordinated and prepared this report.
@oni-swr on GitHub · 2026-11-27 02:06 UTC · original
Tested (AMD): clean
4ddb971c748d0387cc7aed3da05e259cad255d78(base = main8b957bec). Windows 11 26200, Ryzen 7 5700X3D, AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Rust 1.100.0 MSVC, DXC 1.8.2502.11 (Windows SDK 10.0.26100), debug.cargo test -j 4 -p xcl --no-fail-fast -- --test-threads=4thencargo build --workspace+cargo test -p xcl --test e2e: thee2etests need the workspace-built test title, so the first run failed 3 of them for lack of it and the rerun passed 4 of 4. Lib/other targets: 1 failed, 7SKIPPEDlines (no heap windows, refused V_CVT_F16_F32 / V_MUL_F16 / VOP3-modifier forms), 47 ignored. The one failure,gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722:res[30] = 0x1, CPU 0x7fffffff), also fails onmain8b957becwith the same seed on this GPU, so it is not from the PR.geometry_compute_cache_reuses_es_gs_and_skips_errorspasses; the on-devicegpu_geometry_mode_es_gs_stripfixtures are part of the passing suite.Review (by reading, no bugs found): the key
(vs, gs, mem_windows, split_wave64, XCL_DIRECT_DXIL)covers every input of the compute pass; the PS goes throughfinish_two_pass_compiledafterwards, and thecache_allowed(Stage::Mesh)env guard is applied (pso.rs:1264-1285). Errors anddefer()misses are not cached. Notes, not bugs: underXCL_DIRECT_DXILa cached-only probe now defers atpso.rs:1240instead of translating inline (same asconsole_mesh); unlikeconsole_meshthere is no in-flight coalescing, so two workers can translate one pair twice; the key trusts a 64-bit hash without comparing the blob; the cache stops at 256 entries.Not tested: retail smoke. The
scripts/smoke.ps1run starts with a cold-cache precompile of about 26k shaders, which did not fit this session's time budget, so I did not produce a base/headxcl-smokepair. No runtime hit-rate or timing was measured either.AI use: Claude Code (Claude Sonnet 5.5) ran the checks and wrote this.
@ettehn on GitHub · 2026-11-27 03:33 UTC · original
I measured the serial warm-cache case requested in #2876 on native Windows 11 build 26200, RTX 5070 Ti Laptop, driver 621.24, Rust 1.97.1 MSVC debug (debuginfo off), and SDK DXC 1.8.2502.11. Clean libraries at
8b957becand4ddb971clinked into the same synthetic harness.XCL_HEAP_WINDOWS=0, split wave64. Each process warmed both pixel variants of one synthetic ES+GS pair, then timed 100 alternating calls to the publicconsole_geometryentry. Three interleaved base/head pairs per mode. These are ranges of the three per-process medians.mainXCL_DIRECT_DXIL=0)XCL_DIRECT_DXIL=1)The main-only component timing for ES/GS parsing and lowering, excluding passthrough and DXC cache lookups, was 1.039–1.076 ms for HLSL and 4.366–4.428 ms for direct. For each mode and revision, both pixel variants had identical compute bytes within the pair and distinct passthrough mesh bytes. The D3D12 fixture then created the resulting compute and mesh PSOs and drew both variants, outside the timed section. All 24 draws passed the 41-covered-pixel check and the first record reported the expected 84 vertices and 42 triangles.
This times the translation entry point after warm-up. Runtime PSO scheduling, cold concurrent misses, native driver-cache timing, and retail impact are outside the measurement.
OpenAI Codex assisted with verification.
@SzczepanGrela on GitHub · 2026-11-27 04:44 UTC · original
RX 9070 / RADV / Wine check of public
console_geometry, comparing exact head4ddb971c748d0387cc7aed3da05e259cad255d78with its base/current main8b957bec6f82495aec940944c6bf47faa02db590. This adds native-wave64 and split-wave64 render/readback coverage on this environment.Tested
26.3.1-arch3.5, Ryzen 7 7700, CachyOS7.3.0-5-cachyos. Windows GNU release executables, Rust1.97.1, GE-Proton11-12 / Wine 11.0 Staging, native DXGI/D3D12 through vkd3d-proton8293130ebe370b1+(local asserts-disabled build), DXC/DXIL1.9.2602.17.cfg(test)thread-local counter immediately before the actualgeometry_programcall. Original tests/assertions and production value flow preserved. Build each:cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics.<unit.exe> gpu_geometry_mode_es_gs_strip geometry_compute_cache_reuses_es_gs_and_skips_errors --nocapture --test-threads=1, then--test-threads=4. Main: 2 passed, 0 failed each; head: 3 passed, 0 failed each.<unit.exe> workflow_console_geometry_cache_native --nocapture --test-threads=1. Three fresh processes per source and backend (XCL_DIRECT_DXIL=0/1): 1 passed, 0 failed in all 12 runs. Both requested translation paths confirmed from captured DXIL.In each added run, call public
console_geometryserially with(GS, PS)sequence(0,0), (0,1), (0,2), (1,0), (1,1), (0,0), first native wave64, then split wave64 in the same process. VS bytes stay fixed; GS 0/1 emit green/blue. PS variants consumeTEXCOORD0, consume absentCOLOR0with a red offset, or return constant blue. Effectivemem_windows=4stays fixed.Both wave modes give those counts: 12 versus 4 lowerings per process. Compute containers remain identical across PS changes and differ across GS changes. Mesh containers differ across the three PS signatures and remain identical across GS colors. Changing to split mode produces separate cold entries.
Every returned compute/mesh pair creates native PSOs and executes through the plain-PC
mesh_draw_splitrunner. 144 two-pass draws across the added runs: 72 native-wave64 geometry dispatches and 72 split-wave64 geometry dispatches with wave32 metadata. Separate physical-width probes return 32/64 in every lane. All 64 RGBA32F pixels and all 529 record words per draw match independently recomputed expectations, including triangle indices and unused record words. 114,576 record/pixel/width words checked. Render payloads agree across source arms/backends; captures repeat byte-for-byte within each configuration. 0 ignored, 0 skipped.Inherited
XCL_*cleared;XCL_NETWORK=0, RX 9070 selected,XCL_REQUIRE_GPU=wave64,XCL_DXC_THREADS=1; private enabled caches per process.Not tested
Concurrent miss coalescing, capacity/eviction, end-to-end deferred/error paths, varying memory-window configurations or flat memory-window loads, adopted HLE graphics-PSO creation hooks, full suite, native Windows, other GPUs, retail workload,
scripts/smoke.ps1, timing or FPS. This tests the public translation/cache entry and native execution of its returned shaders.AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the added test-only fixture/counter and captures, ran comparisons, independently verified encoded GS changes, complete readbacks, counters, wave metadata and source/executable provenance, and drafted this report. Publication authorized by the account owner.
github-bot referenced this pull request2026-11-27 05:06:36 +00:00
@LocranKing on GitHub · 2026-11-27 10:00 UTC · original
Tested PR #2918 (
4ddb971c) againstmain(8b957bec) on Windows 11 (26300), Ryzen 5 5500 (6C/12T), RTX 3060 Ti 8 GiB (driver621.40),rustc 1.100.0, DXC1.9.2602.17.Unit Test (
cargo test --locked -p xcl)gpu::recomp::pso::shader_cache_tests::geometry_compute_cache_reuses_es_gs_and_skips_errors:1 passed, 0 failed.Paired 180 s Retail Smoke (
9cc6a39e, Series Slockhart,XCL_HEAP_WINDOWS=1,XCL_DIRECT_DXIL=all,XCL_DIRECT_SPLIT_INSTRUCTIONS=0,XCL_PSO_WAIT_MS=50)main(8b957bec)67.2 s/188.4 s124014(28windows)29,411 MB14,281 / 2,241 MB9,178draws,34,068dispatches0 / 0(exit: 0x0)4ddb971c)71.0 s/190.5 s122817(29windows)30,137 MB14,624 / 2,407 MB13,298draws,34,179dispatches0 / 0(exit: 0x0)Zero crashes, zero device removals (
exit: 0x0).Not tested: Serial warm-cache
console_geometrytiming microbenchmark (#2876), or legacyES+GStwo-pass geometry draws in-title (none were logged during this60.5 sworld window).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.