Repository navigation
Memory windows from the descriptor heap (no per-access switch); NVIDIA OOM fallback; physical-page fixes - #187
RemingtonWilcox wants to merge 6 commits into
Conversation
|
AMD run of the two tests you asked about. This is not the RX 9070: it is RDNA3 Radeon RX 7800 XT (16 GB, native 64-lane waves,
|
|
I tested
The measurements cover the synthetic cases on this setup. AI-assisted with Codex. |
|
Setup: AMD Radeon RX 7800 XT (RDNA3, 16 GB), driver 32.0.32015.7029, 32 GB RAM, Windows 11 Pro 26200, GTA VI retail, Tested 8c0346d merged onto the branch above (clean merge, release build), two runs: cold and warm cache. Both runs: 0 presents, no DXC compiles, private commit flat at 18 GB from ~1 s on, then the game's watchdog at 31.5 s ( The thread dump shows a game thread inside XCL for those 30 s: It looks like page mapping became quadratic: a Without #187 the same branch presents from ~3 s. Debug info: release build with 🤖 Generated with Claude Code |
|
Independent Windows + RTX 5080 GPU verification of Build & Tests
Code review note (edge case)
(AI-assisted) |
|
AI-assisted review (Claude Code). Windows 11 (10.0.26200), Ryzen 9 9950X, RTX 5070 Ti (NVIDIA 610.74), Rust 1.99.0 MSVC, debug profile. Synthetic memory only, no game files. Tested GPU (5070 Ti): Negative control for the homes change. I carried the behavioural assertions of
On gw1337x's 30 s stall ( Before the sparse state exists (no device yet):
So remapping N pages that sit in a sparse range costs O(N²). To show this I used a CPU-only probe (no D3D12 device). It allocates N pages, maps them consecutively, remaps them in reverse order with
Also seen, but not attributed: the reverse remap is slow on plain memory as well, on both sides (16k pages: 7–9 s). One candidate is Not tested: the retail title, the full suite on this GPU, AMD, Wine, and the timing with a D3D12 device present (sparse state set up). I'll open a separate small PR that keys |
|
Found the cause of the stall @gw1337x reported (game thread stuck in
At the watchdog, the thread dump has a title thread running in XCL. Symbolized with the build's PDB: Two quadratic pieces, both needed
Synthetic measurement, 100 000 map / unmap steps (
The patch (
|
|
Pushed 4 commits after an adversarial review of this branch (8c0346d..603f546):
Full Left as is, and the same on main: a double free of one page, and AI-assisted (Claude, with a Gemini audit); tests run locally as stated. |
With more than one memory window every access in a translated shader was inlined once per window (a switch over the root UAVs mem, mem1..). Now window k is a raw UAV at MEM_HEAP_BASE + k of the shared shader-visible heap, and each access is one ResourceDescriptorHeap load/store. - Options::heap_windows / HEAP_WINDOWS flag in the windows count (so the translation and DXIL cache keys differ); on unless XCL_HEAP_WINDOWS=0 or the views could not be made. - console_heap: the first 4 descriptors of the shared heap are the windows' raw views (4 GiB - 64 KiB at most: a 4 GiB raw view does not fit a 32-bit byte size). - Lists bind the shared heap before an ABI dispatch / draw when they set none. - xcl shaders --precompile uses the same key. - Experiments (aperture_tests.rs), RTX 3090: E1: one structured view over a 16 GiB reserved buffer wraps at 4 GiB (root UAV and heap view) - a single aperture binding is not possible on NVIDIA. E1b (debug layer): a 4 GiB - 64 KiB raw view and a 1 GiB raw view at FirstElement 5 GiB both work, no debug-layer messages. E2 (ignored, run alone): a 19 601-instruction CS, DXC 12.1 s with one window, 150.7 s with the 4-window switch, 12.5 s with heap windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- runner::dispatch_on: a PSO built by the backend hook uses the runtime's window count, so with heap windows its accesses go through the descriptor heap; every window slot is now a raw view of the test's memory (gpu_compute_e2e read zeros through LDS). - draw_indexed_x test: the fake list gets SetDescriptorHeaps (ivall#28), which bind now calls when the list set no heap (it called a null slot). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The window views stopped at 4 GiB - 64 KiB on the assumption that a window's last tile is never handed out. Sparse windows do hand it out (sparse_reserve / sparse_alloc; a reservation across two windows always covers it), and through the view it read zeros and dropped stores. The view is now 2^30 - 1 dwords, the largest byte size a 32-bit field holds (AMD's V# NUM_RECORDS): only the window's last dword stays out of reach. E1c (RTX 3090, debug layer): 4 GiB - 64 KiB view 0/64 lanes at the last tile; 2^30 - 1 dwords 64/64 there and 63/64 at the last 256 bytes; exactly 2^30 dwords 64/64 too, no debug-layer messages (AMD not measured). gpu_raw_window_view_reaches_its_top now checks the last tile and its last dwords. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…translated draw Unbinding every heap left the list's record of bound heaps as it was, so ensure_view_heap saw a heap and did not bind the shared one: the next translated draw or dispatch read the memory windows (ResourceDescriptorHeap[0..3]) with no heap bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lt in the switch form NVIDIA 616.92 (RTX 5070 Ti, reported in ivall#156) refuses some big programs whose descriptor-heap index depends on the memory window with E_OUTOFMEMORY, and builds the same programs in the switch form. A translated compute, graphics, mesh or GS pipeline whose driver call fails that way with heap windows is now translated again in the switch form (other cache keys; same root signature and binds) and built from that before the stand-in or the error path. Test: heap_window_out_of_memory_falls_back_to_the_switch_form injects the refusals through the CreateComputePipelineState hook, then dispatches the rebuilt pipeline and checks every thread's output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Linux / Turing run of This stack has the known zero-read gap: Wine without
(
Not covered: the rebased PR; AMD; the DXC timing ( AI-assisted test report (Claude); tests run locally as stated. |
…back at once FreeTitlePhysicalPages dropped AWAY before it released a block's home; with plain-memory homes (MEM_RELEASE) a map, read or write of those pages on another thread could reach memory released under it. AWAY now stays held across the PHYS_BLOCKS section (the order AWAY -> PHYS_BLOCKS, as in the map calls). A page freed while its block lives on gives its lazy home (sparse window or plain memory) back at once instead of when the whole block goes. unmap_away looks the page's home up once. Tests: a_freed_page_gives_its_home_back, physical_pages_from_several_threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Rebased onto Dropped: Stage 1 (physical-page homes in CPU memory, What the PR is now:
Full suite green on an RTX 3090 (driver 616.92). Not run against a retail title after the rebase. AI-assisted (Claude Code); tests run locally as stated. |
603f546 to
c74b03a
Compare
|
Driver and GPU timings for the heap form next to the switch and #174's linked form, on an RTX 5070 Ti. In short: on an access-dense compute program the heap form brings the driver's compile back to what one window costs, and it does not cost GPU time. Driver compile. A synthetic split-wave64 compute program with a load and a store of title memory every round and an exec-masked block every 4 rounds. Each row is 2 programs the driver had never seen, created from one thread:
GPU time. #174's
The Two notes on the code:
Offer: I can add differential GPU tests on top of this PR: each existing multi-window test program ( Tested
Not tested
AI use: Claude Code, Claude Fable 5.2. |
|
Data point from an RTX 4090 / Windows 10 machine: #187 brings back the null write that #169 clears.
So on this machine #187 lands earlier than #169 alone, and adding #169 on top does not recover it — the subresource layout from #169 is presumably computed against a window #187 has moved out of the GPU reservation. Both runs use |
|
On the null write @TheFrenchPepeAI reports above: in compute on NVIDIA, the heap form and the switch form give the same results, including through the views
Controls
Tested
Not tested
🤖 Claude Fable 5.2, Claude Opus 5.5 |
|
Follow-up to my comment above, on the current head
Regression run ( Two runs each: the first with a cold translation cache, since each binary has its own, and the second warm. The
(cold run: 1129 frames, peak 17169 MB)
(cold run: 877 frames, peak 17229 MB; the heap form recompiles every translated shader once)
|
|
RDNA2 result for the two tests asked about: AMD Radeon RX 6800 (16 GB), driver 32.0.21045.29003, Windows 11, Rust 1.100.0, release, head
Report written with Claude Code, from our own runs. |
Collects the shader compile-time numbers published in issue ivall#156 and PRs ivall#187 and ivall#214 into one note, so they need not be derived again: driver time grows faster than DXIL size, the DXC version changes DXIL size (so a byte threshold is version-relative), the four-window switch form costs 12.5-15.5x DXC against one window with DXC 1.8/1.9 while the heap form (ivall#187) stays near one window, and only the cold driver run of a cell is a real compile. Every number is attributed to its author and thread; nothing was measured for this note. Assisted-by: Antigravity CLI (Claude Opus 5.5)
What the PR is now:
ResourceDescriptorHeap[NonUniformResourceIndex(MEM_HEAP_BASE + w)]instead of the per-accessswitchover root UAVs.XCL_HEAP_WINDOWS=0turns it off. The raw views are 2^30 − 1 dwords, so a sparse window's last 64 KiB tile is reachable; only the window's last dword is not.SetDescriptorHeaps(0, NULL)clears the record, so the shared heap is bound again before the next translated draw.0x8007000E, the program is translated again in the switch form and built from that, before the stand-in. Tested by injecting the refusal through the PSO hook, then dispatching and checking the output.FreeTitlePhysicalPageskeepsAWAYheld while it releases homes (plain homes areMEM_RELEASEd, so a concurrent map/read/write could touch released memory), and a page freed from a block that lives on gives its lazy home back at once. Tests included.Full suite green on an RTX 3090 (driver 616.92). Not run against a retail title after the rebase.
Earlier versions of this PR also moved physical-page homes out of GPU address space; that part is dropped in favour of main's 38b05b7 design (see the comment thread).
🤖 Generated with Claude Code