Shaders: infer heap UAVs program-wide and emit IsGloballyCoherent on glc UAVs #1354
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!1354
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1354/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?
@wbkepler on GitHub · 2026-11-24 17:35 UTC · original
wbkepler:shader/heap-uav-and-glc-coherent→main· +299 −71 · 2 files · 1 commits · closed without mergingSummary
Implements #724 and #725 in
crates/victory-shader/src/emit/{lower.rs,shader.rs}:infer_uav_heaps/UavHeaps/is_uav): Program-wide scan marking heap descriptor sources with any store, atomic, or dynamic-heapglcaccess as UAVs so loads, stores, atomics,descriptor_data, ands_buffer_load*all use UAV handles (0x1000/0x100B) instead of SRV/CBV, while read-only non-glcheap descriptors keep SRV/CBV.IsGloballyCoherent): ORs0x4000ontoglcUAV buffer, image, ands_buffer_loadResourceProperties(never on SRVs/CBVs).dxil.dll-validation tests (heap_buffer_load_and_store_both_emit_raw_uav_and_validate,heap_s_buffer_load_with_buffer_store_emits_raw_uav_and_validates,glc_uav_buffer_and_image_loads_emit_globally_coherent_and_validate).Verification
cargo clippy -p victory-shader --all-targets -- -D warnings— passedcargo test -p victory-shader— passed (123 passed, 1 ignored)cargo xtask policy— passed (154 files ok)@wildheathen on GitHub · 2026-11-24 18:19 UTC · original
#1271 and #1354 compared: same output on a retail dump, small differences in scope
Both PRs fix #724 and #725 (heap UAV inference,
IsGloballyCoherentonglcUAV access) and both are based on mainffe310e. I'm not the author of either. I measured them the same way so review can pick one.Setup: Windows 11, RTX 5080 (driver 32.0.16.2124), Rust 1.98.1 MSVC, dxil.dll 10.0.26100. Offline translation only (no title run, no world).
Retail dump (
victory translate --validate --list, plusVICTORY_EMIT_DUMPto keep every emitted shader)ffe310edxc -dumpbin): 0 → 310 handles withIsGloballyCoherent(0x4000); 1,306 → 1,474 handles withIsUAV(0x1000), i.e. 168 SRV handles become UAVs; barrier counts unchanged.Tests
cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings: clean on both.cargo test -p victory-shader -p victory-gpu: main 170 passed; #1271 173; #1354 173 (0 failed, 2 ignored each).glc_heap_uav_loads_stores_and_atomics_execute_on_gpuon the GPU): 5 of 5 pass.Differences the dump doesn't show
None of these changes a program in this title. They matter only for code the dump doesn't contain.
glcaccesses count. #1271 infers a UAV fromglcon untyped buffer access,image_load/stores/atomics without a sampler, ands_buffer_load*, and drops any address that is also sampled. #1354 takesglcfrom any buffer, image or SMEM instruction, unless a used-resource entry declares the view SRV or CBV. So aglctyped-buffer load, or a sample withglcon an undeclared heap descriptor, would make a UAV in #1354 and not in #1271.glc) when deciding whether a computes_barriergets the global UAV fence. #1354 leaves that decision as it is on main. In the dump every changed program already had the global fence, so the output is the same. A compute program that only spin-waits on aglcheap load, with no declared UAV, would get the fence from #1271 only.used_kindout to a free function, and its tests are DXIL-only.Taken together: on this title either one gives the same shaders. #1271 was opened first, covers the barrier case and has a hardware test. #1354's refactor of
used_kindis neutral. Merging one and closing the other seems the cleanest; whatever #1354 has that #1271 lacks (typed-bufferglc) can be a follow-up if a title needs it.No game data, shader bytes or shader names are included here; counts come from a local dump. I haven't run either in the world yet. If useful, I can run the
9ef9a9d818b27236loop-hang A/B from #725 on the 5080.AI-assisted (Claude Code).
@Jitheswar on GitHub · 2026-11-24 21:58 UTC · original
I found a synthetic SRV regression on
cd9699f. In the existingWATERFALL_INDEXED_WAVE32fixture, set bit 13 on theimage_sample_lzinstruction's first dword (0xF09C_0F08→0xF09C_2F08) and omit the texture's SRV entry fromNativeProgram.used. Keep the bound textures, sampler, UAV, and expected readback unchanged.On RTX 3050 under Proton,
ffe310eand #1271 (25d9e2a) both produced the expected readback. This PR rejected the same program during lowering withsampling a UAV. The glc-only inference includes sampled image operations and promotes their untyped descriptor to UAV. Excluding sampled descriptors from that inference would preserve this path.Synthetic fixture only. AI-assisted with Codex.
@Marvisak on GitHub · 2026-11-25 00:38 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1271. Same two issues (#724, #725) as #1271, opened 40 minutes later: program-wide heap UAV inference and IsGloballyCoherent on glc UAVs. #1271 has GPU read-back tests; this has unit and validator tests only.
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.
Pull request closed