Recompiler: direct DXIL reads heap memory windows without a branch #2427

Open
github-bot wants to merge 1 commit from github-bot/gh-2427 into main AGit
Owner

@⁠Kalmarv on GitHub · 2026-11-25 18:37 UTC · original
Kalmarv:heap-flat-loads → main · +180 −12 · 7 files · 1 commits · open

Part of #2088.

With heap memory windows (XCL_HEAP_WINDOWS=1), every read in a direct-DXIL compute program is a branch on w < 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:

  • The read: each lane reads from window w's heap view. It uses window 0 instead when w is 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.
  • Credit: the one-path idea (a clamped index instead of a branch) is the one @⁠brothernog brings to the HLSL heap form in #1695. Reading through a select instead of a branch is the same direction as @⁠coolpersonnn's #2368 for root UAVs. This PR applies it to the direct translator's heap form.
  • Cache keys: the new HEAP_FLAT flag is in the windows count, so the caches keep the forms apart.
  • Scope: compute programs only (kernel and CS entries, 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 the with_mem_i32s callers). 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 onto 6d12f58a. Its switch column is the form from before #2368; main now 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:

  • Programs: five large compute programs from title: ea3b5e4d.
  • One job: all three forms come from the same translator build: the switch over root UAVs (before #2368), the guarded heap form, and this PR's flat heap form.
  • Order: each program is built in the order switch, guarded, flat, flat, guarded, switch.
  • Cells: both runs, then their mean, in seconds.
program switch (before #2368) heap, guarded heap, flat (this PR) native code: switch / guarded / flat
RT resolve A 36.4 / 29.7 → 33.1 29.4 / 12.6 → 21.0 12.0 / 12.4 → 12.2 1242 / 955 / 941 KB
RT resolve B 31.5 / 31.6 → 31.5 14.2 / 14.2 → 14.2 8.9 / 8.5 → 8.7 1365 / 1051 / 1027 KB
local lights 6.4 / 6.3 → 6.3 2.9 / 2.8 → 2.9 1.9 / 1.9 → 1.9 460 / 374 / 356 KB
cascade shadows A 51.5 / 53.8 → 52.7 101.1 / 82.8 → 92.0 29.0 / 37.8 → 33.4 2408 / 2153 / 2092 KB
cascade shadows B 13.8 / 11.5 → 12.7 14.3 / 14.2 → 14.2 8.2 / 8.2 → 8.2 1252 / 1138 / 1117 KB
  • Against the guarded form: flat builds 34–64 % faster on all five programs. On RT resolve A, the guarded form took 29.4 s once and 12.6 s once.
  • Against the switch from before #2368: flat builds 1.5–3.6 times as fast. Against #2368's form it is not measured natively.
  • Only large programs: these five are all the compile-time evidence I have. Whether the gain holds for smaller programs is not measured.
  • On another card: @⁠Raghav314 timed the heap form with and without its guard in one process on an RTX 4090 (#2088). The two programs took 20.0 vs 18.8 s and 7.1 vs 5.2 s, a much smaller gain than here. The difference is not explained. Their card, driver and translator revision differ from this run.
  • Under Wine and vkd3d-proton: @⁠Royalflamejlh's times (#2428, comment 7179985117) did not separate from the spread between runs, except for the two largest programs. That run compares this form, as #2428's default, with main's root UAVs.
  • Native code: the driver's compiled code (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.
  • The cascade shadows programs: they are wave64 groups of several waves. Most of their remaining time is the split form's exchange between the two halves, which this PR does not touch.

What is in it

  • gpu/dxil/lower_mem.rs: the one-path read in with_mem_i32s.
  • gpu/dxil/kernel.rs, gpu/dxil/lower.rs: heap_flat in Lw. kernel::reads_heap_flat sets it for kernel and CS entries with HEAP_FLAT and heap windows. Test: only_compute_programs_read_heap_windows_flat.
  • gpu/recomp/mod.rs, gpu/recomp/pso.rs: the HEAP_FLAT flag and XCL_HEAP_FLAT=1. The HLSL path strips the flag the way it strips HEAP_WINDOWS. pso::windows_for gives the windows of n for this run; mem_windows takes it.
  • shaders.rs: xcl shaders (--precompile, --export-hlsl, --measure-pso) takes its windows from pso::windows_for too, 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). Test: precompile_windows_are_the_runtimes runs with XCL_HEAP_WINDOWS=1 and XCL_HEAP_FLAT=1 or 0 in 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.
    • It runs one program in all three forms (switch, guarded heap, flat heap) over a 4-window arena and compares SGPRs and VGPRs.
    • The program has SMEM loads into window 2 and outside the UMA, an s_buffer_load_dwordx4 from window 3, a buffer_load from window 1, and per-lane global_loads spread over all four windows.
    • Every eighth lane reads outside the UMA, lanes 0–32 are inactive (v_cmpx), and there is a SADDR global_load_dwordx2.

Tested

  • Ryzen 9 9950X, RTX 5070 Ti (NVIDIA 610.74), Windows 11 build 26200, rustc 1.99.0, DXC 1.9.2609, debug.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on this head, c8c2b7a6 (on main 6d12f58a): 1426 passed, 0 failed, 46 ignored.
    • 25 SKIPPED notices: 21 for no wave64, 3 for wave32 per-lane forms refused by the #1426 list (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_flat and precompile_windows_are_the_runtimes pass.
  • Title run with the form on, this head, 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 no main run 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.

    • Native code over 60 records: guarded heap 42.19 MB, flat heap 41.11 MB, a ratio of 0.974 (0.901–1.039 per record). 12 of the 60 are larger with this form.
    • Repeat builds had the same sizes but different contents for 18 and 8 of the 60.
    • No build times.
  • @⁠Eterst (#2496, comment 7176075746): RTX 4070 SUPER 12 GB, NVIDIA 616.92, Windows 10 19045, release.

    • Build: 6d12f58 with #2496 78bba5c and this PR's d356a74.
    • Settings: XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, split off, a full precompile with the same switches, then a title run with XCL_WINDOW_NO_CARRY=1 XCL_HEAP_FLAT=1.
    • Before (main 06055a7): four runs lost the device (0x887a0005) at 261–303 s.
    • With both PRs: one run, no device removal up to 395 s. Their RAM guard stopped it at 418 s.
    • Precompiled compute driver code: 2,227 programs and 905 MB before, 2,565 programs and 757 MB after.
    • Caveats:
      • This PR and #2496 are not separated, and it is one run.
      • The two rows have different program sets and different bases.
      • There is no counter of the code bound at the removal point.
  • @⁠bielfreedom (comment 7180279957): RX 9070 XT 16 GB (RDNA4), AMD driver 32.0.32029.2010, Ryzen 7 7700, 32 GB, Windows 11, release.

    • Build: this PR (f8b3191) on main 08db802. 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 and CreateComputePipelineState time.
    • Settings: xcl shaders --precompile --only cs --pipelines with XCL_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.
    • DXIL, all 2,689 compute programs: 728.9 MB guarded, 702.1 MB flat (−3.7 %); 2,639 programs changed.
    • AMD driver time, 26 large programs, two interleaved rounds: 73.5 s guarded, 65.2 s flat on average (−11 %). Peak memory was 1.62 / 1.63 GB guarded and 1.24 / 1.36 GB flat, and no pipeline failed. On d356a74 the sizes were the same and the gain was 10.5 %.
    • Not measured there: GPU output and a title run.
    • On this head, c8c2b7a, with no local change (comment 7181043742), merged onto main b49be18 with only their timing patch:
      • XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 xcl shaders --precompile now 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.
      • Driver, the same 26 large programs, two interleaved rounds: flag off, 66 pipelines, 91.6 / 100.2 s, peak 1.62 GB; flag on, 65 pipelines, 85.8 / 86.9 s, peak 1.34 / 1.27 GB. No failures, mean −10 %. Both arms were slower than in their first run because the machine was busier.

Regression run

  • Setup: scripts/smoke.ps1 through our run script, 120 s, release builds, XCL_DIRECT_DXIL=1, in one queue job: main b49be18, 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.
  • Beside it: it ran beside a CPU-bound precompile on the same machine (an offline xcl shaders --precompile count, through both sides), and another agent's GPU test suite ran beside the main side only (about 60 of its 120 s).
  • Result: no device removal and no crash. This PR showed 87.6 % of 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.

main b49be18:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 120
exit: 0x0
frames shown: 1738 (PresentX 1738)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 28514 MB

This PR (c8c2b7a6):

xcl-smoke v1
commit: c8c2b7a6b19d86aa3774dc62dfc2bb13b6aafac7
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 120
exit: 0x0
frames shown: 1522 (PresentX 1522)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 28999 MB

Not tested

  • A title run with the form on that is longer than 60 s, or compared with main over the same time.
  • Compile time against #2368's form, and for programs other than the five large ones.
  • Intel and Linux. AMD: only @⁠bielfreedom's precompile timing, no title run.
  • Graphics stages: they keep the guarded form. #2368 measured a select-flattened form as slower for NVIDIA pixel shaders, so extending this form to them needs its own timing.

AI use

  • Claude Code (Claude Opus 5.5) wrote the change, the test and this description, made the measurements and ran the tests.

🤖 Generated with Claude Code

**@⁠Kalmarv** on GitHub · 2026-11-25 18:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427) `Kalmarv:heap-flat-loads` → `main` · +180 −12 · 7 files · 1 commits · open Part of #2088. With heap memory windows (`XCL_HEAP_WINDOWS=1`), every read in a direct-DXIL compute program is a branch on `w < 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: - **The read:** each lane reads from window `w`'s heap view. It uses window 0 instead when `w` is 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. - **Credit:** the one-path idea (a clamped index instead of a branch) is the one @⁠brothernog brings to the HLSL heap form in #1695. Reading through a select instead of a branch is the same direction as @⁠coolpersonnn's #2368 for root UAVs. This PR applies it to the direct translator's heap form. - **Cache keys:** the new `HEAP_FLAT` flag is in the windows count, so the caches keep the forms apart. - **Scope:** compute programs only (kernel and CS entries, `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 the `with_mem_i32s` callers). 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 onto 6d12f58a. Its switch column is the form from before #2368; `main` now 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: - **Programs:** five large compute programs from title: ea3b5e4d. - **One job:** all three forms come from the same translator build: the switch over root UAVs (before #2368), the guarded heap form, and this PR's flat heap form. - **Order:** each program is built in the order switch, guarded, flat, flat, guarded, switch. - **Cells:** both runs, then their mean, in seconds. | program | switch (before #2368) | heap, guarded | heap, flat (this PR) | native code: switch / guarded / flat | |---|---|---|---|---| | RT resolve A | 36.4 / 29.7 → 33.1 | 29.4 / 12.6 → 21.0 | **12.0 / 12.4 → 12.2** | 1242 / 955 / 941 KB | | RT resolve B | 31.5 / 31.6 → 31.5 | 14.2 / 14.2 → 14.2 | **8.9 / 8.5 → 8.7** | 1365 / 1051 / 1027 KB | | local lights | 6.4 / 6.3 → 6.3 | 2.9 / 2.8 → 2.9 | **1.9 / 1.9 → 1.9** | 460 / 374 / 356 KB | | cascade shadows A | 51.5 / 53.8 → 52.7 | 101.1 / 82.8 → 92.0 | **29.0 / 37.8 → 33.4** | 2408 / 2153 / 2092 KB | | cascade shadows B | 13.8 / 11.5 → 12.7 | 14.3 / 14.2 → 14.2 | **8.2 / 8.2 → 8.2** | 1252 / 1138 / 1117 KB | - **Against the guarded form:** flat builds 34–64 % faster on all five programs. On RT resolve A, the guarded form took 29.4 s once and 12.6 s once. - **Against the switch from before #2368:** flat builds 1.5–3.6 times as fast. Against #2368's form it is not measured natively. - **Only large programs:** these five are all the compile-time evidence I have. Whether the gain holds for smaller programs is not measured. - **On another card:** @⁠Raghav314 timed the heap form with and without its guard in one process on an RTX 4090 (#2088). The two programs took 20.0 vs 18.8 s and 7.1 vs 5.2 s, a much smaller gain than here. The difference is not explained. Their card, driver and translator revision differ from this run. - **Under Wine and vkd3d-proton:** @⁠Royalflamejlh's times (#2428, comment 7179985117) did not separate from the spread between runs, except for the two largest programs. That run compares this form, as #2428's default, with `main`'s root UAVs. - **Native code:** the driver's compiled code (`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. - **The cascade shadows programs:** they are wave64 groups of several waves. Most of their remaining time is the split form's exchange between the two halves, which this PR does not touch. **What is in it** - `gpu/dxil/lower_mem.rs`: the one-path read in `with_mem_i32s`. - `gpu/dxil/kernel.rs`, `gpu/dxil/lower.rs`: `heap_flat` in `Lw`. `kernel::reads_heap_flat` sets it for kernel and CS entries with `HEAP_FLAT` and heap windows. Test: `only_compute_programs_read_heap_windows_flat`. - `gpu/recomp/mod.rs`, `gpu/recomp/pso.rs`: the `HEAP_FLAT` flag and `XCL_HEAP_FLAT=1`. The HLSL path strips the flag the way it strips `HEAP_WINDOWS`. `pso::windows_for` gives the windows of `n` for this run; `mem_windows` takes it. - `shaders.rs`: `xcl shaders` (`--precompile`, `--export-hlsl`, `--measure-pso`) takes its windows from `pso::windows_for` too, 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). Test: `precompile_windows_are_the_runtimes` runs with `XCL_HEAP_WINDOWS=1` and `XCL_HEAP_FLAT=1` or `0` in 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`. - It runs one program in all three forms (switch, guarded heap, flat heap) over a 4-window arena and compares SGPRs and VGPRs. - The program has SMEM loads into window 2 and outside the UMA, an `s_buffer_load_dwordx4` from window 3, a `buffer_load` from window 1, and per-lane `global_load`s spread over all four windows. - Every eighth lane reads outside the UMA, lanes 0–32 are inactive (`v_cmpx`), and there is a SADDR `global_load_dwordx2`. **Tested** - Ryzen 9 9950X, RTX 5070 Ti (NVIDIA 610.74), Windows 11 build 26200, rustc 1.99.0, DXC 1.9.2609, debug. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on this head, c8c2b7a6 (on `main` 6d12f58a): 1426 passed, 0 failed, 46 ignored. - 25 SKIPPED notices: 21 for no wave64, 3 for wave32 per-lane forms refused by the #1426 list (`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_flat` and `precompile_windows_are_the_runtimes` pass. - Title run with the form on, this head, `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 no `main` run 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. - Native code over 60 records: guarded heap 42.19 MB, flat heap 41.11 MB, a ratio of 0.974 (0.901–1.039 per record). 12 of the 60 are larger with this form. - Repeat builds had the same sizes but different contents for 18 and 8 of the 60. - No build times. - **@⁠Eterst** (#2496, comment 7176075746): RTX 4070 SUPER 12 GB, NVIDIA 616.92, Windows 10 19045, release. - **Build:** 6d12f58 with #2496 78bba5c and this PR's d356a74. - **Settings:** `XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1`, split off, a full precompile with the same switches, then a title run with `XCL_WINDOW_NO_CARRY=1 XCL_HEAP_FLAT=1`. - **Before** (`main` 06055a7): four runs lost the device (`0x887a0005`) at 261–303 s. - **With both PRs:** one run, no device removal up to 395 s. Their RAM guard stopped it at 418 s. - **Precompiled compute driver code:** 2,227 programs and 905 MB before, 2,565 programs and 757 MB after. - **Caveats:** - This PR and #2496 are not separated, and it is one run. - The two rows have different program sets and different bases. - There is no counter of the code bound at the removal point. - **@⁠bielfreedom** (comment 7180279957): RX 9070 XT 16 GB (RDNA4), AMD driver 32.0.32029.2010, Ryzen 7 7700, 32 GB, Windows 11, release. - **Build:** this PR (f8b3191) on `main` 08db802. 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 and `CreateComputePipelineState` time. - **Settings:** `xcl shaders --precompile --only cs --pipelines` with `XCL_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. - **DXIL, all 2,689 compute programs:** 728.9 MB guarded, 702.1 MB flat (−3.7 %); 2,639 programs changed. - **AMD driver time, 26 large programs, two interleaved rounds:** 73.5 s guarded, 65.2 s flat on average (−11 %). Peak memory was 1.62 / 1.63 GB guarded and 1.24 / 1.36 GB flat, and no pipeline failed. On d356a74 the sizes were the same and the gain was 10.5 %. - Not measured there: GPU output and a title run. - **On this head, c8c2b7a, with no local change** (comment 7181043742), merged onto `main` b49be18 with only their timing patch: - `XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 xcl shaders --precompile` now 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. - Driver, the same 26 large programs, two interleaved rounds: flag off, 66 pipelines, 91.6 / 100.2 s, peak 1.62 GB; flag on, 65 pipelines, 85.8 / 86.9 s, peak 1.34 / 1.27 GB. No failures, mean −10 %. Both arms were slower than in their first run because the machine was busier. **Regression run** - **Setup:** `scripts/smoke.ps1` through our run script, 120 s, release builds, `XCL_DIRECT_DXIL=1`, in one queue job: `main` b49be18, 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. - **Beside it:** it ran beside a CPU-bound precompile on the same machine (an offline `xcl shaders --precompile` count, through both sides), and another agent's GPU test suite ran beside the `main` side only (about 60 of its 120 s). - **Result:** no device removal and no crash. This PR showed 87.6 % of `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. `main` b49be18: ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 120 exit: 0x0 frames shown: 1738 (PresentX 1738) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 28514 MB ``` This PR (c8c2b7a6): ``` xcl-smoke v1 commit: c8c2b7a6b19d86aa3774dc62dfc2bb13b6aafac7 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 120 exit: 0x0 frames shown: 1522 (PresentX 1522) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 28999 MB ``` **Not tested** - A title run with the form on that is longer than 60 s, or compared with `main` over the same time. - Compile time against #2368's form, and for programs other than the five large ones. - Intel and Linux. AMD: only @⁠bielfreedom's precompile timing, no title run. - Graphics stages: they keep the guarded form. #2368 measured a select-flattened form as slower for NVIDIA pixel shaders, so extending this form to them needs its own timing. **AI use** - Claude Code (Claude Opus 5.5) wrote the change, the test and this description, made the measurements and ran the tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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 #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) <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:30:36 +00:00
Author
Owner

@⁠FIJI1299 on GitHub · 2026-11-25 18:49 UTC · original

Tested commit 717fec5 on Windows:

Environment

  • OS: Windows 11 (Build 26100)
  • CPU: AMD Ryzen 5 9600X 6-Core Processor
  • RAM: 32 GB
  • GPU: NVIDIA GeForce RTX 5070 (12 GB VRAM, driver 621.40, wave32)
  • DXC: 1.8.2502.11 (Windows SDK 10.0.26100.0)

Results

  • Library test suite (cargo test -p xcl --lib -- --skip fuzz_validate_and_gpu): 1216 passed, 1 failed, 26 ignored, 4 filtered out (14.73s).
  • New XCL_HEAP_FLAT / XCL_HEAP_WINDOWS GPU tests: Passed cleanly on native wave32 NVIDIA hardware.
  • Unrelated / pre-existing failures on 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 driver E_OUTOFMEMORY 0x8007000E on non-constant groupshared atomic subtract tracked in #1905 / #1919).
**@⁠FIJI1299** on GitHub · 2026-11-25 18:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7171444750) Tested commit `717fec5` on Windows: ### Environment * **OS:** Windows 11 (Build 26100) * **CPU:** AMD Ryzen 5 9600X 6-Core Processor * **RAM:** 32 GB * **GPU:** NVIDIA GeForce RTX 5070 (12 GB VRAM, driver `621.40`, `wave32`) * **DXC:** `1.8.2502.11` (Windows SDK `10.0.26100.0`) ### Results * **Library test suite (`cargo test -p xcl --lib -- --skip fuzz_validate_and_gpu`):** **1216 passed, 1 failed, 26 ignored, 4 filtered out** (`14.73s`). * **New `XCL_HEAP_FLAT` / `XCL_HEAP_WINDOWS` GPU tests:** Passed cleanly on native `wave32` NVIDIA hardware. * **Unrelated / pre-existing failures on `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 driver `E_OUTOFMEMORY` `0x8007000E` on non-constant `groupshared` atomic subtract tracked in #1905 / #1919).
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 19:18 UTC · original

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 target x86_64-pc-windows-gnu run 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 new gpu_promoted_uav_clear_values_pass_create_committed_resource failure 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.

**@⁠SlopTart** on GitHub · 2026-11-25 19:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7172123370) **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 target `x86_64-pc-windows-gnu` run 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 new `gpu_promoted_uav_clear_values_pass_create_committed_resource` failure that current main carries ([reported here](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2280)), 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 20:04 UTC · original

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!

