Repository navigation
Descriptors: view indices past a capped host heap read a null slot - #11
Merged
Merged
Conversation
Detect hosts whose shader-visible view heaps stop at 1,000,000 slots. Keep main's descriptor index clamps, using the smaller host cap for view handles while leaving sampler and uncapped-host bounds intact. Keep main's fuller fallback ladder for the heap size (6ac8fbe): a host below HEAP_VIEWS still gets every title slot mirrored when it can take them beside a dynamic range, and a capped heap keeps its last slot null across title slots, dynamic slots and copy-back view pairs, including dynamic ranges ending exactly at the cap. Keep main's source-based shader cache fingerprint and include the host cap among its translation settings. Tests check emitted DXIL handle indices at and beyond both heap bounds, small and exact-size capped heaps, and cache invalidation by the cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
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.
What
Ports upstream PR Marvisak#1133 (
cae16e60"Descriptors: view indices past a capped host heap read a null slot", by rivaldodev) onto the fork, merged with the fork's fuller heap-size fallback ladder from 6ac8fbe.Why
The 5080 hardware run ended in a flood of
followed by a 0xc0000005 in the title (title-image+0x2215c35) — the same crash pattern as before 6ac8fbe. 6ac8fbe's ordered fallbacks cannot help on this GPU: every rung that keeps the whole title range (
count + DYNAMIC= 1,441,792;count + MIN_DYNAMIC= 1,245,184) exceeds the driver cap of 1,000,000, so the heap still lands on thePORTABLE_VIEWScap path withcount = 934,464, and every title slot from 934,464 to 1,179,648 reads a null descriptor.How (upstream's approach)
victory-gpu/src/host.rs::create()probes the device with a shader-visible view heap ofPORTABLE_VIEWS + 1slots. If that is refused, the host is capped at 1,000,000 (descriptor::host::view_heap_cap).victory-shader::emit(set_view_heap_limit/view_heap_limit), and translated shaders clamp theircreateHandleFromHeapindices tocap - 1instead ofHEAP_VIEWS - 1when the host is capped. The clamped last slot of the heap stays null, so an index past the capped range reads nothing instead of faulting the device.pairs_end), including dynamic ranges ending exactly at the cap.shader_cache.rs), andbuild()initializes the host device first so the cap is known before the key is fixed.Fork-specific merge
The upstream patch replaced the fork's fallback chain (6ac8fbe: try
count + DYNAMIC, thencount + MIN_DYNAMIC, before the cap) with its own.max(views)variants. This PR keeps both: the.max(views)rungs first (needed so small title heaps still span the full capped range), then the fork's plain rungs, then the cap path. On an uncapped host behavior is unchanged; on a capped host the cap rung wins exactly as upstream intends, but the fork's extra rungs still catch hosts that accept the title range only without the extraviewsheadroom.Verification
cargo check/cargo clippy -p victory-gpu -p victory-shader --all-features --all-targets --target x86_64-pc-windows-gnu: clean, zero warnings.cargo test --no-runlinks for both crates onx86_64-pc-windows-gnu(real test runs happen in CI onwindows-latest).After merge
Rebuild, re-run the pre-build, and run the title on the 5080. Expected:
host view heaps capped: ...logged once, thetitle slot past the host heapflood gone (past-cap indices now read the null guard), and no null-write crash at world entry. The pipeline library will rebuild: the emitted shaders change (new clamp constant).This PR was created by an AI agent (OpenHands) on behalf of @MagiccConch.