Repository navigation
Direct DXIL: memory windows through the descriptor heap (XCL_HEAP_WINDOWS) - #1693
Merged
Merged
Conversation
…DOWS) The direct translator no longer refuses heap windows: with recomp::HEAP_WINDOWS in the window count, window w is a RWByteAddressBuffer from ResourceDescriptorHeap[NonUniformResourceIndex(MEM_HEAP_BASE + w)] (globallycoherent in compute mode, as the root windows), behind one bounds check instead of a switch over u2.. root UAVs. Window selection now matches the HLSL kernel's window_read / window_write: the 64-bit effective address (carry / borrow, V# stride bits masked) minus the UMA base; a read with hi == 0 goes to window 0; any other address outside the windows reads 0 and drops its stores and atomics (root and heap form). TRANSLATOR_VERSION 5. The heap-window GPU tests run through the direct path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Tested on Windows 11 with an AMD Radeon RX 9070 XT (16191 MiB VRAM, RDNA4, native wave64) on a local merge branch based on Setup & tested configuration
Observed results
Not tested
|
gefydev
added a commit
to gefydev/xcl
that referenced
this pull request
Nov 24, 2026
xcl-dev#1693 put memory windows through the descriptor heap in xcl-dev#1426's lowering (XCL_HEAP_WINDOWS), so compute_with no longer refuses them: with several windows the per-lane form's memory instructions go through Lw, which now reads the window from the heap.
|
Tested commit Tested
Not tested
AI use
|
This was referenced Nov 24, 2026
gefydev
added a commit
to gefydev/xcl
that referenced
this pull request
Nov 24, 2026
xcl-dev#1693 put memory windows through the descriptor heap in xcl-dev#1426's lowering (XCL_HEAP_WINDOWS), so compute_with no longer refuses them: with several windows the per-lane form's memory instructions go through Lw, which now reads the window from the heap.
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
Contributor
Author
|
Thanks @raylitebull (RX 9070 XT, 300 s, plus the AI use: Claude Code (Claude Opus 5.5) wrote this comment for @bmjask. |
wondercrash
added a commit
to wondercrash/xcl
that referenced
this pull request
Nov 24, 2026
…cl-dev#1288 Sleep hold, xcl-dev#1195 ExecuteIndirect skip) Conflicts: - tests.rs memory_windows_reject_out_of_uma_aliasing: xcl-dev#1693 builds the switch / heap form through direct_or (the direct translator with XCL_DIRECT_DXIL=1); the flat form of our flat window loads stays a DXC compile, as in gpu_sparse_vram_descriptors_buffers_and_xmem. - pso_async.rs resolve_wait: xcl-dev#1288's `Held` guard (pso_async::title_held, which kernelx::Sleep does not count) goes into our resolve_wait_in after note_use, so it covers the bind's whole wait in every form: XCL_PSO_WAIT_MS / XCL_PSO_WAIT_MS_GRAPHICS budgets, XCL_PSO_SKIP_HUGE, a build on the binding thread. Its test calls our three-argument resolve_wait_for. xcl-dev#1195 merged without conflict: in execute_indirect our skip of a pending stand-in or a two-pass pipeline comes first, then xcl-dev#1195's skip of a Dispatch signature with an untranslated console compute pipeline (a failed build's stand-in, the fallback of a console shader that failed), which we sent to the PC call, then the PC-pipeline block with 515b576's gpu_profile::end(.., breadcrumb). xcl-dev#1195's skip leaves a breadcrumb, as our other ExecuteIndirect skips do.
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.
Follow-up to #1426.
The direct RDNA2→DXIL translator used to refuse programs that take their memory windows from the descriptor heap (
XCL_HEAP_WINDOWS=1,recomp::HEAP_WINDOWSin the window count) and sent them to the HLSL path. With this PR it translates them.What is in it
gpu/dxil/lower_window.rs(new file): windowwis aRWByteAddressBufferfromResourceDescriptorHeap[NonUniformResourceIndex(MEM_HEAP_BASE + w)](createHandleFromHeap+annotateHandle,globallycoherentin compute mode, like the root windows). It sits behind onew < windowscheck instead of a switch over the root UAVs u2... Awoutside the windows reads 0 and drops its stores and atomics, as the HLSLxcl_m*heap accessors do. All memory accesses (loads, stores, atomics including 64-bit and CAS loops, format and typed buffer loads, SMEM, BVH) go throughwith_mem, so they all use it. 64-bit atomics on heap handles setAtomicInt64Heap.window_read/window_write(gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 still usedhi & 3). The window comes from the 64-bit effective address (carry / borrow, V# stride bits masked) minus the UMA base (IO_UMA_BASE_HI). A read withhi == 0goes to window 0; any other address outside the windows matches none. This applies to the root-UAV form too, so out-of-UMA pointers no longer alias a live window there either.kernel.rs: the refusal is removed;mem_windows()builds the root or heap windows.TRANSLATOR_VERSIONgoes 4 → 5, so cached direct translations are rebuilt.lower_mem.rs/lower_image.rs(window(..)→window_at/buffer_window/flat_window(.., write)), oneheap_memfield inLw, andShader::heap_raw_buffer_uav.direct_orpassesHEAP_WINDOWSwhenOptions::heap_windowsis set.gpu_memory_windows_from_the_heap,gpu_heap_windows_reject_out_of_uma_aliasingandgpu_memory_windows_reject_out_of_uma_aliasingnow run through the direct path underXCL_DIRECT_DXILand are checked on the GPU. The 64-bit atomics test also validates the heap form.Tested
cargo test -p xcl --lib gpu::dxil: 80 passed, 0 failed, 1 ignored.cargo test -p xcl --lib gpu::recompwithXCL_DIRECT_DXIL=1and=all, each withXCL_HEAP_WINDOWS=0and=1: 194 passed, 0 failed, 18 ignored in all four. The GPU window tests (gpu_memory_windows_*,gpu_heap_windows_reject_out_of_uma_aliasing, mesh, BVH64) ran on the GPU through the direct path, validator-clean.cargo test --workspace -- --test-threads=4: 858 passed, 0 failed, 42 ignored (SKIPPED GPU tests:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware– no wave64 path on this adapter;heap_window_out_of_memory_falls_back_to_the_switch_form– no heap windows by default).memory_windows_above_4_gib5608 → 5328 B (−5 %).XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1(PR head, A pressed at 10/15/20/25/30/40 s, 60 s): 1454 frames shown (presents per 2 s at the end 43 46 40), 0 device removals, 0 crashes, peak commit 19441 MB. Fallback counts and PSO times were not collected.Regression run
Both runs were back to back on a quiet machine, with
XCL_PRESS_A_AT=10,15,20,25,30,40(A pressed at those seconds).main:
PR:
Not tested
XCL_DIRECT_DXIL_STATS=1) and PSO build times in the title run.AI use
🤖 Generated with Claude Code