**@⁠DavidM1911** on GitHub · 2026-11-25 20:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7173154823) 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!
Author
Owner

@⁠pvfreis on GitHub · 2026-11-25 22:24 UTC · original

By reading only, at d356a74 and #2428 ab2855f:

  1. Baseline. The table (last edited 18:40 UTC, on 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 and heap_windows comment) and 11–25 %, are not against the form #2428's default replaces now. Rerunning the five programs on the current base would settle it.
  2. Scope. "Mesh and GS programs … are unchanged" does not hold: heap_flat is off only for Entry::Vertex | Entry::Pixel, so with XCL_HEAP_WINDOWS=1 and 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.

**@⁠pvfreis** on GitHub · 2026-11-25 22:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7176315721) By reading only, at `d356a74` and #2428 `ab2855f`: 1. **Baseline.** The table (last edited 18:40 UTC, on `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 and `heap_windows` comment) and 11–25 %, are not against the form #2428's default replaces now. Rerunning the five programs on the current base would settle it. 2. **Scope.** "Mesh and GS programs … are unchanged" does not hold: `heap_flat` is off only for `Entry::Vertex | Entry::Pixel`, so with `XCL_HEAP_WINDOWS=1` and 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.
Author
Owner

@⁠bielfreedom on GitHub · 2026-11-26 01:55 UTC · original

