Shaders: lower buffer descriptors built around computed and root-constant addresses #2156
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!2156
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2156/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?
@fuzeofficlal on GitHub · 2026-11-25 06:27 UTC · original
fuzeofficlal:feat/shader-built-computed-address-descriptors→main· +781 −23 · 2 files · 1 commits · closed without mergingProblem
resource::track(Tracer::classify) already classifies 4-dwordV#buffer descriptors assembled in shader code around root-constant 64-bit pointer pairs or computed addresses asSource::Built { address: Address { param: MEMORY, .. }, bits, words }, whereasLower::handle(crates/victory-shader/src/emit/lower.rs) still rejects them withErr("a buffer descriptor built around a computed address")(and indexed MUBUF operations fall through toErr("a structured buffer of unknown stride")).Changes
Source::BuiltoverMEMORY(including uniformPhi/Selectjoins with matching(bits, words)) inLower::new'sroot_memoryscan.0..=1of the descriptor SGPR operand (s[code]ands[code + 1] & 0xFFFF), fold structured element strides onidxen, and enforce GFX10OOB_SELECT(0..=3) andNUM_RECORDSlimits viaraw_view_bounded— routing out-of-range lanes to the null viewpair (0reads, dropped writes) without setting false unmapped-page misses or dirty bits inmemory_dirty.s_buffer_load_dword*, raw/structuredbuffer_load_*andbuffer_store_*, sub-dword byte/short loads and stores (preserving sub-dword base alignment),buffer_atomic_*, andtbuffer_load_format_*/buffer_load_format_*(refusing swizzled orADD_TID_ENABLEdescriptors).Verification
emit::memory_tests::buffer_descriptors_built_around_root_constant_addresses_read_and_write_title_memoryandbuilt_computed_address_descriptors_with_swizzling_or_tid_are_refusedvalidated withdxil.dlland executed across RTX 5090, AMD Radeon Graphics, and D3D12 WARP.@upipibi on GitHub · 2026-11-25 07:19 UTC · original
One question on the raw case (
OOB_SELECT3, or 0 with stride 0).built_boundschecks the whole access,off <= NUM_RECORDS - access_bytes, so abuffer_load_dwordx2/x4ors_buffer_load_dwordx*that straddles NUM_RECORDS reads 0 in every dword. XCL checks each dword separately and pins it in a GPU test:gpu_grouped_loads_bounds_and_inactive_lanes(crates/xcl/src/gpu/recomp/tests.rs). There, ans_buffer_load_dwordx2across NUM_RECORDS gives(in-range dword, 0), and abuffer_load_dwordx2(offen) keeps the dwords withoff + 4 <= NUM_RECORDS. If that is the RDNA2 behaviour, a straddling load here loses its in-range dwords, and a straddling store drops them.I haven't found a hardware measurement of this case in XCL or AnyPS5, only XCL's test. If you have an RDNA2 reading for a straddling raw load, it would settle which one is right. The
OOB_SELECT0/1/2 branches match the rules I know.AI-assisted (Claude Code); source read only.
@sinan-cmyk on GitHub · 2026-11-25 08:11 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head
1bb33665ontomain940d32f(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 11:26 UTC · original
Automated triage for the maintainers.
Needs work. In
crates/victory-shader/src/emit/lower.rs,Lower::handle's refusal "a buffer descriptor built around a computed address" is replaced by lowering through the title-memory page table. The newbuilt_memory_descandbuilt_memory_baseread the base from the descriptor SGPRs, andraw_view_boundedappliesNUM_RECORDS/OOB_SELECTbounds for SMEM, raw/structured MUBUF, sub-dword, atomic and format accesses. The tests run on hardware and WARP, and the plumbing reads coherently. CI: passing (check).What it needs:
mainand 23,918 with this PR, and no program changed its failure reason. So nothing in the title currently reaches this refusal, or it stops earlier for another reason. Please show a program that this PR makes translate, or the refusal from a run. Without one, this is about 300 lines of new emulation logic for a case the title does not show.OOB_SELECThandling is emulation behaviour and cites no source. One concrete open point, raised by @upipibi and still unanswered: for raw descriptors (OOB_SELECT3, or 0 with stride 0), the MUBUF paths gate the whole access withoff <= NUM_RECORDS - access_bytes. Abuffer_load_dwordx2/x4that straddlesNUM_RECORDStherefore reads 0 in every dword, and a straddling store drops all of them. Your owns_buffer_loadpath checks each dword separately, which also matches the reference he cites. Please make the two consistent and cite the RDNA2 ISA or a hardware reading for the rule you choose. The same applies toOOB_SELECT0 with a stride, where onlyoff < strideis checked, notoff + bytes <= stride.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-25 12:05 UTC · original
Thanks for the triage review and @sinan-cmyk / @upipibi for the offline check and per-dword
OOB_SELECTnote.Re-checking #614 and the world-run failure breakdowns (#815, #1481) confirms that the root-constant pointer shaders in #614 use
global_load/global_store/s_load_dword*directly on the 64-bit address (already served viaMEMORYonmain), rather than constructing 4-dwordV#buffer descriptors around computed addresses — so no title program currently reaches"a buffer descriptor built around a computed address".Closing this PR to avoid adding ~300 lines of unexercised emulation logic; if a future shader reaches this refusal, we can revisit with per-dword
OOB_SELECTbounds.Pull request closed