GPU: populate unbound table slots with typed null descriptors #2128
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2128
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2128"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@fuzeofficlal on GitHub · 2026-11-25 05:42 UTC · original
fuzeofficlal:fix/gpu-unbound-uav-null-descriptors-508→main· +1390 −39 · 15 files · 4 commits · openProblem
HostHeapinitializes empty view slots to a null 2D float texture SRV (null_view). WhileRootType::ResourceHeapdirect buffer accesses are guarded viaVIEW_STRIDES, descriptor-table (RootType::Table) accesses to unbound, unmakeable, or mismatched slots still bind the shared title slot directly when all indices lie belowhost.count(). When a compute or graphics shader writes or executes atomics on an unbound table UAV (or reads an empty/mismatched slot as another buffer or texture dimension), hardware executes unordered writes against a 2D SRV descriptor, removing the device on RDNA GPUs and failing D3D12 validation.Changes
victory-shader+shader_cache: Record constant-offset descriptor-table handle annotations (TableView { slot, dword, props }) duringLower::handle(includingPhi/Selectleaves, preferring UAV when annotated both ways, and skipping waterfall/dynamic offsets) and round-trip them throughshader_cache.descriptor::host: Addnull_desc_for_propsandHostHeap::make_null_forto synthesize matching null SRV and UAV descriptors across typed, raw, and structured buffers (StructureByteStride+VIEW_STRIDES) and 1D/2D/2DMS/3D/Cube/array texture dimensions (F32/SINT/UINT), and preserve raw/structured buffer UAV flags innull_for.draw::State::tables: Keep fully bound tables and plain 2D float SRV empty slots on the in-place zero-copy path (683ad7a), while rebuilding tables whose accessed entries lack a compatible live view in dynamic slots (deduplicated infresh_tables, withheap.index(at)bounds checks for tables near the end of a title heap) so shared empty title slots inHostHeapare never mutated.Verification
victory-shader:stride_tests::table_views_record_constant_entries_prefer_uav_and_skip_dynamic(dxil.dllvalidated).victory-gpu:descriptor::host::tests::null_desc_for_props_covers_buffers_and_textures,shader_cacheround-trip, anddraw::tests::unbound_table_uavs_and_shared_null_slots_execute_cleanly(in-place shared slot02D SRV read, 5 unbound compute UAVs + mismatched explicit-null SRV,PAGE_NOACCESSheap-tail guard page table, and pixel-shader unbound UAV draw) verified withVICTORY_D3D12_DEBUG=1andVICTORY_D3D12_DRED=1across AMD Radeon Graphics (RDNA2 iGPU), NVIDIA RTX 5090, and D3D12 WARP.Closes #508.
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 06:25 UTC · original
One remaining case on 6498c283929cee85c66cc3b156ce95d6b1d8bc69 is a live SRV in a slot the shader annotates as a UAV. The live-view check accepts the slot, and the dynamic-table path also copies the SRV if another slot already caused a rebuild.
c4edbb5 checks the SRV/UAV access kind in both paths and uses the existing typed null for a mismatch. The test failed before submission because VIctory left the raw SRV bound in place. After, the same test kept the original slot live, reused the replacement table on a second lookup and dispatched with WARP GPU-based validation. The null raw UAV read back zero and the output buffer recorded the shader's completion sentinel.
The GPU suite went from 148 passed, 1 failed and 2 ignored to 149 passed and 2 ignored. Your unbound-table compute and pixel test also passed with GPU-based validation. Strict GPU Clippy with diagnostics and staged asset policy passed. The check covers SRV versus UAV access kind.
@fuzeofficlal on GitHub · 2026-11-25 08:21 UTC · original
Thanks @andrewpozdnakov7-jpg — good catch. A live SRV in a slot the shader annotates as a UAV got through both the live-view check and the copy into a rebuilt dynamic table. Your commit c4edbb5 is now on the branch as-is with your authorship (it fast-forwarded from our head), plus a rustfmt-only follow-up (4ec3f5f). It leaves CBV entries, sampler heaps and read-only SRV tables unchanged. Your test passes on hardware, on WARP with diagnostics and under the D3D12 debug layer; clippy is clean in both modes.
@sinan-cmyk on GitHub · 2026-11-25 10:09 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head 4ec3f5f9 onto
main940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 10:47 UTC · original · edited 2026-11-26 03:23 UTC
Automated triage for the maintainers.
Verdict: merge candidate. Re-reviewed at
08d02e7, which merges cleanly intomain. The change since the last review is a rebase plus one fix:host_shaderincrates/victory-gpu/src/pipeline/depth_bounds_test.rs(a test added tomainafter this PR was reviewed) now setstable_views: Vec::new(), so the test module compiles with the newHostShaderfield. OtherHostShaderinitializers in the tree already set the field. The substance is unchanged: typed nulls for unbound or access-mismatched table slots inState::tables, constant-offsetTableViewannotations fromLower::handle, and theshader_cacheencoding that invalidates old entries.On your reply: confirmed. For the maintainer, the earlier note still stands: about 2x CPU cost in
State::tableson fully bound tables (0.8 to 1.6 µs for 4 SRVs, 6.4 to 13.8 µs for 32).CI: passing (
check).Generated by Claude Code
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 13:08 UTC · original
I measured the table-recording cost raised in triage. The same Windows/WARP synthetic fixture uses a direct table of live R8G8B8A8_UNORM Texture2D SRVs. On the PR, the constant-offset metadata describes those same slots. The timed section is CPU time in State::tables, with the list and textures already created and a check that the table uses its original slots. The GPU crate was built with opt-level=3.
940d32fThese are the medians of five alternating process runs per revision. Each process warms up 1,000 calls and measures seven batches of 25,000 calls. This measures CPU recording for these tables. A trial that saved the first pass's descriptor record to skip a second mirror lock ran slower in a separate paired replay (1.31 → 1.55 µs and 12.44 → 13.90 µs).
I also checked the overlap with #2158. The exact heads 4ec3f5f and
f346d1dconflict in draw.rs. b91d430 retains both parents and resolves it by allowing either reason to create a fresh table and keeping both the typed-null annotations and placed-buffer backing in the key. All three focused WARP GPU tests passed with the D3D12 debug layer enabled. The full WARP GPU suite had 150 passed and 2 ignored. Both strict GPU Clippy modes and staged asset policy passed.If you reuse the conflict resolution in a squashed commit, please preserve our attribution with this trailer:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
@fuzeofficlal on GitHub · 2026-11-26 02:52 UTC · original
Rebased onto
main(63bcca43) in08d02e76and updatedcrates/victory-gpu/src/pipeline/depth_bounds_test.rswithtable_views: Vec::new()(fixing a silent test-compilation failure introduced after #158 landed). Verifiedpipeline::depth_bounds,clippy --features diagnostics --tests, andxtask policy.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.