AMD Windows driver timing for #2427: on an RX 9070 XT with heap windows, XCL_HEAP_FLAT=1 makes AMD's CreateComputePipelineState about 11 % faster over 26 large retail compute programs and lowers peak memory. One catch first: xcl shaders --precompile never sets HEAP_FLAT, so offline the switch does nothing.

The offline tool: pso::mem_windows adds HEAP_FLAT, but shaders.rs's runtime_windows builds its own count (windows | HEAP_WINDOWS). With this PR as is, XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 xcl shaders --precompile gives 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 } to runtime_windows locally.

Setup

  • GPU: RX 9070 XT 16 GB (RDNA4, native wave64), AMD driver 32.0.32029.2010.
  • CPU and memory: Ryzen 7 7700 (16 threads), 32 GB RAM, Windows 11, release.
  • Build: this PR merged onto main 08db802, plus the one-line hookup above and a local timing patch that writes each program's DXIL size and each CreateComputePipelineState time to a file. Measured at d356a74 and again at the current head f8b3191; the numbers below are from f8b3191 (d356a74 gave the same sizes and a 10.5 % driver gain). One binary for both arms; only the switch differs.
  • Offline: xcl shaders <retail shaders.rpf> --precompile --only cs --pipelines with XCL_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)

switch off XCL_HEAP_FLAT=1
total direct DXIL 728.9 MB (same bytes as main) 702.1 MB (−3.7 %)
programs changed 2,639

