Repository navigation
Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent - #1271
fuzeofficlal wants to merge 1 commit into
Conversation
catminou4
left a comment
There was a problem hiding this comment.
Heap UAV inference: descriptors written/atomically-modified or accessed with glc (and never sampled) get UAV_PROP, glc ones also GLOBALLY_COHERENT_PROP; sampled descriptors are excluded, image glc counts for stores and image_load only. Same family as #1055/#1015 (descriptor-kind inference) — the three touch neighboring hunks in lower.rs, so merge order will need rebases. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p victory-shader --locked. Shader execution tests (valu_tests/host) are #[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. 98 passed, 0 failed (2 lowering tests on macOS; the glc load/store/atomic execution test is Windows-gated).
|
Setup: Linux, RX 9070 XT, RADV (Mesa 26.3.1), dxil-spirv master, spirv-val 1.3. Your head folded onto a base of origin/main
No program gained or lost and the failure table is identical to the base, reason for reason: nothing in this capture reaches the class you handle, so this is a no-regression result only (same 10 SPIR-V validation failures as the base). Not tested: in-game. |
#1271 and #1354 compared: same output on a retail dump, small differences in scopeBoth PRs fix #724 and #725 (heap UAV inference, 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 (
|
| validated | vs main | DXIL changed vs main | |
|---|---|---|---|
main ffe310e |
21,736 | ||
| #1271 | 21,736 | 0 / 0 | 176 compute programs |
| #1354 | 21,736 | 0 / 0 | 176 compute programs |
- The two PRs emit byte-identical DXIL for all 21,882 emitted programs. The 176 they change are the same 176, all compute; no vertex, pixel or mesh program changes.
- In those 176 programs (disassembled with
dxc -dumpbin): 0 → 310 handles withIsGloballyCoherent(0x4000); 1,306 → 1,474 handles withIsUAV(0x1000), i.e. 168 SRV handles become UAVs; barrier counts unchanged. - Validation counts don't move, as expected: the change is in handle properties, not in which programs are accepted.
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; Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent #1271 173; Shaders: infer heap UAVs program-wide and emit IsGloballyCoherent on glc UAVs #1354 173 (0 failed, 2 ignored each).- Cross-check: each PR's new tests run against the other PR's lowering, and all pass:
- Shaders: infer heap UAVs program-wide and emit IsGloballyCoherent on glc UAVs #1354's code + Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent #1271's tests (two DXIL-property tests, and
glc_heap_uav_loads_stores_and_atomics_execute_on_gpuon the GPU): 5 of 5 pass. - Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent #1271's code + Shaders: infer heap UAVs program-wide and emit IsGloballyCoherent on glc UAVs #1354's three DXIL tests: all pass.
- Shaders: infer heap UAVs program-wide and emit IsGloballyCoherent on glc UAVs #1354's code + Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent #1271's tests (two DXIL-property tests, and
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.
- Which
glcaccesses count. Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent #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. Shaders: infer heap UAVs program-wide and emit IsGloballyCoherent on glc UAVs #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 Shaders: infer heap UAVs program-wide and emit IsGloballyCoherent on glc UAVs #1354 and not in Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent #1271. - Barrier fence. Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent #1271 also counts inferred UAVs (written or
glc) when deciding whether a computes_barriergets the global UAV fence. Shaders: infer heap UAVs program-wide and emit IsGloballyCoherent on glc UAVs #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 Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent #1271 only. - Size. Shaders: propagate written heap UAVs and mark glc UAV handles globally coherent #1271 is +558/−31 with a GPU execution test. Shaders: infer heap UAVs program-wide and emit IsGloballyCoherent on glc UAVs #1354 is +299/−71: it also moves
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_kind is neutral. Merging one and closing the other seems the cleanest; whatever #1354 has that #1271 lacks (typed-buffer glc) 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 9ef9a9d818b27236 loop-hang A/B from #725 on the 5080.
AI-assisted (Claude Code).
Code tree of fxceless/victory-fork 4e17478 (all rendering work by its author and the VIctory contributors) with, on top: - AMD fixes: skip of 39f0e9aeb156a61c, 32-lane programs per half wave and NaN/Inf filter, configurable texture upload queue, VIctory Marvisak#1599 - upstream VIctory Marvisak#334 (buffer-state tracking) and Marvisak#1271 (globally coherent glc UAVs) - fork PRs Marvisak#95, Marvisak#71, Marvisak#32, Marvisak#86; VIctory Marvisak#1696, Marvisak#1338, Marvisak#1291, Marvisak#1732 - DirectStorage page lists read at the title's submit (analysis by JappertjeV, klbf-lab#3) - offline pipeline pre-build that saves as it goes and skips driver-crashing pipelines - Series S plane composition, VICTORY_FFX_SIMPLE, scripted keys in release builds - docs/klbf/skip-amd.txt: AMD skip list used for our runs
|
Automated triage for the maintainers. Merge candidate. The written-UAV propagation ( On your reply: confirmed. The branch merges cleanly with current CI: passing ( Generated by Claude Code |
Pre-scan resource descriptors by tracked heap address so any heap descriptor accessed with a store, atomic, or non-sampled glc load lowers consistently as a UAV across vector loads, scalar s_buffer_load_dword, and descriptor_data queries (fxceless#724). OR IsGloballyCoherent (0x4000) into UAV handle properties when cache.glc is set on buffer, image, or scalar buffer accesses, and fence UAVs on compute barriers when glc UAV accesses are present (fxceless#725). (cherry picked from commit 25d9e2add72c6f92bd83381eb4224da344486b98) Ported from Marvisak/VIctory#1271. Conflicts with the fork's buffers picked by index: a scalar load through a descriptor inferred as an unordered access view takes the view's raw read, not the guarded pair of buffer and constant buffer reads; two tests' handle lists follow the fork's raw reads of structured buffers and its picked loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017V7WBDcuSkQXqyyY47pR31
25d9e2a to
1ef830d
Compare
The port of Marvisak/VIctory#1271 (edbfae6) put the globally coherent bit into the handle properties of every glc access through an unordered view. A root view has one handle for all its accesses, and the match that picks it knew only the properties without that bit: a glc store through a root UAV fell to "a typed root view is not supported" and the program did not translate. Four programs of the ray-tracing structure builder do that (93be497edd442293, 5552dac6a2b7a1fd, 5279ae36796c31fc, ffd93c8a029ff016); its stages run all or none, so with VICTORY_BVH_BUILDER=1 the builder stayed off (run main-9e6137f-builder: missing=4 of=53; all 53 had host pipelines on Nov 24). The bit is left out when a root view's handle is picked, as before the port. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017V7WBDcuSkQXqyyY47pR31
1ef830d to
1db404e
Compare
|
Updated in
|
… reads with glc are UAVs program-wide, and glc UAV accesses are globally coherent (upstream VIctory Marvisak#1271 by fuzeofficlal, for Marvisak#724 and Marvisak#725, onto this tree): descriptor addresses are scanned once per program, a handle on one of them is a UAV (0x1000) wherever it is loaded again, and a buffer, image or scalar buffer access with glc on a UAV sets IsGloballyCoherent (0x4000), so a load in another workgroup sees what one wrote (RDNA keeps glc loads in its per-workgroup caches otherwise); a compute program that writes or spin-waits on inferred UAVs gets the global UAV fence at s_barrier. A heap-picked scalar load of a UAV reads through the UAV handle instead of the buffer-view-or-constant-buffer pick. Marvisak#1271 over Marvisak#1354: the same output on a retail dump, and it also covers the barrier fence and keeps sampled descriptors as SRVs
1db404e to
0f84157
Compare
|
Automated triage for the maintainers, second look (a review against This is right (written heap UAVs are propagated, and Two more things to know. It conflicts with Push the change and it will be reviewed again. Thank you for the contribution. |
0f84157 to
db3ebea
Compare
…y coherent Pre-scan resource descriptors by tracked heap address so any heap descriptor accessed with a store or atomic lowers consistently as a UAV across vector loads, scalar s_buffer_load_dword, and descriptor_data queries, including across reloads (Marvisak#724). OR IsGloballyCoherent (0x4000) into UAV handle properties when cache.glc is set on buffer, image, or scalar buffer accesses, while keeping read-only glc heap descriptors as SRVs (Marvisak#725).
|
Updated and rebased onto
|
db3ebea to
0dc4320
Compare
|
I independently verified
The tests used synthetic shaders and verified the read-mark case on the current tree. AI-assisted with Codex. |
Fixes #724.
Part of #725.
Summary
#724): Pre-scanRole::Resourcedescriptor leaves by tracked(param, offset + 4 * first, dynamic)address (written_uavs) so any heap descriptor accessed with astoreoratomicoperation lowers consistently as a UAV across vector loads, scalars_buffer_load_dword*,descriptor_data, and separate reloads of the same heap address. Read-only heap descriptors (includingglc-only reads without stores or atomics) remain SRVs.IsGloballyCoherent(0x4000) onglcUAV handles (#725): Set0x1000 | 0x4000indx.types.ResourcePropertiesword 0 wheneveruav && cache.glcacrossbuffer(raw, structured, typed),image(image_load,image_store,image_atomic_*), andsmem(s_buffer_load_dword*).Verification
emit::lower::tests::heap_uav_inference_and_glc_coherence_set_handle_propertiesandglc_only_heap_reads_stay_srv_and_table_uavs_are_globally_coherent(dxil.dllvalidated): verify written-UAV reload propagation,0x500B/0x500C/0x500A/0x5002IsGloballyCoherenthandle properties, and that read-onlyglcheap descriptors stay SRVs (0x000B/0x0002).emit::valu_tests::glc_heap_uav_loads_stores_and_atomics_execute_on_gpu: multi-group ([2, 1, 1]) synthetic compute readback on NVIDIA GeForce RTX 5090 and D3D12 WARP.cargo clippy -p victory-shader --tests --locked -- -D warningsandcargo xtask policy: passed.