Shaders: a descriptor read only as data takes the kind of its entry's… #1130
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!1130
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1130/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?
@felicienradio on GitHub · 2026-11-24 16:02 UTC · original
felicienradio:shader/descriptor-data-same-entry→main· +82 −1 · 1 files · 1 commits · closed without merging… use
The console compiler reads sizes from a descriptor's bits (a texture's height and base level, say) in a loop of its own, apart from the loop that samples through the same heap entry. That load's dwords were never used as a resource, so its kind was unknown and the program was refused ("a descriptor read only as data"). Another load of the same entry (the same parameter and offset, and the same computed term or the first lane of the same VGPR in a waterfall pass) that is used as a resource now gives the kind, and the fields are rebuilt from the host view as for any descriptor read as data.
Translation census over the title's 26,503 containers, on #439's tree: 22,656 translated instead of 21,909 (747 more, none lost); the refusal falls from 819 programs to 53, and 19 of the others reach a later one. Of the shaders a run on an RTX 3060 refused, 172 more translate.
The console compiler reads sizes from a descriptor's bits (a texture's height and base level, say) in a loop of its own, apart from the loop that samples through the same heap entry. That load's dwords were never used as a resource, so its kind was unknown and the program was refused ("a descriptor read only as data"). Another load of the same entry (the same parameter and offset, and the same computed term or the first lane of the same VGPR in a waterfall pass) that is used as a resource now gives the kind, and the fields are rebuilt from the host view as for any descriptor read as data. Translation census over the title's 26,503 containers, on #439's tree: 22,656 translated instead of 21,909 (747 more, none lost); the refusal falls from 819 programs to 53, and 19 of the others reach a later one. Of the shaders a run on an RTX 3060 refused, 172 more translate. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SDn5GupcrERtCYPyoztdtG@pablogonz12 on GitHub · 2026-11-24 16:38 UTC · original
Independent check on Linux (RX 9070 XT, RADV/Mesa 26.3.1, dxil-spirv master, spirv-val 1.3). Your head
98f073dapplied alone onto origin/mainffe310e, then the offline four-stage check over the 751-program world dump plus the 52-program BVH capture (768 programs after 35 duplicate containers are skipped):ffe310eAll 4 clear and no other class grows except one: a pixel program that main refused with "a descriptor read only as data" now reaches "a scalar memory read as data" (pixel 3 -> 4), so net +3 here. The 10 spirv-val failures are the same pre-existing ones; the RADV pipeline stage adds nothing.
For comparison, my own attempt at the same 4 (raw buffer view, commit 61085ee in our tree, not pushed) also clears them, with one landing on "a descriptor's address or format read as data" (669 translated, like yours). Yours and #1067 are the better fixes; I did not open a competing PR.
Not tested: the full archive (only these dumps), in-game, native Windows.
@shortselow-byte on GitHub · 2026-11-24 16:41 UTC · original
#1067 and #1130 both remove the refusal "a descriptor read only as data", in different ways, and neither mentions the other:
shortcut:).Tested on Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT, both on
mainffe310e(neither has a CI run yet):--all-features)6d30fd798f073dThey conflict in
lower.rs(descriptor_data), so whichever merges second needs a rebase. They combine naturally: in #1067's version,match use_at.or_else(|| self.same_entry_use(site)), so #1130's lookup runs first and #1067's table/heap fallback only when no other load of the entry is used. With that one-line resolution (local, not pushed), both new tests pass together (a_descriptor_only_read_as_data_gives_its_views_sizeon the AMD device and WARP,a_descriptor_read_only_as_data_takes_the_kind_of_its_entrys_use), the workspace has 344 passed, 0 failed, and both clippy runs are clean.That order would also keep #1067's 2D guess for heap entries that #1130 can't name, instead of using it first.
@fuzeofficlal on GitHub · 2026-11-24 17:18 UTC · original
Reviewed
98f073dand tested multi-descriptors_load_dwordx16+ twin-load cases. One concrete offset/alignment bug insame_entry_use:same_entry_usecomparesb.offset == a.offsetwithout adding4 * u32::from(other_first), and returns the other load'sfirst(other_first) assite's ownfirst(Source::Loaded { load: site, first }).s_load_dwordx16at0x0and samplesother_first = 8(entry0x20), whilesiterunss_load_dwordx8at0x0(entry0x0, e.g. a CBV),b.offset == a.offset(0 == 0) falsely matches entry0x20, shiftsheap_indexto0x20, and computesrel = k.wrapping_sub(8)so everyk in 0..8becomesVal::Missing.siteloads entry0x20directly (first = 0) while the resource access came froms_load_dwordx16at0x0(other_first = 8),0x0 != 0x20fails to match the twin load.Matching
b.offset.wrapping_add(4 * u32::from(other_first)) == (a.offset & !31)while keepingsite's ownfirst = 0and intra-slot offsetin_slot = (a.offset & 31) / 4(rel = (in_slot + k).wrapping_sub(u32::from(first))) resolves both cases cleanly. Verified withdxil.dll+ RTX 5090 & WARP readback infuzeofficlal/VIctory@66a9fde.@Zipettte on GitHub · 2026-11-24 18:01 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
98f073d:cargo test -p victory-shaderpasses, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@alessiodeia on GitHub · 2026-11-24 19:25 UTC · original
In-game data for
98f073don an RTX 2070 SUPER (Turing, 32..32), driver 617.42, Windows 11. On this tree it is what clears the class, and it composes with #979.Base tree:
mainffe310e+ #439bf0f951+ #493 #587 #282 #876 #67 #490 #464 #984 +fix/unaligned-buffer-srv+ the #840/#916 fork branches. Diag build, Series X,VICTORY_D3D12_DRED=1, 30 minutes per run, no device removal in any run. A regression below means a program that translated in the reference run and is unusable in the new one; programs a run never loaded don't count.a descriptor read only as datab6a9bdc,c8353a8)b6a9bdchas no used-resource entry to take the kind from. Your same-entry rule is the one that fits them: 182 of the 184 emit with this PR. The 2 that remain are pixel programs.descriptor_data. I resolved it asuse_at.or_else(|| self.same_entry_use(site)), with #979's table-entry inference as the fallback, so each covers what the other can't.cargo test -p victory-shader: 161 passed on the GPU.dxil.dllwithEntry function performs some operation that is incompatible with the shader stage. That is #201's compute-gradient case under validator 1.6, not this PR. With #1065 on top, all 173 validate.I haven't run a tree with @fuzeofficlal's offset correction for
same_entry_useapplied, so these numbers are for98f073das is.No game data attached. AI-assisted (Claude Code).
@sinan-cmyk on GitHub · 2026-11-24 19:50 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: +240 programs over
main, 0 lost.Offline. I merged head
98f073dontomainffe310e(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: 21,724 onmain, 21,964 with this PR.mainAll 240 are among the programs that #1402 gains (its "a descriptor read only as data" part comes from #1067). Note: 72 more programs that fail with "a descriptor read only as data" on
mainnow emit DXIL that the validator rejects ("Entry function performs some operation that is incompatible with the shader stage"). They still count as failing, but the emitted code is wrong rather than refused.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@ScarionWorkspace on GitHub · 2026-11-24 20:09 UTC · original
#1067 vs #1130 head-to-head, full archive, bare
main. Windows 11, RX 9070 XT, Rust 1.98.1, dxil.dll from SDK 10.0.26100.victory translate --list --validateovershaders.rpf+ the executable (1.0.2.1, 25,901 programs), each PR alone merged ontomainffe310e, compared program by program:6d30fd7)98f073d)same_entry_usetried before #1067's table fallbacksame_entry_use.AI-assisted (Claude); counts only, no game data.
@sinan-cmyk on GitHub · 2026-11-24 21:18 UTC · original
Stacked on #1402: no change, and the validator errors are gone
Result: 0 gained, 0 lost, and no failure reason changes on top of #1402. On
mainthis PR gained 240 programs, and all of them are among #1402's gains (via #1067).The 72 validator errors I reported on
maindo not appear on #1402. With the merge, 0 programs fail with "Entry function performs some operation that is incompatible with the shader stage".The merge conflicts in 4 hunks of
emit/lower.rs. I kept #1402'smatch use_atindescriptor_data, but made itmatch use_at.or_else(|| self.same_entry_use(site)), so this PR's same-entry lookup runs before #1067's table-range guess. Both helpers and both sets of tests are kept.cargo test --locked -p victory-shader --lib: 138 passed, 0 failed.Method:
victory translate --validate --listonshaders.rpf(1.0.2.1), dxil.dll 1.8.2502.11, compared program by program (25,889 programs), against #1402 at2310409. AI-assisted (Claude Code). No shader names or data are included, per the asset policy.@Marvisak on GitHub · 2026-11-25 00:32 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.A descriptor read only as data takes its kind from another load of the same entry: exactly what main's descriptor_data does (
75677cb8, same parameter/offset/first-lane rule).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