Driver time, 26 large programs, 2 interleaved rounds (off, on, then on, off)

arm pipelines (incl. split pieces) driver time r1 / r2 peak memory r1 / r2
off 66 73.1 / 73.9 s 1.62 / 1.63 GB
XCL_HEAP_FLAT=1 65 64.8 / 65.5 s 1.24 / 1.36 GB

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:

program DXIL off → on driver ms off driver ms on
620491641aa9bad6 317 → 307 KB 11,277 / 11,625 9,215 / 9,277
6d1e4583f8129771 558 → 545 KB 6,698 / 6,823 6,044 / 6,348
7c08ec6429245b8e 478 → 467 KB 5,694 / 5,729 4,898 / 4,926
6f3a2502a8d6b129 322 → 316 KB 3,449 / 3,456 2,670 / 2,712
83a3df882bebfdab 260 → 255 KB 2,419 / 2,451 1,903 / 1,963

Not 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.

**@⁠bielfreedom** on GitHub · 2026-11-26 01:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7180279957) **AMD Windows driver timing for #2427: on an RX 9070 XT with heap windows, `XCL_HEAP_FLAT=1` makes AMD's `CreateComputePipelineState` about 11 % faster over 26 large retail compute programs and lowers peak memory. One catch first: `xcl shaders --precompile` never sets `HEAP_FLAT`, so offline the switch does nothing.** **The offline tool:** `pso::mem_windows` adds `HEAP_FLAT`, but `shaders.rs`'s `runtime_windows` builds its own count (`windows | HEAP_WINDOWS`). With this PR as is, `XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 xcl shaders --precompile` gives 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 }` to `runtime_windows` locally. **Setup** - GPU: RX 9070 XT 16 GB (RDNA4, native wave64), AMD driver 32.0.32029.2010. - CPU and memory: Ryzen 7 7700 (16 threads), 32 GB RAM, Windows 11, release. - Build: this PR merged onto `main` `08db802`, plus the one-line hookup above and a local timing patch that writes each program's DXIL size and each `CreateComputePipelineState` time to a file. Measured at `d356a74` and again at the current head `f8b3191`; the numbers below are from `f8b3191` (`d356a74` gave the same sizes and a 10.5 % driver gain). One binary for both arms; only the switch differs. - Offline: `xcl shaders <retail shaders.rpf> --precompile --only cs --pipelines` with `XCL_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)** | | switch off | `XCL_HEAP_FLAT=1` | |---|---:|---:| | total direct DXIL | 728.9 MB (same bytes as `main`) | 702.1 MB (−3.7 %) | | programs changed | | 2,639 | **Driver time, 26 large programs, 2 interleaved rounds (off, on, then on, off)** | arm | pipelines (incl. split pieces) | driver time r1 / r2 | peak memory r1 / r2 | |---|---:|---:|---:| | off | 66 | 73.1 / 73.9 s | 1.62 / 1.63 GB | | `XCL_HEAP_FLAT=1` | 65 | 64.8 / 65.5 s | 1.24 / 1.36 GB | 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: | program | DXIL off → on | driver ms off | driver ms on | |---|---:|---:|---:| | `620491641aa9bad6` | 317 → 307 KB | 11,277 / 11,625 | 9,215 / 9,277 | | `6d1e4583f8129771` | 558 → 545 KB | 6,698 / 6,823 | 6,044 / 6,348 | | `7c08ec6429245b8e` | 478 → 467 KB | 5,694 / 5,729 | 4,898 / 4,926 | | `6f3a2502a8d6b129` | 322 → 316 KB | 3,449 / 3,456 | 2,670 / 2,712 | | `83a3df882bebfdab` | 260 → 255 KB | 2,419 / 2,451 | 1,903 / 1,963 | **Not 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.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-26 01:55 UTC · original

