Repository navigation
Conversation
|
Tested commit Environment
Results
|
717fec5 to
0f04514
Compare
Port #2427 (XCL_HEAP_FLAT=1, HEAP_FLAT=0x200) for compute stages using XCL_HEAP_WINDOWS=1 so every heap-window read in Lw::with_mem_i32s() lowers to a single clamped ResourceDescriptorHeap[NonUniformResourceIndex(4 + w)] load and select instead of a per-read branch, merge block, and PHI set. Large compute shaders (including 95cc13288a27a96e with 1,316 heap-window reads and a74706fb8f96ade9 with 1,012 reads) eliminate thousands of basic blocks and PHIs on AMD RDNA4 as well as NVIDIA; heap_raw_buffer_uav already sets NonUniformResourceIndex=true and out-of-range/inactive lanes read harmlessly from window 0 and select 0. Includes gpu_heap_flat_reads_match_the_switch_form regression test. Assisted-by: Antigravity (Gemini 4 Neon High)
|
Tested: current PR head merged onto current
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. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
0f04514 to
d356a74
Compare
bmjask
left a comment
There was a problem hiding this comment.
No concrete source-level defect found. Flat path clamping/select behavior, cache identity, and GPU parity coverage look sound. This draft is not merge-ready: merge state is unstable, required main/head regression pair is pending, and there is no XCL_HEAP_FLAT title run or AMD/Intel validation. The documented precompiled-cache misses are acceptable only while opt-in measurement remains the scope; rebase and provide current evidence before merge.
|
By reading only, at
AI use: Claude Code (Claude Opus 5.5) found this; a second Claude Opus 5.5 re-derived it; Claude Fable 5.2 reviewed the text; checked by a person before posting. |
d356a74 to
f8b3191
Compare
|
AMD Windows driver timing for #2427: on an RX 9070 XT with heap windows, The offline tool: Setup
DXIL size, all 2,689 compute programs, heap windows (translation only)
Driver time, 26 large programs, 2 interleaved rounds (off, on, then on, off)
Mean 73.5 → 65.2 s (−11 %), and no pipeline failed. The gain is much larger than the 3.7 % size cut, which fits the description: AMD also seems to pay for the blocks, not the bytes. Largest programs:
Not measured: AI use: Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this report; I posted it. |
|
@bmjask thanks for the review. Rebased. This PR is now c8c2b7a, on The table. It was measured before the rebase, and its switch column is the form from before #2368. The body now says so and states the claim against the guarded heap form, which this opt-in flag replaces. Against that form, the flat form built the five large programs 34–64 % faster, and its native code was 2.4 % smaller in total. On @pvfreis's RTX 3060 it was 0.974 times the guarded form's size over 60 records, with 12 of them larger. Those five programs are all the compile-time evidence there is, and the body says the gain is shown only for them. A same-job rerun on the new base, with #2368's form as a fourth column, is queued. Scope. Flat reads are now for compute programs only (kernel and CS entries, Regression pair (in the body), on c8c2b7a against
AMD / Intel. I have neither. @bielfreedom timed the form on an RX 9070 XT (comment 7180279957), and found and confirmed a precompile-key fix (comment 7181043742): AI use: Claude Code (Claude Opus 5.5) made the changes and measurements and wrote this reply. |
|
@pvfreis thank you for both: the reading on #2427 and the RTX 3060 run on #2428. 1. Baseline. You're right: the table predated #2368. A same-job rerun of the five programs on
2. Scope. Also right: with Your other results. Your suite (1429 passed, 1 failed, 46 ignored; only e2e AI use: Claude Code (Claude Opus 5.5) made the changes and the measurements and wrote this reply. |
With heap windows (XCL_HEAP_WINDOWS=1), every read of the direct DXIL translator was a branch on `w < windows` (and the lane guard) around the heap lookup, and a phi per value at the join. On NVIDIA the driver's compile time follows the block count, and the reads of a large compute program make thousands of blocks. XCL_HEAP_FLAT=1 (with heap windows; new flag HEAP_FLAT in the windows count, so the caches keep the forms apart) reads in one path: the lane loads from window `w`, or window 0 when `w` is outside the windows or the lane is not active, and those lanes take 0, as the guarded form and root UAVs give. All with_mem_i32s callers only load (raw, SMEM, unaligned, format and BVH node reads). Stores and atomics keep their branch. Compute programs only (kernel and CS entries, kernel::reads_heap_flat): mesh, GS, vertex and pixel programs keep the guarded form. The HLSL path ignores the flag. The one-path form is the idea xcl-dev#1695 brings to the HLSL heap form. xcl shaders (--precompile, --export-hlsl, --measure-pso) takes its windows from pso::windows_for, as pso::mem_windows does, instead of its own copy of the rule, which had no HEAP_FLAT: with XCL_HEAP_FLAT=1 the precompile made the guarded form's entries, not the ones the runtime looks up (found by bielfreedom). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
f8b3191 to
c8c2b7a
Compare
|
@bielfreedom thank you, that is a real bug, and the AMD timing is very useful. The fix, in this PR's commit, now c8c2b7a:
This corrects what I wrote to @bmjask above: precompiled entries for this form are found with the flag on. Your setup and numbers are in the description under Tested by others, credited to you: 3.7 % less DXIL over 2,689 programs, and 11 % less AMD AI use: Claude Code (Claude Opus 5.5) made the fix and the test and wrote this reply. |
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
|
@Kalmarv confirmed on the RX 9070 XT: at
AI use: Claude Code (Claude Opus 5.5) built the binary, ran the measurements and wrote this; I posted it. |
|
Follow-up, by reading only, not run, at
AI use: Claude Code (Claude Opus 5.5) checked this; Claude Fable 5.2 reviewed it; checked by a person before posting. |
|
@pvfreis thank you for reading both heads again. On point 2: the scope is stated under Scope in this PR's description (compute programs only, AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
Part of #2088.
With heap memory windows (
XCL_HEAP_WINDOWS=1), every read in a direct-DXIL compute program is a branch onw < windows(and the lane guard) around the heap lookup, with a phi per value where the paths join. NVIDIA's compile time follows the block count, not the byte count, and the reads in a large compute program make thousands of blocks.This PR adds a one-path form behind
XCL_HEAP_FLAT=1. It applies only with heap windows on:w's heap view. It uses window 0 instead whenwis outside the windows or the lane is inactive, and those lanes then take 0. The guarded form and the switch over root UAVs give the same results.HEAP_FLATflag is in the windows count, so the caches keep the forms apart.kernel::reads_heap_flat). Vertex, pixel, mesh and GS programs keep the guarded form, and the HLSL path is unchanged. Before, mesh and GS programs read flat too (@pvfreis's review). Only reads change: raw, SMEM, unaligned, format and BVH node loads (all thewith_mem_i32scallers). Stores and atomics keep their branch.Result, on native Windows and NVIDIA: this form builds these five large programs 34–64 % faster than the guarded heap form. Its native code is 2.4 % smaller than the guarded form's in total (1.5–4.8 % per program).
The table was measured on 0f04514, this PR before its rebase onto 6d12f58. Its switch column is the form from before #2368;
mainnow reads compute memory through #2368's select instead.Cold pipeline builds on an RTX 5070 Ti (NVIDIA 610.74), shader cache disabled (
ShaderCacheControl), 4 windows, split wave64:main's root UAVs.GetCachedBlob) is 2.4 % smaller than the guarded form's here (1.5–4.8 % per program), and 0.974 times its size over 60 records on @pvfreis's RTX 3060, where 12 of the 60 are larger. Against root UAVs, the gap is larger; Recompiler: NVIDIA compute programs take flat heap windows by default #2428, which turns this form on by default, has those numbers.What is in it
gpu/dxil/lower_mem.rs: the one-path read inwith_mem_i32s.gpu/dxil/kernel.rs,gpu/dxil/lower.rs:heap_flatinLw.kernel::reads_heap_flatsets it for kernel and CS entries withHEAP_FLATand heap windows. Test:only_compute_programs_read_heap_windows_flat.gpu/recomp/mod.rs,gpu/recomp/pso.rs: theHEAP_FLATflag andXCL_HEAP_FLAT=1. The HLSL path strips the flag the way it stripsHEAP_WINDOWS.pso::windows_forgives the windows ofnfor this run;mem_windowstakes it.shaders.rs:xcl shaders(--precompile,--export-hlsl,--measure-pso) takes its windows frompso::windows_fortoo, instead of its own copy of the rule, which had noHEAP_FLAT. WithXCL_HEAP_FLAT=1, the precompile made the guarded form's entries, not the ones the runtime looks up (found by @bielfreedom). Test:precompile_windows_are_the_runtimesruns withXCL_HEAP_WINDOWS=1andXCL_HEAP_FLAT=1or0in a new process and compares the windows with the runtime's. It fails with the old copy (260 against 772).gpu/recomp/tests.rs:gpu_heap_flat_reads_match_the_switch_form.s_buffer_load_dwordx4from window 3, abuffer_loadfrom window 1, and per-laneglobal_loads spread over all four windows.v_cmpx), and there is a SADDRglobal_load_dwordx2.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on this head, c8c2b7a (onmain6d12f58): 1426 passed, 0 failed, 46 ignored.V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32), and 1 for no heap windows (the switch-form fallback test, since heap windows are opt-in here).gpu_heap_flat_reads_match_the_switch_form,only_compute_programs_read_heap_windows_flatandprecompile_windows_are_the_runtimespass.XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1, 60 s, release, one run beside other jobs on the same machine. There was no device removal and no crash. It showed 1474 frames and was still presenting at the end (52, 38 and 50 frames per 2 s), with a peak commit of 17993 MB. Its log shows the memory windows coming from the shared descriptor heap. There is nomainrun of the same length to compare with.Tested by others
@pvfreis (Recompiler: NVIDIA compute programs take flat heap windows by default #2428, comment 7177531683): RTX 3060, NVIDIA 617.14, on Recompiler: NVIDIA compute programs take flat heap windows by default #2428's ab2855f, which contains this PR.
@Eterst (Recompiler: an access may take its base address's window (XCL_WINDOW_NO_CARRY) #2496, comment 7176075746): RTX 4070 SUPER 12 GB, NVIDIA 616.92, Windows 10 19045, release.
XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, split off, a full precompile with the same switches, then a title run withXCL_WINDOW_NO_CARRY=1 XCL_HEAP_FLAT=1.main06055a7): four runs lost the device (0x887a0005) at 261–303 s.@bielfreedom (comment 7180279957): RX 9070 XT 16 GB (RDNA4), AMD driver 32.0.32029.2010, Ryzen 7 7700, 32 GB, Windows 11, release.
main08db802. It had their one-line fix of the precompile windows, now in this PR, and a local patch that logs each program's DXIL size andCreateComputePipelineStatetime.xcl shaders --precompile --only cs --pipelineswithXCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PSO_DISK_CACHE=0, one driver thread, every build cold. The flat and guarded arms come from one binary.mainb49be18 with only their timing patch:XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 xcl shaders --precompilenow makes the flat form. Its DXIL is 728.9 → 702.1 MB (−3.7 %, 2,639 changed), the same bytes, program for program, as their run with the hand-added fix.Regression run
scripts/smoke.ps1through our run script, 120 s, release builds,XCL_DIRECT_DXIL=1, in one queue job:mainb49be18, then this head. Both sides use the same data root and XCL cache, warmed by earlier runs, and start from the same learned coherent-window state.xcl shaders --precompilecount, through both sides), and another agent's GPU test suite ran beside themainside only (about 60 of its 120 s).main's frames (1522 against 1738) and 101.7 % of its peak commit (28999 against 28514 MB). The run uses this PR's defaults, where the flat form is off.mainb49be18:This PR (c8c2b7a):
Not tested
mainover the same time.AI use
🤖 Generated with Claude Code