Repository navigation
Conversation
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 the switch over 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 stages only: vertex and pixel shaders are unchanged. The HLSL path ignores the flag. The one-path form is the idea xcl-dev#1695 brings to the HLSL heap form. Measured cold on an RTX 5070 Ti (610.74), shader cache disabled, 4 windows, split wave64, five large compute programs: the driver took 6.7-60.7 s with the switch over root UAVs and 3.4-28.6 s with this form; its native code was 11-25 % smaller. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
On NVIDIA the driver builds a direct-DXIL compute program 1.1-3.8 times as fast with flat heap windows (HEAP_FLAT) as with the switch over root UAVs, and its native code is 11-25 % smaller. Turn that form on by default there, for compute programs only. - pso::heap_windows: XCL_HEAP_WINDOWS=1 every stage (as before), =0 none, unset: on when the title's adapter is NVIDIA (set_adapter_vendor, from the device's DXGI adapter). XCL_HEAP_FLAT=0 turns the flat form off. - compute_mem_windows: the windows of a compute program, with the heap by default; mem_windows (graphics, mesh, GS) takes the heap only with XCL_HEAP_WINDOWS=1. The HLSL path keeps the switch unless XCL_HEAP_WINDOWS=1 (hlsl_windows): its heap form is not measured. - A pipeline the driver refuses with heap windows is still built in the switch form (with_switch_fallback); driver_pso looks at the compute windows for that now. - xcl shaders --precompile / --export-hlsl / --measure-pso: the keys of the runtime, from the bench's adapter (HEAP_FLAT was missing from the precompile key). - XCL_UMA_WINDOWS=8|16 still needs XCL_HEAP_WINDOWS=1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2088. Stacked on #2427; only the top commit belongs here.
Draft: the regression pair is still to run. I'll fill in Regression run and mark this ready when it finishes.
On NVIDIA, the driver builds direct-DXIL compute programs 1.1–3.8 times as fast with #2427's flat heap windows as with the switch over root UAVs, and their native code is 11–25 % smaller (table in #2427). This PR turns that form on by default there, for compute programs only. Graphics stages, mesh, GS, other vendors and the HLSL path keep the switch, as they do today.
How it decides:
XCL_HEAP_WINDOWSset:1gives heap windows to every stage, as before;0turns them off.0x10DE), and only for the compute programs the direct translator makes (compute_mem_windows).XCL_HEAP_FLAT=0brings back the guarded form.with_switch_fallback).Why only compute, and not the HLSL path:
XCL_HEAP_WINDOWSwas opt-in because two NVIDIA setups failed with it in #187's review:What is in it
gpu/recomp/pso.rs:heap_windowswith the vendor default,set_adapter_vendor,heap_windows_everywhere,compute_mem_windows/compute_windowsandhlsl_windows.console_to_dxil_fortakes the compute windows for a compute program.XCL_HEAP_FLATis on by default.hle/d3d12x/real.rs: the device's adapter vendor is noted before the UMA opens.driver_psolooks at the compute windows for the switch-form fallback.shaders.rs,gpu/adapter.rs: the--precompile/--export-hlsl/--measure-psokeys follow the runtime's for the bench's adapter. The precompile key was missingHEAP_FLATbefore.gpu/uma.rs:XCL_UMA_WINDOWS=8|16still needsXCL_HEAP_WINDOWS=1, since graphics need the heap for more than 4 windows.tests/gpu_compute_e2e.rs: the switch-form fallback test checks the compute windows.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on this head: 1292 passed, 1 failed, 46 ignored.a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, also fails onmain68a284a5.heap_window_out_of_memory_falls_back_to_the_switch_formused to be skipped here. It now runs, because heap windows are on by default on this NVIDIA card, and it passes: a refused heap-window pipeline is rebuilt in the switch form and runs correctly.Regression run
main68a284a5vs this head, default settings,XCL_DIRECT_DXIL=1)Not tested
AI use
🤖 Generated with Claude Code