@⁠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 main 6d12f58a is 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:

  • #2427 (flat, opt-in) replaces the guarded heap form. On native size that is a small gain: your 0.974 on Ampere (12 of 60 records larger), and 2.4 % in total over the five programs here. That is not the 11–25 % the body quoted against the old switch. Build time against guarded: 34–64 % faster on the five, measured before the rebase.
  • #2428 (flat heap windows by default on NVIDIA compute) replaces #2368's root-UAV form. Its native size claim is now your 0.803 on Ampere (0.465–0.922 per record). Its build-time claim is limited to what was measured: five large programs on native Windows, against the switch from before #2368. The 1.1–3.8 times is gone from the body and from the heap_windows comment.

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, now f8b31918.

Your other results. Your suite (1429 passed, 1 failed, 46 ignored; only e2e presents fails, and it fails on main too) 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.

**@⁠Kalmarv** on GitHub · 2026-11-26 01:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7180287583) @⁠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 `main` 6d12f58a is 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: - **#2427** (flat, opt-in) replaces the guarded heap form. On native size that is a small gain: your 0.974 on Ampere (12 of 60 records larger), and 2.4 % in total over the five programs here. That is not the 11–25 % the body quoted against the old switch. Build time against guarded: 34–64 % faster on the five, measured before the rebase. - **#2428** (flat heap windows by default on NVIDIA compute) replaces #2368's root-UAV form. Its native size claim is now your 0.803 on Ampere (0.465–0.922 per record). Its build-time claim is limited to what was measured: five large programs on native Windows, against the switch from before #2368. The 1.1–3.8 times is gone from the body and from the `heap_windows` comment. **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, now f8b31918. **Your other results.** Your suite (1429 passed, 1 failed, 46 ignored; only e2e `presents` fails, and it fails on `main` too) 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.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-26 02:20 UTC · original

