Recompiler: direct DXIL reads heap memory windows without a branch #2417
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2427"
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 Kalmarv on 2026-11-25T18:37:30Z.
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
0f045140, this PR before its rebase onto6d12f58a. 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 form (#2368) see the next table.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; #2428, which turns this form on by default, has those numbers.Against
main's form (#2368), measured on this PR rebased onto6d12f58a(its compute translation is this head's) in one timing job, same card, driver and settings as above. Each program is built in the order switch (before #2368), #2368's select, guarded, flat, then the reverse. The switch column comes from the earlier export, so it is not from the6d12f58abuild.main)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,c8c2b7a6(onmain6d12f58a): 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 (#2428, comment 7177531683): RTX 3060, NVIDIA 617.14, on #2428's
ab2855f, which contains this PR.@Eterst (#2496, comment 7176075746): RTX 4070 SUPER 12 GB, NVIDIA 616.92, Windows 10 19045, release.
6d12f58with #249678bba5cand this PR'sd356a74.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.
f8b3191) onmain08db802. 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.d356a74the sizes were the same and the gain was 10.5 %.c8c2b7a, with no local change (comment 7181043742), merged ontomainb49be18with 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.@veyn-sudo (#2403, comments 7189887455 and 7191174254): RTX 2070 SUPER 8 GB, NVIDIA 617.14, release. This PR's
c8c2b7a6merged with #2576 and #2567 on their tree (mainb49be183and other open PRs). Offline only:GetCachedBlobsummed over the 926 compute records their runs used, with the switches added one at a time in this order (cumulative):XCL_DXIL_OUTLINE=1): 256.6 MB (−21.8 %).XCL_HEAP_FLAT=1): 256.6 → 253.6 MB, −1.2 % of driver code on top of the outlined build, and −0.8 % of DXIL (179.4 → 178.0 MB).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 (
c8c2b7a6):Not tested
mainover the same time.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by alexmircea1299 on 2026-11-25T18:49:15Z.
Tested commit
717fec5on Windows:Environment
621.40,wave32)1.8.2502.11(Windows SDK10.0.26100.0)Results
cargo test -p xcl --lib -- --skip fuzz_validate_and_gpu): 1216 passed, 1 failed, 26 ignored, 4 filtered out (14.73s).XCL_HEAP_FLAT/XCL_HEAP_WINDOWSGPU tests: Passed cleanly on nativewave32NVIDIA hardware.main:gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(assertion left == right failed: group barriers in the program: left: 3, right: 1).gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(filtered out; known RTX 5000 driverE_OUTOFMEMORY0x8007000Eon non-constantgroupsharedatomic subtract tracked in #1905 / #1919).Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T19:18:47Z.
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite, cold cache: 161 passed / 4 failed. Three are the known baseline trio on this lane; the fourth is the newgpu_promoted_uav_clear_values_pass_create_committed_resourcefailure that current main carries (reported here), not caused by this PR. Everything else is green.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.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T20:04:32Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.Thanks!
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:03:22Z.
Review: COMMENTED
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.
Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-25T22:24:05Z.
By reading only, at
d356a74and #2428ab2855f:68a284a) predates #2368 (merged 19:59, now in both heads' base). #2368 replaced the switch on compute raw loads with selects and reports builds up to 3.5 times as fast for that form. So the switch column, and #2428's 1.1–3.8 times (body andheap_windowscomment) and 11–25 %, are not against the form #2428's default replaces now. Rerunning the five programs on the current base would settle it.heap_flatis off only forEntry::Vertex | Entry::Pixel, so withXCL_HEAP_WINDOWS=1and direct DXIL the mesh and GS compute passes read flat too (by default after #2428). The new test runs a kernel program only.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.
Imported from ivall/xcl. Originally posted by bielfreedom on 2026-11-26T01:55:11Z.
AMD Windows driver timing for #2427: on an RX 9070 XT with heap windows,
XCL_HEAP_FLAT=1makes AMD'sCreateComputePipelineStateabout 11 % faster over 26 large retail compute programs and lowers peak memory. One catch first:xcl shaders --precompilenever setsHEAP_FLAT, so offline the switch does nothing.The offline tool:
pso::mem_windowsaddsHEAP_FLAT, butshaders.rs'sruntime_windowsbuilds its own count (windows | HEAP_WINDOWS). With this PR as is,XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 xcl shaders --precompilegives the same bytes as without the switch for all 2,689 programs. So with the switch on, what the offline precompile caches would not be what the runtime looks for. For the numbers below I added| if recomp::pso::heap_flat() { recomp::HEAP_FLAT } else { 0 }toruntime_windowslocally.Setup
main08db802, plus the one-line hookup above and a local timing patch that writes each program's DXIL size and eachCreateComputePipelineStatetime to a file. Measured atd356a74and again at the current headf8b3191; the numbers below are fromf8b3191(d356a74gave the same sizes and a 10.5 % driver gain). One binary for both arms; only the switch differs.xcl shaders <retail shaders.rpf> --precompile --only cs --pipelineswithXCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=1,XCL_PSO_DISK_CACHE=0, one driver thread, a fresh translation cache and a fresh executable name for every run (the AMD driver keys its own cache on the exe name, so every build is cold).DXIL size, all 2,689 compute programs, heap windows (translation only)
XCL_HEAP_FLAT=1main)Driver time, 26 large programs, 2 interleaved rounds (off, on, then on, off)
XCL_HEAP_FLAT=1Mean 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:
620491641aa9bad66d1e4583f81297717c08ec6429245b8e6f3a2502a8d6b12983a3df882bebfdabNot measured:
95cc13288a27a96e(ActivateRays, 17.6 GB with heap windows on #2375), GPU output, and a title run.AI use: Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this report; I posted it.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-26T01:55:36Z.
@bmjask thanks for the review.
Rebased. This PR is now
c8c2b7a6, onmain6d12f58a, so #2368 is in its base. The suite on that head: 1426 passed, 0 failed, 46 ignored.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,
kernel::reads_heap_flat). Mesh and GS passes read flat before withXCL_HEAP_WINDOWS=1; now they keep the guarded form.only_compute_programs_read_heap_windows_flatcovers it (@pvfreis's point).Regression pair (in the body), on
c8c2b7a6againstmainb49be18, 120 s,XCL_DIRECT_DXIL=1: no removal or crash, 87.6 % ofmain's frames (1522 against 1738) and 101.7 % of its peak commit.XCL_HEAP_FLATtitle run: this head withXCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1, 60 s, one run. There was no device removal and no crash, 1474 frames, still presenting at the end, and a peak commit of 17993 MB. @Eterst ran a title with this PR and #2496 together on an RTX 4070 SUPER (#2496, comment 7176075746): no device removal up to 395 s, wheremain06055a7lost the device at 261–303 s in four runs. That run is not separated from #2496, and it is one run.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):
xcl shaders --precompilenow keys this form as the runtime does.AI use: Claude Code (Claude Opus 5.5) made the changes and measurements and wrote this reply.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-26T01:55:38Z.
@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
main6d12f58ais queued: RTX 5070 Ti (610.74), cold, A B B A, in four forms (the old switch, #2368's select form, the guarded heap form and the flat heap form). Until it lands, the bodies state each claim against the form it was measured against:heap_windowscomment.2. Scope. Also right: with
XCL_HEAP_WINDOWS=1, the mesh and GS compute passes read flat too, and that form was never timed or GPU-tested. I narrowed the code rather than the claim. Flat reads are now for kernel and CS entries only (kernel::reads_heap_flat), and mesh, GS, VS and PS keep the guarded form. A test,only_compute_programs_read_heap_windows_flat, covers it. It is in #2427's commit, nowf8b31918.Your other results. Your suite (1429 passed, 1 failed, 46 ignored; only e2e
presentsfails, and it fails onmaintoo) and the native sizes are in the bodies under Tested by others, with a link to your comment. On the repeat check: I haven't looked into why blob contents differ between runs either. The sizes were equal 60/60, and the size claims use only sizes.AI use: Claude Code (Claude Opus 5.5) made the changes and the measurements and wrote this reply.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-26T02:20:28Z.
@bielfreedom thank you, that is a real bug, and the AMD timing is very useful.
The fix, in this PR's commit, now
c8c2b7a6:xcl shaders(--precompile,--export-hlsl,--measure-pso) no longer has its own copy of the window rule. It takes its windows frompso::windows_for, the same functionpso::mem_windowsuses at run time. WithXCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1, the precompile now makes the entries the runtime looks up.shaders::tests::precompile_windows_are_the_runtimes, runs withXCL_HEAP_WINDOWS=1andXCL_HEAP_FLAT=1or0in a new process, since both switches are read once. It checks that the precompile's windows are the runtime's. With the old copy it fails: 260 (noHEAP_FLAT) against 772.HEAP_FLAT. It is rebased onto the fix and keeps one shared function (pso::compute_windows) for the precompile and the runtime. The same test runs there.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
CreateComputePipelineStatetime over 26 large programs, with lower peak memory and no failures.AI use: Claude Code (Claude Opus 5.5) made the fix and the test and wrote this reply.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T02:22:10Z.
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 bielfreedom on 2026-11-26T02:42:15Z.
@Kalmarv confirmed on the RX 9070 XT: at
c8c2b7a, with no local change,XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 xcl shaders --precompilenow makes the flat form.mainb49be18. Only my timing patch is added: it writes eachCreateComputePipelineStatetime to a file.AI use: Claude Code (Claude Opus 5.5) built the binary, ran the measurements and wrote this; I posted it.
Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-26T03:01:39Z.
Follow-up, by reading only, not run, at
c8c2b7a6and #2428970823e4. Both points are addressed.heap_windowscomment. Each remaining build-time figure names the form it was measured against (the guarded heap form, or the switch from before #2368). Still open, as both bodies say: build time against #2368's form.heap_flatis set in one place (kernel.rs:537), fromreads_heap_flat, which is true only for kernel and CS entries, andwith_mem_i32sis its only reader. Mesh and GS passes are translated asEntry::Mesh/Entry::Geometry, so they keep the guarded form withXCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1. In #2428 they take heap windows only withXCL_HEAP_WINDOWS=1(pso::mem_windows).AI use: Claude Code (Claude Opus 5.5) checked this; Claude Fable 5.2 reviewed it; checked by a person before posting.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-26T03:02:48Z.
@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,
kernel::reads_heap_flat), andonly_compute_programs_read_heap_windows_flattests it. #2428's description says so under How it decides: graphics, mesh and GS take heap windows only withXCL_HEAP_WINDOWS=1, throughpso::mem_windows. On the open item, build time against #2368's form, the same-job rerun of the five programs is still queued.AI use: Claude Code (Claude Opus 5.5) wrote this reply.
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T20:31:14Z.
8 GB NVIDIA run on the current head
c8c2b7a6(basemain6d12f58a, merge-base6d12f58a): RTX 3070 8 GB (Ampere, wave32, driver 616.56), Windows 11 26100, rustc 1.100.0, debug. Ryzen 9 5950X, 32 GB RAM.XCL_HEAP_FLAT=1(XCL_HEAP_WINDOWS unset), 3 of 3 runs:gpu_heap_flat_reads_match_the_switch_formandonly_compute_programs_read_heap_windows_flatpassed, none skipped.XCL_HEAP_FLAT=1 cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4: 1292 passed, 0 failed, 26 ignored, 9 filtered out. 25 SKIPPED: 21 no wave64, 3 wave32 per-lane f16 forms, 1 needs Developer Mode to disable the driver cache.Tests only: no title run, no compile timing (driver cache cannot be disabled here).
AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
Imported from ivall/xcl. Originally posted by itsd-effex on 2026-11-27T00:21:27Z.
Interaction with #2555 (startup preparation, now on main):
prepare_for_launchbuilds its window flags by hand,so with this PR and
XCL_HEAP_FLAT=1it translates every compute program withoutHEAP_FLAT, while the runtime asks for the program with it (pso::windows_for). Each prepared compute program is then a translation the title never uses, and the driver compiles it cold at every launch until the caches hold both forms.Measured on Linux (Wine + vkd3d-proton, NVIDIA, wave32), this PR on a branch merged with main
8b957bec, a retail title (title.exe), caches filled beforehand byxcl pipelineswith the same settings:…_Compute_0_260_1(precompile and runtime:…_772_1)…_Compute_0_772_1Fix: take the runtime's helper, as
xcl shaders --precompilealready does (runtime_windows):with a test that runs itself in a child process with
XCL_HEAP_WINDOWS=1andXCL_HEAP_FLAT=1/0(the switches are read once), mirroringprecompile_windows_are_the_runtimes. Happy to push it as a commit for this PR if that helps; on main without this PR the flags agree, so the fix only matters once both are in.AI use
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T00:38:45Z.
Tested: Clean
c8c2b7a6b19d86aa3774dc62dfc2bb13b6aafac7, Windows 11 build 26200.9974, Ryzen 7 3800X, Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC, DXC/DXIL 1.9.2602.17, debug.cargo test -j 2 -p xcl --lib --no-run; eight exact compiler/layout tests passed. Across ten Arc fixture invocations, libtest reported 9 passed and 1 failed, with one of the nine passes being the native-wave64 capability skip. The four-window direct DXIL fixture matched flat heap, guarded heap, and root UAV readbacks for all 64 logical lanes. The HLSL heap variant ofgpu_heap_windows_divergent_lanes_match_switch_formproduced 43 window-0 atomic increments, expected 22. It failed the same way on the exact parent6d12f58a229bc73889878a448c64dc3af25eeba0; the assertion stops before that fixture's Direct DXIL cases.Not tested: 8- and 16-window GPU execution, workspace suite, release, retail smoke and performance.
AI use: T3 Code / Codex (
gpt-6.2-sol) ran and reran the fixtures and wrote this report.Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T03:58:31Z.
Independent desktop NVIDIA verification of PR #2427 at head
c8c2b7a6b19d86aa3774dc62dfc2bb13b6aafac7(1commit; exact parent & merge-base:6d12f58a229bc73889878a448c64dc3af25eeba0, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
c8c2b7a6)cargo test --release -p xcl --lib only_compute_programs_read_heap_windows_flat -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1326 filtered out× 3 (0.00s× 3,0skipped)cargo test --release -p xcl --lib gpu_heap_flat_reads_match_the_switch_form -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1326 filtered out× 3 (0.27s,0.19s,0.19s,0skipped; live RTX 4060 execution)cargo test --release -p xcl --lib precompile_windows_are_the_runtimes -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1326 filtered out× 3 (0.02s× 3,0skipped)cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4(3 consecutive runs)184 passed; 0 failed; 3 ignored; 1140 filtered out× 3 (3.81s,3.61s,4.02s;1self-skipped:dispatch_chain_native_wave64_builds_whole—no wave64on Wave32-only Ada;183executed)cargo test --release -p xcl --lib shaders::(3 consecutive runs)11 passed; 0 failed; 0 ignored; 1316 filtered out× 3 (0.19s,0.19s,0.18s;1self-skipped:pso_measurement_compiles_an_exact_synthetic_record— Windows Developer Mode off;10executed)cargo build --release -p xcl1m 10s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
6d12f58a229bc73889878a448c64dc3af25eeba0, cached baseline on the same machine):PR #2427 (
c8c2b7a6b19d86aa3774dc62dfc2bb13b6aafac7, default flags):Runtime log observations (
xcl.log)9223log lines,0[ERROR]/ device-removal / panic lines (dxil_cache:460hits,0misses,0compilation failures;228background pipelines,0failures).19435 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14023 MB committed by the process; video memory 6114 MB local, 4683 MB non-local.Limits of coverage
HEAP_FLATgating,xcl shadersprecompile/runtime window-flag parity, and on-GPUHEAP_FLATvs. guarded switch-form equivalence were directly exercised on the RTX 4060 via all 3 new tests (3/3each,0skipped).XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1), confirming default-path non-regression (single-run frame/commit delta vs. cached parent reflects normal startup variance, not this PR); NVIDIA driver compile-time reduction on large retail compute shaders underXCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1was not separately benchmarked here.gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole(no wave64on Wave32-only Ada) andshaders::tests::pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode off).AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-27T06:14:05Z.
NVIDIA and AMD full-suite run, to go with the reports above by Decodere, JJAutoCompare, upipibi, since none of them covers AMD. Tested exact head
c8c2b7a6(on its base6d12f58).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace --no-fail-fast -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1414 passed, 0 failed, 44 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,dispatch_chain_native_wave64_builds_whole,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.only_compute_programs_read_heap_windows_flat,gpu_heap_flat_reads_match_the_switch_form,precompile_windows_are_the_runtimes.XCL_ADAPTER=radeon),cargo test --workspace --no-fail-fast -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1425 passed, 0 failed, 46 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on mainc2ee10e4too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T22:28:33Z.
merge-check claim
head:
c8c2b7a6b1Imported from ivall/xcl. Originally posted by throny on 2026-11-27T23:13:00Z.
merge-check
base:
2c717a04head:
c8c2b7a6b1merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1469 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1466 passed, 0 failed, 47 ignored
review: one gap, not a correctness risk: shaders::prepare_for_launch on main (shaders.rs:1817) still has its own rule for the window flags (it adds HEAP_WINDOWS, never HEAP_FLAT) and the PR does not touch it, so with XCL_HEAP_FLAT=1 the launcher prepares entries in the guarded form that the runtime never looks up; pso::windows_for there is a one-line fix (the same point was fixed for 'xcl shaders' in this PR). Bounds: a lane outside the windows, or not under the guard, reads window 0's raw view at its own offset; that view is bounds-checked by D3D12, so a read past it returns 0, and a select sets the value to 0 anyway; it cannot read outside the buffer, and the results match the guarded form. The new GPU test covers out-of-window and inactive lanes.
performance: off by default (needs XCL_HEAP_FLAT=1 and XCL_HEAP_WINDOWS=1), default cache keys unchanged; it does change translator sources, so every tester re-translates once. When on, every lane runs every read (more memory traffic, no branches); not measured here.
verdict: safe to merge (with the launcher line as a follow-up, or in this PR if the author prefers)
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T14:50:19Z.
Current-main audit (2026-11-29): already implemented; please close this PR.
Current
maincontains2f523330ae160ccca151bd6e0417a4bafbfd0d43(Recompiler: flatten direct-DXIL compute heap reads), explicitly adapted from #2427.XCL_HEAP_FLAT, the compute-only branchless heap-read path, cache identity handling, offline/runtime window agreement, and tests are present.No remaining code from this old conflicted head should be merged. Enabling the already-carried opt-in form intentionally creates distinct DXIL/PSO cache entries; leaving it unset preserves the guarded form's entries.
Review assisted by Codex; exact model name was not exposed in this session.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:10:37Z.
Review (head
c8c2b7a6, diff read, not a merge-check; it conflicts with main, so not built or run):2f523330("Recompiler: flatten direct-DXIL compute heap reads", merged with #2959) says it's adapted from this PR, and main now has the flat read inwith_mem_i32s(lower_mem.rs~408),reads_heap_flatand its test (kernel.rs~169),HEAP_FLAT/XCL_HEAP_FLAT(recomp/mod.rs~97,pso.rs~198) and the precompile-windows test (shaders.rs~4983). Main went further:e8f7164bkeepsHEAP_FLATout of graphics cache keys,3e2a48ecadds a flat vs guarded vs root-UAV GPU test with this PR's cases, andb5973e3e/644b5188extend the flat form.Fine: the design and measurements here are what main's version is built on. Recommendation: close as superseded by
2f523330(and #2428 should drop it as its base commit).AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:52:53Z.
Closing as superseded: this change is already on
main(2f523330). main2f523330'flatten direct-DXIL compute heap reads' is adapted from this PR: reads_heap_flat in dxil/kernel.rs, HEAP_FLAT 0x200 flag, same test only_compute_programs_read_heap_windows_flatTwo 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