Repository navigation
Recompiler: XCL_DECLARED_LDS=1 sizes direct compute LDS from the header (~11 ms less GPU per frame) - #2937
Recompiler: XCL_DECLARED_LDS=1 sizes direct compute LDS from the header (~11 ms less GPU per frame)#2937Kalmarv wants to merge 1 commit into
Conversation
The direct DXIL translator gave every compute program that uses LDS the whole 8,192-dword groupshared block D3D12 allows, with the split form's exchange words at its top. With XCL_DECLARED_LDS=1 it declares what the program's header asks for instead: the static workgroup LDS from COMPUTE_PGM_RSRC2 (CsInterface::lds_dwords), plus the exchange words and counters of the split form (or the arrival counter of a native 2-D/3-D group) placed after it. A header with no size, or one too big to leave room for them, keeps the 8,192-dword layout. LDS addresses are clamped to the declared top. The translated-shader caches key the switch apart. Less groupshared memory per group lets more groups run at once. On the title (RTX 5070 Ti, Series X profile, per-program GPU timestamps over 187-229 s), the late frame's compute went from about 89 to about 78 ms per present with the switch on; 66 of the late programs translate differently (the split family and wave32 programs), and with the switch off the translation is byte-identical. Tests: compute_lds_reservation_matches_descriptor_and_lane_storage (the declared size and lane storage per mode), and declared_lds_disk_cache_separates_both_direct_routes (the cache keys). Written by reed on our team branch; split out on main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Independent Windows GPU readback on With OpenAI Codex (6.2sol) assisted with verification. |
|
Independent synthetic readback on PR head Four fresh-process tests passed without reported skips or failures: native wave32 and split guest wave64, each with the new allocation behavior off and on. Disassembly showed 8,192 dwords allocated with the behavior off in both modes; with it on, wave32 allocated 129 dwords including the arrival counter, and split wave64 allocated 141 including exchange/counters. All 6,144 expected output words matched across the four runs. The fixture and header change were test-only; GTA VI execution, retail timing and performance were not tested. AI use: OpenAI Codex with GPT-6.2 Astra wrote and ran the fixture; Codex coordinated and prepared this report. |
|
RX 9070 / RADV native-wave64 verification of Tested
The two new upstream tests passed on the head at Additional local probes, run through Wine: Separate processes for
For these 2-D GPU cases, the head with the switch on declares 129 / 257 / 385 dwords for 128 / 256 / 384 guest dwords, including the native arrival counter. Unspecified and oversized cases retain 8,192 dwords. HLSL retains 8,192. The layout-only probe also verified the split exchange/counter reservations and fallback cases. All GPU payloads and guards matched independently computed values: 360 dispatches, including 180 native wave64, 552,960 payload words and 28,800 guard words. Containers have the expected WaveSize and thread-group metadata. Captures repeat byte-for-byte across the three repetitions. Default-off containers match main byte-for-byte in both probes; HLSL and fallback controls remain unchanged with the switch on. The head reports 2 passed / 0 failed in every configuration. Main with the switch off also passes both probes; with it on, the GPU probe passes and the layout probe fails as expected on 72 size assertions per process, since main retains the old allocation. Not tested Retail/smoke, frame-time or occupancy gains, runtime PSO-hook integration, real driver-blob cache reuse, the full suite, or forced-split GPU execution. Split-form coverage here is translation/validation only. AI use OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, prepared local test-only probes, ran the comparisons, independently checked layout arithmetic and raw GPU output, and drafted this report. Publication authorized by the account owner. |
…mp hunks verbatim) Live head c4f2a7f still OPEN. Single commit on upstream/main 8b957be: CsInterface gains lds_dwords parsed from COMPUTE_PGM_RSRC2, setup_storage takes (slot, declared, native_counter), LDS block sized to declared+control under XCL_DECLARED_LDS=1 (off = byte- identical layout, verified by analysis + green suite), pso cache identity forks declared-lds for both direct routes, upstream tests in Windows-only core_tests/pso stay reference-only per ground rule 9. Tree adaptations: ..Default::default() on our local-only CsInterface literals (dxil/robustness_tests 1, dxil/lower_valu 3) that upstream does not have. Linux pin: declared_lds_descriptor_ parses_static_workgroup_lds (robustness_tests) — fails pre-fix (E0609 no field), green post-fix.
Follows f1a3ec3, whose tree already carries the test in the working-tree gates (787/0/1) but not in the commit: this lands it. declared_lds_descriptor_parses_static_workgroup_lds guards the shared CsInterface::from_descriptor parse on Linux (upstream test is Windows-only core_tests). Failing-first shown pre-fix (E0609), green post-fix.
|
Tested PR #2937 ( Unit Test (
|
| Build | Frames shown (~58 s world) |
World presents (2s windows) |
Peak commit | Peak local / non-local VRAM | Console stats | Crashes / Removals |
|---|---|---|---|---|---|---|
main (8b957bec) |
1240 |
14 (28 windows) |
29,411 MB |
14,281 / 2,241 MB |
9,178 draws, 34,068 dispatches (88 skipped) |
0 / 0 (exit: 0x0) |
PR #2937 (c4f2a7f3, XCL_DECLARED_LDS=1) |
1173 |
22 (28 windows) |
30,010 MB |
14,522 / 2,851 MB |
12,394 draws, 65,536 dispatches (2,578 skipped) |
0 / 0 (exit: 0x0) |
Both runs stayed clean (0 crashes, 0 device removals, exit: 0x0). In the matched 28 two-second world windows, PR #2937 logged more presents (22 vs 14) and roughly 2x dispatches (65,536 vs 34,068).
Not tested: Per-dispatch GPU timestamp breakdown (XCL_LOOK_STATS), or longer steady-state runs past PSO build-out on 8 GiB VRAM.
|
Two contributors checked independently and found that #2158 solves the same problem in a different way: #1607, group D149. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table. |
|
Triage note (from #1607 (comment), a check from the outside against CONTRIBUTING.md, not a code review):
AI use: Claude Code (Claude Fable 5.2). |
The direct DXIL translator gives every compute program that uses LDS the whole 8,192-dword groupshared block D3D12 allows, with the split form's exchange words at its top. That caps how many groups run at once on a GPU whose LDS per SM is shared by resident groups. With
XCL_DECLARED_LDS=1it declares what the program's header asks for: the static workgroup LDS from COMPUTE_PGM_RSRC2, plus the split form's exchange words and counters (or the arrival counter of a native 2-D/3-D group) placed after it. A header with no size, or one too large to leave room for those, keeps the 8,192-dword layout. LDS addresses are clamped to the declared top. Off by default.What is in it
CsInterface::lds_dwordsfrom COMPUTE_PGM_RSRC2 (recomp/mod.rs).setup_storagesizesxcl_ldsfrom it and places the exchange words and counters after the guest LDS;lds_indexclamps to the declared top (dxil/lanes.rs,dxil/kernel.rs,dxil/lower_mem.rs); the callers ofsetup_storagein the tests follow the new signature.recomp/pso.rs).compute_lds_reservation_matches_descriptor_and_lane_storage(declared size and lane storage per mode,dxil/core_tests.rs) anddeclared_lds_disk_cache_separates_both_direct_routes(cache keys,recomp/pso.rs).Tested
XCL_DXC_DIR.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4on c4f2a7f: results follow (queued).Regression run
Not tested
AI use