@⁠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 from pso::windows_for, the same function pso::mem_windows uses at run time. With XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1, the precompile now makes the entries the runtime looks up.
  • The precompile's printed window count also leaves out the new flag.
  • A test, shaders::tests::precompile_windows_are_the_runtimes, runs with XCL_HEAP_WINDOWS=1 and XCL_HEAP_FLAT=1 or 0 in 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 (no HEAP_FLAT) against 772.
  • #2428 had its own version of this, which already carried 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 CreateComputePipelineState time 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.

**@⁠Kalmarv** on GitHub · 2026-11-26 02:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7180709208) @⁠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 from `pso::windows_for`, the same function `pso::mem_windows` uses at run time. With `XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1`, the precompile now makes the entries the runtime looks up. - The precompile's printed window count also leaves out the new flag. - A test, `shaders::tests::precompile_windows_are_the_runtimes`, runs with `XCL_HEAP_WINDOWS=1` and `XCL_HEAP_FLAT=1` or `0` in 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 (no `HEAP_FLAT`) against 772. - #2428 had its own version of this, which already carried `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 `CreateComputePipelineState` time 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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 02:22 UTC · original

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

**@⁠DavidM1911** on GitHub · 2026-11-26 02:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7180738939) 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
Author
Owner

@⁠bielfreedom on GitHub · 2026-11-26 02:42 UTC · original

