Shader: lower scalar Root CBV/SRV loads and descriptor-as-data queries #1376
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!1376
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1376/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:39 UTC · original
wbkepler:shader/scalar-and-descriptor-data→main· +1338 −123 · 2 files · 2 commits · closed without mergingSummary
Rebased cleanly onto
upstream/main(ffe310e):s_load_dword*directly onRootType::Descriptorviews (root_cbv_handle/root_srv_handle) instead of falling through todescriptor_data.buffer_srv_uav_props) acrosss_buffer_load_dword*,buffer_*, anddescriptor_data, supporting scalar loads from structured buffers andFields::Smemconsumers.s_load_dword*loads, populates bufferV#dword 1 stride bits, supportsCube/2DMS/2DMSArrayimage dimensions and atomic image UAV annotations, infers view kinds from twin dynamic/waterfall loads andUsedResourcetable entries, and ignores dead descriptor-dwordphiedges when another reachable path carries scalar data.dxil.dll+ hardware GPU + WARP execution tests invalu_testscovering structureds_buffer_load_dwordx2+ multi-slots_load_dwordx16metadata, Root CBV/SRV scalar loads, and twin bindless loads + descriptor-onlyUsedResourcequeries + dead descriptor-dwordphijoins.Verification
cargo clippy -p victory-shader --all-targets— passedcargo test -p victory-shader— passedcargo xtask policy— passed@sinan-cmyk on GitHub · 2026-11-24 18:21 UTC · original
Data from a retail dump: what this PR would meet after #1402
Summary: #1402 makes "a descriptor's address or format read as data" the largest failure. This PR targets the same area, but it conflicts with #1402.
I measured #1402 on a retail dump (details). With #1402, "a descriptor's address or format read as data" becomes the largest failure: 809 programs, against 92 on
main. This PR touches the same code, so here is what those 809 programs read.To get the breakdown, I made a local build that adds the descriptor dword and the view kind to the reason. Counts by the dword read as data:
descriptor_databuildsMost of these are raw buffers, so a real address dword is read. In one program I traced (a mesh shader), the descriptor's registers are reused for
s_buffer_loaddata on one branch only. At the join, a phi then mixes descriptor dwords with data, and the data path is what the program really consumes. That looks like the case this PR describes as "dead descriptor-dword phi edges". The stride bits in dword 1 may cover part of the dword-1 row as well.This PR conflicts with #1402 in
emit/lower.rsandemit/valu_tests.rs. So do #259, #329, #995, #317, #109, #180, #1083, #1333 and #1409, which I tried to stack on #1402 in the same run. If you rebase onto #1402 (or ontomainonce it lands), I can measure the result on the dump and post the program-by-program comparison here.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@wbkepler on GitHub · 2026-11-24 20:26 UTC · original
Pushed
272c262: fixes a regression this branch introduced.Symptom: on an RTX 5090 (Windows 11), a title that rendered its boot/menu screens on
mainpresented only black frames with this branch merged. Draw counts were unchanged and there were no debug-layer errors. I bisected the integration branch to this merge, then narrowed it to one hunk with env toggles.Cause:
buffer_srv_uav_propsgaves_buffer_load_dword*a structured annotation (12, stride from the resource table) whenever the table recorded a stride, even when nobuffer_*access of that descriptor indexes records. In that title the table records stride 64, but the view is raw. NVIDIA returns zeros for a mismatched heap annotation in both directions: the olds_buffer_load_and_multi_descriptor_data_executealso reads zeros on this GPU if the loads are raw over its structured view. So the table stride alone can't choose the kind.Fix: the byte-offset loads are structured only when a
buffer_*access of the same descriptor indexes records (the same rule that access lowers with). Otherwise they stay raw, as onmain. The descriptor-as-data query (descriptor_data) keeps the recorded stride.s_buffer_load_with_table_stride_reads_raw_viewtest (raw view, table stride 64), passing on hardware and WARP.multi_descriptor_data_executeand still checks record count, stride and UAV size.AI-assisted fix, checked on Windows 11 / RTX 5090.
@Marvisak on GitHub · 2026-11-25 00:39 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.1,338 lines on scalar root-view loads and descriptors read as data, written against
ffe310e. Main covers the same ground since (75677cb8sizes and twin loads,27c3dc9dandd71c3889root views,683ad7a9table constants); what is left (cube/MSAA dimensions) is #317.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