GPU: implement null UAV descriptor fallbacks and placed UAV support #552
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!552
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/552/head"
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?
@LAKSHYA-cmd-tech on GitHub · 2026-11-24 04:49 UTC · original
LAKSHYA-cmd-tech:fix/uav-null-descriptor-safety→main· +341 −47 · 2 files · 2 commits · closed without mergingSummary
Fixes the RDNA3 / D3D12 GPU page fault and device removal caused by compute dispatches writing to unbound UAVs or placed texture UAVs (reported in #508).
Background & Investigation
In #508, compute dispatches writing to unbound or placed UAV slots faulted on an RDNA3 iGPU (\DXGI_ERROR_DEVICE_REMOVED, page fault at \
@Raxstreams on GitHub · 2026-11-24 05:00 UTC · original
On Windows with an RTX 3080 Ti, I integrated the descriptor changes and ran both placed_null_tests. null_for_creates_uav_matching_dimensions and null_uav_descriptors_created_on_host_heap both passed. This verifies the descriptor tests on NVIDIA. The RDNA3 device-removal report needs separate hardware confirmation.
@wwwwwwww3333333 on GitHub · 2026-11-24 05:00 UTC · original
Review: the null UAV dimensions in
null_uav_likeuse the wrong numbersThanks for picking up #508. The
table_entry/ fresh-table changes look right to me (an unbound UAV slot now gets a null UAV instead of the null Texture2D SRV fromfill_null). One part of the dimension handling is off, though, and it affects the exact case the description says this PR fixes.What's wrong
null_uav_like(words, at)switches onwords[1]with literals1 | 2 | 3 | 5 | 6. Those words are the title'sD3D12_UNORDERED_ACCESS_VIEW_DESC, in the host's layout:uav_descreads them with no translation, andnull_foralready relied ond[1] == 1for buffers. Sowords[1]is aD3D12_UAV_DIMENSION. Inwindows0.62.2 (the version inCargo.lock), these are the values:BUFFERTEXTURE1DTEXTURE1DARRAYTEXTURE2DTEXTURE2DARRAYTEXTURE2DMSTEXTURE2DMSARRAYTEXTURE3DTwo effects:
UAV Dimension Expected: D3D12_UAV_DIMENSION_TEXTURE3D, UAV Dimension In Descriptor: D3D12_UAV_DIMENSION_TEXTURE2DonWindNew:CS_CopyWindFieldBeforeUpdateWithSmooth), which the PR description says is eliminated.maindoesn't have.null_for_creates_uav_matching_dimensionsuses[0, 6, …]for its "Texture3D" case. It passes because it only checks thatCreateUnorderedAccessViewaccepts a null descriptor of that shape, not which dimensionnull_forchose. So the wrong mapping can't fail it.Suggested fix
Match on the
windowsconstants instead of literals, through a small helper that can be unit-tested without a GPU. MS and unknown words keep the 2D fallback thatmainand #205 use.null_uav_likethen matchesnull_uav_dimension(words[1])againstD3D12_UAV_DIMENSION_BUFFER / TEXTURE1D / TEXTURE1DARRAY / TEXTURE2DARRAY / TEXTURE3D(keeping your descriptors as they are), with_as the 2D case. The existing test's 3D case becomes[0, 8, …], and a new test pins the mapping:The whole change on top of
1cd9e5bis about 100 lines, incrates/victory-gpu/src/descriptor/host.rsonly. I'm happy to post the full diff here if that's easier than re-typing.What I ran
On top of this PR's head
1cd9e5b(based2a4bae), Windows 11, Rust 1.98.1x86_64-pc-windows-msvc, AMD RX 6750 XT (RDNA2):cargo test -p victory-gpu: 46 passed, 0 failed, 1 ignored (the existing benchmark). That includes yournull_uav_descriptors_created_on_host_heapandnull_for_creates_uav_matching_dimensions, and the newnull_uavs_follow_the_hosts_dimension_numbers.cargo test -p victory-gpu --features diagnostics: 48 passed, 0 failed, 1 ignored.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean except the pre-existingundocumented_unsafe_blocksathost.rs:267, which is onmainand fixed by #355.cargo fmt -p victory-gpu --check: no diff indescriptor/host.rsordraw.rs. The diffs it reports are in files this PR doesn't touch and are onmaintoo.Not checked
Not runtime-tested with game files, so I can't say whether this PR makes the #508 device removal go away on RDNA3. That needs the reporter or someone with the title. Note also that #205 makes the same dimension change in
null_for(with the right constants), so the two PRs will conflict there.AI-assisted (Claude did the source analysis and wrote the fix; I ran the tests above on my machine).
@LAKSHYA-cmd-tech on GitHub · 2026-11-24 05:39 UTC · original
Thanks @wwwwwwww3333333 for the careful review and catching the dimension word values!
Updated in commit
c261d8d:ull_uav_dimension\ matching against \windows::Win32::Graphics::Direct3D12::D3D12_UAV_DIMENSION\ constants directly (\TEXTURE3D\ is correctly mapped to 8, \TEXTURE2DMS\ to 2D fallback).
ull_uav_like\ to match on \D3D12_UAV_DIMENSION\ enums.
ull_uavs_follow_the_hosts_dimension_numbers\ covering all dimension words (1–8, 0, 99) and updated the 3D case in
ull_for_creates_uav_matching_dimensions.
@LAKSHYA-cmd-tech on GitHub · 2026-11-24 08:15 UTC · original
Resolved upstream by PR #205 (\
6af0faeMerge pull request #205 from asdaasdsaddf/fix/null-uav-dimension), which maps null UAV dimensions matching the title's view dimension.@LAKSHYA-cmd-tech on GitHub · 2026-11-24 08:15 UTC · original
Closing as resolved by merged PR #205.
Pull request closed