Repository navigation
D3D12.X: the T# index guard matches a 1,000,000-descriptor shared heap - #2195
Conversation
The translated shaders accept a T# SRV index below 2^21 - 1 (the UAV is at
tw0 + 1), while the shared shader-visible heap is min(device limit, 2^21)
descriptors: 1,000,000 on an RTX 4070. An index in between reads past the
heap's end, which hangs NVIDIA GPUs. XCL writes only indices it reserved,
but a T# the title wrote itself (raw console words: word 0 is the base
address >> 8, so a texture at 256-512 MB gives 1-2 million) passes the
type and BASE_ADDRESS_HI checks.
The shared heap is now 1,000,000 descriptors on every GPU (resource binding
tier 2+ takes that many) and the guard is tied to it: VIEW_HEAP_MAX_SRV =
GLOBAL_MAX - 1 in the direct DXIL translator, the same constant in the HLSL
path. global_cap() holds the heap size computation so a test can check it
against the bound; on the RTX 4070 it fails with the old values ("shaders
accept indices up to 2097151, the shared heap holds 1000000").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
AMD run (listed as untested) on an RDNA4 card, which is the Tier-3 case the guard's comment is about, plus the RTX 3060 for comparison. Nothing regresses with the lower bound compiled into the shaders. Head
Not tested: this card's actual view-heap limit (I did not read OPTIONS19, so I can't say whether the shared heap gets smaller here), a title, Linux / Wine. |
|
In-title result on #2057, for the first point under Not tested: on an RTX 4070 Ti (12 GB) the world-load removal still happens with this PR. It came later in this run, but that's one run each. Setup: RTX 4070 Ti 12 GB (driver 621.40), Ryzen 7 7800X3D, Windows 11 Pro 26200, release. Newer retail title 1.0.2.1, Series X profile.
So on this tree the removal at world load isn't (only) a read past the heap. The guard doesn't change the signature: DRED names no allocation, and long compute dispatches are still running when it comes. Not checked: whether the title produces an index in the gap at all. I didn't log the T# words, and I ran nothing without the budget commit. AI use
|
|
Code review on
Remaining before merge: |
Brings main to full parity with upstream/main (cdb0891), including: - World rendering & gameplay: xcl-dev#1991, xcl-dev#1988, xcl-dev#1984, xcl-dev#2028, xcl-dev#2078 - Memory / VRAM / PSO: xcl-dev#1985, xcl-dev#2157, xcl-dev#2178, xcl-dev#2195, xcl-dev#2176, xcl-dev#1996, xcl-dev#1914 - Direct DXIL & shaders: xcl-dev#2120, xcl-dev#2174, xcl-dev#2194, xcl-dev#2207, xcl-dev#1951, xcl-dev#1973, xcl-dev#2156, xcl-dev#2064 - Preserves local Linux/Wine customizations: docs/linux.md, scripts/linux/*, in-process Wine XAsync (xgameruntime/api.rs), loader watchdog bypass, and Wine MEM_WRITE_WATCH bypass on coherent UMA windows (gpu/uma.rs). Assisted-by: Antigravity (Gemini 4)
The translated shaders accept a T# SRV index below 2^21 − 1 (the paired UAV is at
tw0 + 1), but the shared shader-visible view heap ismin(device limit, 2^21)descriptors – 1,000,000 on an RTX 4070, which reports no larger limit. An accepted index between the two reads past the heap's end. XCL writes only indices it reserved, but a T# the title wrote itself as raw console words passes the type andBASE_ADDRESS_HIchecks: its word 0 is the base address >> 8, so a texture at 256–512 MB gives 1–2 million. Another project running the same new retail game reports that reads past the heap's end hang NVIDIA GPUs (AMD forgives them).The shared heap is now 1,000,000 descriptors on every GPU (resource binding tier 2 and up take that many) and the guard is tied to it.
What is in it
crates/xcl/src/hle/d3d12x/console_heap.rs:GLOBAL_MAX= 1,000,000 (was 2^21), public; the heap size computation moves intoglobal_cap(), unchanged otherwise.crates/xcl/src/gpu/dxil/lower_image.rs:VIEW_HEAP_MAX_SRV = GLOBAL_MAX − 1(was(1 << 21) − 1); its tests compare against the constant.crates/xcl/src/gpu/recomp/emit.rs: the HLSL path's guard uses the same constant (was a literal2097151u).the_shaders_t_sharp_index_bound_fits_the_shared_heap(GPU): the bound against the shared heap this GPU gets. It fails without the change on the RTX 4070: "shaders accept indices up to 2097151, the shared heap holds 1000000".Tested
cargo test --workspace -- --test-threads=4at19bef42: 1155 passed, 0 failed, 46 ignored (21 test binaries). SKIPPED (25): 20 GPU subtests that need wave64, 3 wave32 per-lane f16 subtests oflower_dxil::tests(refused: unsupported f16 instructions),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode is off).Regression run
Same title for 100 s on each build, default settings, shader caches cold on both (the PR changes the translator).
main:
This PR:
Not tested
AI use
🤖 Generated with Claude Code