Repository navigation
Conversation
…es to host limits
LAKSHYA-cmd-tech
left a comment
There was a problem hiding this comment.
Verified on Windows 11 D3D12 (WARP):
- All 69 \�ictory-shader\ tests pass.
- Using unsigned integer comparison (\IULT) against host heap bounds (\1_000_000\ for ResourceDescriptorHeap, \2048\ for SamplerDescriptorHeap) correctly clamps out-of-range/negative indices to slot 0, avoiding GPU page faults on NVIDIA hardware.
- \cargo clippy -p victory-shader\ is clean with 0 warnings.
- \cargo xtask policy\ passes (151 files checked, 0 violations).
Black screen before the menu with this PR (RX 9070 XT)Summary: With #584 applied to Setup
Results
Found by bisecting a local stack of open PRs, then confirmed with Console in the black state
Guess: the title uses |
|
Root cause of the black screen reported above on RX 9070 XT: In let limit = self.m.i32(if sampler { 2048 } else { 1_000_000 });
let in_bounds = self.m.cmp(block, super::bitcode::pred::IULT, index, limit);
let index = self.m.select(block, in_bounds, index, zero);The title requests a view heap larger than 1,000,000 slots (1,245,184 slots). On NVIDIA D3D12 the host caps the view heap at 1,000,000 ( Two related issues with hardcoding the bound and mapping OOB to
Code review note; no game data. AI-assisted. |
|
tested: #584 with the bound set to the host heap's real size | base: This confirms MartinIndra02's diagnosis from the AMD side, and the clamp itself fixes a real crash on RDNA3 once its bound is right. The bound has to cover the dynamic slots too. On this host the view heap is the title's 1,245,184 slots plus let limit = self.m.i32(if sampler { 2048 } else { 1_507_328 });That is a local value for this GPU. The real fix needs the host heap's size, What it fixes here. Without the clamp, the opening cutscene always ended in a page fault at an address with no allocation, neither live nor recently freed. It hit the same VA in three runs on two builds: With that pipeline skipped, a second one followed: With the clamp (bound 1,507,328), no
The only skip left was the known mesh hang On slot 0: I didn't see a type-mismatch failure from redirecting to slot 0, but I can't rule one out. A null or guard slot as in #483 sounds safer. AI-assisted (Claude Code). |
|
Following up on the root-cause analysis and @d1ll3x3's RDNA3 verification above, I implemented the dynamic host-heap bound + dedicated null guard slot version on a
Design (addresses all three issues with the hardcoded
|
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 0bcf2df on Windows 11, RTX 5070, MSVC: cargo test -p victory-shader -- --test-threads=1 69 passed, and cargo clippy -p victory-shader --all-targets is clean. victory translate --validate --pipelines on the local title executable still reports 12 of 12 programs.
The bound baked into the shader doesn't match the heap the host actually creates, so it misses the out-of-range case and can break in-range ones:
emit/shader.rs(heap handle):limitis a compile-time1_000_000for views. The host view heap istitle count + DYNAMIC(descriptor/host.rs,HostHeap::new, withDYNAMIC = 1 << 16) and is usually far smaller than 1M. An index between the real heap size and 1M still passes the check and reads past the heap, which is the fault this PR targets.- On resource-binding tier 3,
make(count + extra)can succeed abovePORTABLE_VIEWS. Then a valid index ≥ 1,000,000 is silently redirected to slot 0, a wrong but live descriptor, so a title with a large heap renders with the wrong resources instead of faulting. - Fix: the shader can't know the heap size at translate time, so pass it in. For example, add the bound as a root constant that
draw.rsfills fromHostHeap::count + DYNAMIC(2048 for samplers, which is the D3D12 shader-visible sampler limit). Or do the clamp where the host already knows the heap: drop or redirect the draw on the CPU side when a table index the title wrote is out of range. Selecting slot 0 should also be a null descriptor of the right type, not whatever the title put in slot 0.
AI-assisted (Claude Code).
|
Quick in-title confirmation for
No game data posted. AI-assisted; build and title run executed on my machine. |
…removal on RX 9070 XT
…es to host limits Upstream: Marvisak#584 by @FibbS6
…removal on RX 9070 XT
|
Automated triage for the maintainers. Closing because this change is already in Main clamps heap indices already (emit/shader.rs heap_handle: an index above HEAP_VIEWS-1 reads the last slot, which the host keeps null). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Problem
Dynamic bindless indices passed to
createHandleFromHeapcan exceed the host descriptor heap bounds (e.g., from uninitialized or out-of-range shader values), causing immediate GPU page faults and device removal on NVIDIA D3D12.Fix
ResourceDescriptorHeapandSamplerDescriptorHeapindices emitted bylower.rsto the configured host heap limits before callingcreateHandleFromHeap.Verification
cargo xtask policy— passed (151 files ok)cargo clippy -p victory-shader --lib -- -D warnings— 0 warningscargo test -p victory-shader -- --test-threads=1—69 passed, 0 failed