@⁠Kalmarv confirmed on the RX 9070 XT: at c8c2b7a, with no local change, XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 xcl shaders --precompile now makes the flat form.

  • DXIL, all 2,689 compute programs: 728.9 → 702.1 MB (−3.7 %, 2,639 changed). These are the same bytes, program for program, as my earlier run with the hand-added hookup.
  • Driver, the same 26 large programs, 2 interleaved rounds (off, on, then on, off):
    • Flag off: 66 pipelines, 91.6 / 100.2 s, peak 1.62 GB.
    • Flag on: 65 pipelines, 85.8 / 86.9 s, peak 1.34 / 1.27 GB.
    • No failures. Mean −10 %, in line with the −11 % before.
    • Both arms are slower than last night because the machine was busier; the comparison inside the run is what counts.
  • Setup is as in my comment above. This PR is merged onto main b49be18. Only my timing patch is added: it writes each CreateComputePipelineState time to a file.

AI use: Claude Code (Claude Opus 5.5) built the binary, ran the measurements and wrote this; I posted it.

**@⁠bielfreedom** on GitHub · 2026-11-26 02:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7181043742) @⁠Kalmarv confirmed on the RX 9070 XT: at `c8c2b7a`, with no local change, `XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 xcl shaders --precompile` now makes the flat form. - **DXIL, all 2,689 compute programs:** 728.9 → 702.1 MB (−3.7 %, 2,639 changed). These are the same bytes, program for program, as my earlier run with the hand-added hookup. - **Driver, the same 26 large programs, 2 interleaved rounds (off, on, then on, off):** - Flag off: 66 pipelines, 91.6 / 100.2 s, peak 1.62 GB. - Flag on: 65 pipelines, 85.8 / 86.9 s, peak 1.34 / 1.27 GB. - No failures. Mean −10 %, in line with the −11 % before. - Both arms are slower than last night because the machine was busier; the comparison inside the run is what counts. - **Setup** is as in my comment above. This PR is merged onto `main` `b49be18`. Only my timing patch is added: it writes each `CreateComputePipelineState` time to a file. **AI use:** Claude Code (Claude Opus 5.5) built the binary, ran the measurements and wrote this; I posted it.
Author
Owner

