dxil: heap memory windows in the direct form #1714
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1714
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1714/head"
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?
@Sr-0w on GitHub · 2026-11-24 19:38 UTC · original
Sr-0w:direct-heap-windows→main· +82 −22 · 6 files · 1 commits · closed without mergingWith
XCL_HEAP_WINDOWS=1, the direct DXIL translator (#1426) refused every program that may address several memory windows ("unsupported: heap memory windows"), so they went back to the HLSL path. This takes them in the direct form, one access through the descriptor heap. That is the same shape as the HLSL path's heap form (#680), and it replaces the switch over the root UAVs, which the AMD driver compiles 2–4× slower.What changes (
gpu/dxil, +40 lines)Shader::heap_raw_uav: aRWByteAddressBufferhandle (globallycoherentfor compute) fromResourceDescriptorHeap[index].Lw::heap_mems: withHEAP_WINDOWSinmem_windowsand more than one window, no root UAVs are bound.Lw::with_memmakes one access throughResourceDescriptorHeap[MEM_HEAP_BASE + w]with a non-uniform index. Awoutside the program's window count goes to window 0, as in the switch form.Lw::multi_windowreplaces the threemems.len() > 1checks (the window of a FLAT address, a V#, a BVH node), so the window is tracked in both forms.Test
gpu_direct_memory_windows_from_the_heapruns the 4 GiB two-window program, the onegpu_memory_windows_from_the_heapruns on the HLSL path, through both direct forms on the GPU:direct DXIL: unsupported: heap memory windows).tests.rs:direct_oris split intodirect_of, which always translates, anddirect_or, which does so underXCL_DIRECT_DXIL.direct_ofpassesheap_windowson.gpu_memory_windows_from_the_heapwithXCL_DIRECT_DXIL=1now takes the direct heap form instead of falling back to the HLSL DXIL.Measured on an AMD Radeon RX 7800 XT (RDNA3, native 64-lane waves), Ryzen 7 3700X, 64 GB, Windows 11 26300, Rust 1.100.0, DXC 1.9.2602.17.
cargo test --workspace -- --test-threads=4: 859 passed, 0 failed, 42 ignored. OneSKIPPEDline,heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows; it needsXCL_HEAP_WINDOWS=1and is skipped onmaintoo.memory_windowstests withXCL_DIRECT_DXIL=1: 6 passed, 0 failed.CreateComputePipelineStatewith the test root signature, cold, one at a time. The 21 programs without textures are below; the test root signature refuses the others.5683ddcd014910676e148dbd563de205cc047f458010c5d21404420b38db85972e0055c25f49848a34207613d17f8b9673000efc296c082e6da1f38b06d6c735aa35926a5609067bThe heap form's DXIL is within 2–5 % of the one-window form's.
Not tested
with_mem).XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1: it comes next, and I'll post it here.with_mem, but no test of their own.Discussed on #1269 and #1426.
AI use: Claude Code (Claude Opus 5.5) wrote the change and the test, ran the suite and the driver timings, and wrote this description.
🤖 Generated with Claude Code
@vitor127wt on GitHub · 2026-11-24 19:54 UTC · original
RTX 5070 Ti / Proton retail startup with direct DXIL and heap windows
With
XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1on both builds,mainfell back to HLSL for three compute shaders withunsupported: heap memory windows. This PR translated the same three inputs directly, with zero HLSL fallbacks. The cache used window key260on both builds (four windows with the heap bit set). On the PR, I verified that each direct DXIL diagnostic dump matched the cached compute bytecode. Total DXIL for the three inputs was 148,224 B onmainand 134,792 B on the PR.Tested
mainc160d86ef2efe3a07e4dfb473e4fa72eafb413c0and PR head48e8e801b4211cec5823094d323d0986edb66f49, both clean Windows x64 release builds. RTX 5070 Ti 16 GB, NVIDIA 620.73.04, Ryzen 7 9700X, 32 GB DDR5, CachyOS kernel7.3.5-2-cachyos, and Proton Experimental 11.0 (2026-11-12).x86_64-pc-windows-gnullvm), DXC 1.9.2609.5, vkd3d-protonec207194with the #257 patch, and dxil-spirv7c048638.cargo build --locked --release --target x86_64-pc-windows-gnullvm -p xcl --bin xcl. Ranscripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 60from #257 with fresh prefixes and caches,XCL_DIRECT_DXIL_STATS=1,XCL_DXIL_DUMP=all, and networking off.cargo test --locked --release --target x86_64-pc-windows-gnullvm -p xcl --lib --no-run. Rangpu_direct_memory_windows_from_the_heap,gpu_memory_windows_from_the_heap,gpu_heap_windows_reject_out_of_uma_aliasingseparately via Proton Wine with--exact --test-threads=1 --nocaptureand the same two flags. 3 passed, 0 failed, 0 ignored, 0 skipped.Regression run
The blocks were generated by the Wine smoke script. I abbreviated the local folder name in the
titlefield.mainPR head
Scope — One 60 s startup run per build. The frame counts describe this pair. Linux cgroup peaks were 9.02 and 6.41 GiB. Wine reported
0 MBin the Windows peak-commit field.AI use — OpenAI Codex (GPT-6, exact variant unavailable) ran the tests, checked the shader routing, and drafted this report.
@Sr-0w on GitHub · 2026-11-24 19:44 UTC · original · edited 2026-11-24 19:55 UTC
Correction: this run did not test this PR. My launch script passed only the first of its environment variables (
powershell -Filebinds one value to a[string[]]parameter). So the run hadXCL_DIRECT_DXIL=1but notXCL_HEAP_WINDOWS=1: it ranmain's direct switch form on this build. The 209 s against 136 s is therefore run-to-run spread on the same configuration, not this change. Another run of the same configuration right after it ended at 142 s. I'll redo the title run with both variables set, check in the log that they took effect, and post it here.AI use: Claude Code (Claude Opus 5.5) wrote this correction.
@upipibi on GitHub · 2026-11-24 19:56 UTC · original
Windows NVIDIA check at
48e8e80: RTX 3070 (Ampere, 32-lane waves only), driver 616.56, Windows 11, DXC 1.8.2502.11.gpu_direct_memory_windows_from_the_heapandgpu_memory_windows_from_the_heappass, with and withoutXCL_DIRECT_DXIL=1, and again underXCL_REQUIRE_GPU=wave64, so neither is skipped. The 64-lane two-window program therefore runs through both direct forms on a 32-lane card. That covers the non-uniformResourceDescriptorHeapindex on NVIDIA's Windows driver; the earlier NVIDIA report was under Proton.gpu::dxil+gpu::recomp: 275 passed, 0 failed, 19 ignored, 3 of 3 runs.No game files; the PR's own synthetic tests only. AI-assisted (Claude Code).
@WebIdentity1 on GitHub · 2026-11-24 20:00 UTC · original
Independent RTX 3090 validation of exact head
48e8e801b4211cec5823094d323d0986edb66f49on native Windows 10 (driver 591.74, Agility SDK 1.620.2). I verified the process environment contained bothXCL_DIRECT_DXIL=1andXCL_HEAP_WINDOWS=1, withXCL_ADAPTER=3090andXCL_REQUIRE_GPU=mesh. Clean tracked source hashes matched before and after (292/292).I saw the RTX 3070 compute check above after my runs; the incremental coverage below is the direct mesh heap-window GPU path.
cargo test --locked -p xcl --lib gpu_direct_memory_windows_from_the_heap -- --test-threads=1 --show-output --nocapture: 1 passed / 0 failed / 0 ignored, no skip or timeout. The test runs both direct switch and direct heap forms on the GPU and checks s_load, buffer load/store, global load/store/atomic across two windows.cargo test --locked -p xcl --lib gpu_memory_windows_from_the_heap -- --test-threads=1 --show-output --nocapture: 1 / 0 / 0, no skip or timeout. With the two variables above, this now selects the direct heap translation instead of the earlier HLSL fallback.gpu_mesh_mode_reads_memory_windows: calldirect_ofwithMode::Mesh, two windows, andheap_windows=true; dispatch its compute pass on the GPU and check three positions against window 1's values, with window 0 holding distinct decoys. This passed 1 / 0 / 0, no skip or timeout. It exercises the direct mesh heap accessor, which the PR's added compute test does not cover. The diagnostic patch SHA-256 is385d011498809ce48538f79e290e7151b56dc8cdf54a6618421a69be836d8e3d:The diagnostic is uncommitted; I restored the Windows source to the exact head after testing. I did not run the full workspace suite, retail gameplay, driver compile timing, or a graphics VS/PS heap-form test in this check. The mesh check executes the translated compute phase, not the entire on-screen draw pipeline.
Codex (GPT-6) prepared the test-only diagnostic and report; the stated results came from the native Windows machine.
@Sr-0w on GitHub · 2026-11-24 20:05 UTC · original
Title run with both variables set this time (
XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, checked in the log: no 984 KB switch-form DXIL appears, and the heap form was used), RX 7800 XT, release build of this branch:main, title watchdog (+0x23cf683) at 209 s.So the heap form shortens the worst driver builds, as the unit test shows, but it does not move the stall. Timed thread dumps at 130/150/170 s show no title thread in a compile. Only a preload worker is in the driver, and the title's threads wait in its own code while DirectStorage runs 2-5k requests per 2 s. I'm now looking at what the title waits on rather than at shaders.
AI use: Claude Code (Claude Opus 5.5) ran the test and wrote this comment.
@MatyEjsr on GitHub · 2026-11-24 20:12 UTC · original
Tested commit
48e8e801b4211cec5823094d323d0986edb66f49(PR #1714) on an NVIDIA wave32-only (split-wave64) GPU.Environment
Tested
cargo build --workspace -j 8: succeeded in 6.11s.cargo test --workspace -j 8 -- --test-threads=8: 859 passed, 0 failed, 42 ignored; 3SKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsXCL_DIRECT_DXIL=1 cargo test -p xcl --lib memory_windows -- --nocapture: 6 passed, 0 failed, 0 ignored, 0SKIPPED(0.29s).gpu_direct_memory_windows_from_the_heapandgpu_memory_windows_from_the_heapboth pass on the RTX 3090 split-wave64 path, confirming the direct heap-window DXIL is smaller than the switch form and executes identically across both windows.XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 cargo test -p xcl --lib memory_windows -- --nocaptureandheap_window: 6 passed + 2 passed, 0 failed, 0 ignored, 0SKIPPED(0.28s / 0.22s).XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests:: -j 8 -- --test-threads=8: 121 passed, 0 failed, 17 ignored, 2SKIPPED(no wave64) (4.30s).XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 cargo test -p xcl --lib gpu::dxil:: -j 8 -- --test-threads=8: 80 passed, 0 failed, 1 ignored, 0SKIPPED(0.48s).XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL_STATS=1 XCL_TRANSLATED_CACHE=0 cargo test -p xcl --test gpu_compute_e2e -- --nocapture: 3 passed, 1 failed, 0 ignored, 0SKIPPED(0.82s).async_compute_pso_registers_real_pso_and_not_standin(1864 B DXIL, 0 ms)heap_window_out_of_memory_falls_back_to_the_switch_form(injected heap-window OOM fell back to switch form: 2892 B DXIL, 0 ms)console_wave64_compute_through_the_pso_hook_dispatch_and_read_back(2636 B DXIL, 4 ms; split-wave64 dispatch + readback matched)offline_compute_pipeline_is_reused_by_a_second_processatcrates/xcl/tests/gpu_compute_e2e.rs:114) is pre-existing underXCL_DIRECT_DXIL=1(reproduces identically withoutXCL_HEAP_WINDOWS=1) because the test looks for a top-level*.dxilfile fromdxc::compile_cachedrather thantranslated/v2/.Review notes
TRANSLATOR_VERSIONneeds a bump (crates/xcl/src/gpu/dxil/kernel.rs:38):TRANSLATOR_VERSIONis still4, andcrates/xcl/build.rsdoes not hashsrc/gpu/dxil/*.rsintoXCL_TRANSLATOR_SOURCE_ID. Anyone who previously ran withXCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1(or=all) cached the HLSL-fallback DXIL undertranslated/v2/<ident(v4)>/..._<windows|0x100>_<split>.binand will keep hitting those stale HLSL entries instead of the new direct DXIL heap-window containers untilTRANSLATOR_VERSIONis bumped to5.Lw::with_memclampsw >= nto window 0, matching direct DXIL's existing switch form (hi & 3), whereas the HLSL path rejects out-of-UMA windows (gpu_heap_windows_reject_out_of_uma_aliasingonly exercises HLSL). Fine for this PR, just worth noting if direct DXIL later adopts out-of-UMA bounds checks.PR descriptioncheck currently fails because the description uses**Test**/**Measured**and plainAI use:instead of the required**Tested**/**AI use**sections, and still needs themain+ headxcl-smokeblocks under**Regression run**.Not tested
scripts/smoke.ps1),XCL_SAMPLE_RPF-gatedgpu_pso_e2etests, and dedicated GPU tests for mesh/VS/PS in the direct heap-window form.AI use
@thiagocalile on GitHub · 2026-11-24 20:27 UTC · original
Tested commit
48e8e801b4211cec5823094d323d0986edb66f49on an AMD Radeon RX 6600 (RDNA2, native 64-lane waves): all targeted tests passed.Tested
32.0.21045.29003;XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11, debug build.XCL_ADAPTER=radeon cargo test -p xcl --lib gpu::dxil -- --test-threads=4: 80 passed, 0 failed, 1 ignored (27.55s).XCL_ADAPTER=radeon XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e -- --nocapture: 4 passed, 0 failed, 0 ignored (42.71s).XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 856 passed, 3 failed, 42 ignored (38.3s).mainon this RX 6600 (placed_title_textures_share_vram_and_preserve_pixels: 3D mip subresource mismatch, plus 2 mutex-poison cascadestransitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory; tracked by #1028).SKIPPED(not counted as coverage):heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows(plus D3D12 debug-layer tests skip becaused3d12SDKLayers.dllis not installed).Not tested
scripts/smoke.ps1— no game executable here), D3D12 debug layer, NVIDIA / Intel GPUs, Linux / Wine.AI use
@ivall on GitHub · 2026-11-24 20:50 UTC · original
Closing this: #1693, which is merged, added heap memory windows to the direct DXIL path, so this now conflicts with
mainand duplicates it (group D45 in #1607). If something here is still missing onmain, a small follow-up PR on top of it is very welcome. Your title run in this thread, with the point that the heap form does not move the stall, stays useful.This says nothing about the quality of the code here. If this PR covers a case the other one does not, say so and I'll reopen it.
Thank you for the work.
AI use: Claude Code (Claude Opus 5.5) read the diffs and the checks in #1607 and wrote this comment, on the maintainer's behalf.
@DavidM1911 on GitHub · 2026-11-24 22:18 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main(multiple files ingpu/dxil/andgpu/recomp/tests.rs) — needs a rebase before it can be tested.github-bot referenced this pull request2026-11-26 06:18:31 +00:00
Pull request closed