@⁠pvfreis on GitHub · 2026-11-26 03:01 UTC · original

Follow-up, by reading only, not run, at c8c2b7a6 and #2428 970823e4. Both points are addressed.

  1. Baseline: the 1.1–3.8 times and 11–25 % are gone from both bodies, both commit messages and the heap_windows comment. 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.
  2. Scope: fixed. heap_flat is set in one place (kernel.rs:537), from reads_heap_flat, which is true only for kernel and CS entries, and with_mem_i32s is its only reader. Mesh and GS passes are translated as Entry::Mesh / Entry::Geometry, so they keep the guarded form with XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1. In #2428 they take heap windows only with XCL_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.

**@⁠pvfreis** on GitHub · 2026-11-26 03:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7181329429) Follow-up, by reading only, not run, at `c8c2b7a6` and #2428 `970823e4`. Both points are addressed. 1. **Baseline:** the 1.1–3.8 times and 11–25 % are gone from both bodies, both commit messages and the `heap_windows` comment. 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. 2. **Scope:** fixed. `heap_flat` is set in one place (`kernel.rs:537`), from `reads_heap_flat`, which is true only for kernel and CS entries, and `with_mem_i32s` is its only reader. Mesh and GS passes are translated as `Entry::Mesh` / `Entry::Geometry`, so they keep the guarded form with `XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1`. In #2428 they take heap windows only with `XCL_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.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-26 03:02 UTC · original

@⁠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), and only_compute_programs_read_heap_windows_flat tests it. #2428's description says so under How it decides: graphics, mesh and GS take heap windows only with XCL_HEAP_WINDOWS=1, through pso::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.

**@⁠Kalmarv** on GitHub · 2026-11-26 03:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7181346818) @⁠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`), and `only_compute_programs_read_heap_windows_flat` tests it. #2428's description says so under **How it decides**: graphics, mesh and GS take heap windows only with `XCL_HEAP_WINDOWS=1`, through `pso::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.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-26 01:55 UTC · original · edited 2026-11-26 04:13 UTC

@⁠bmjask thanks for the review.

Rebased. This PR is now c8c2b7a6, on main 6d12f58a, 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 with XCL_HEAP_WINDOWS=1; now they keep the guarded form. only_compute_programs_read_heap_windows_flat covers it (@⁠pvfreis's point).

Regression pair (in the body), on c8c2b7a6 against main b49be18, 120 s, XCL_DIRECT_DXIL=1: no removal or crash, 87.6 % of main's frames (1522 against 1738) and 101.7 % of its peak commit.

XCL_HEAP_FLAT title run: this head with XCL_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, where main 06055a7 lost 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 --precompile now keys this form as the runtime does.

AI use: Claude Code (Claude Opus 5.5) made the changes and measurements and wrote this reply.

**@⁠Kalmarv** on GitHub · 2026-11-26 01:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#issuecomment-7180287094) · edited 2026-11-26 04:13 UTC @⁠bmjask thanks for the review. **Rebased.** This PR is now c8c2b7a6, on `main` 6d12f58a, 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 with `XCL_HEAP_WINDOWS=1`; now they keep the guarded form. `only_compute_programs_read_heap_windows_flat` covers it (@⁠pvfreis's point). **Regression pair** (in the body), on c8c2b7a6 against `main` b49be18, 120 s, `XCL_DIRECT_DXIL=1`: no removal or crash, 87.6 % of `main`'s frames (1522 against 1738) and 101.7 % of its peak commit. **`XCL_HEAP_FLAT` title run:** this head with `XCL_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, where `main` 06055a7 lost 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 --precompile` now keys this form as the runtime does. AI use: Claude Code (Claude Opus 5.5) made the changes and measurements and wrote this reply.
Author
Owner

@⁠bmjask on GitHub · 2026-11-25 21:03 UTC · original · reviewed

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.

**@⁠bmjask** on GitHub · 2026-11-25 21:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/2427#pullrequestreview-6064948413) · **reviewed** 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2427/head:github-bot/gh-2427'
git switch 'github-bot/gh-2427'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2427'
git switch 'github-bot/gh-2427'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2427'
git switch 'github-bot/gh-2427'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2427'
git switch 'main'
git merge --squash 'github-bot/gh-2427'
git switch 'main'
git merge --ff-only 'github-bot/gh-2427'
git switch 'main'
git merge 'github-bot/gh-2427'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.