Repository navigation
Shaders: a descriptor only read as data takes its kind from its table - #1067
undeadhuman37 wants to merge 1 commit into
Conversation
An s_load_dword* of a descriptor whose dwords the code reads as numbers (an image's width and levels) but never samples was refused with "a descriptor read only as data": the view's kind came only from a use. Now the table's range names it, and an entry in the resource heap that no range names (a run-time index reaches it) is an image if it is eight dwords, taken for 2D (shortcut noted in the code). Offline over the whole corpus, programs refused: 4123 -> 3749; "a descriptor read only as data" 395 -> 18; compute programs emitted 1441 -> 1743 (validated 1417 -> 1647). Tested with a hand-assembled waterfall program that reads two textures' sizes, on the host GPU and WARP; it fails with the old refusal without the change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
catminou4
left a comment
There was a problem hiding this comment.
A descriptor read only as data no longer refuses the whole program — and since that path errored before, the heuristic cannot regress anything that compiled. The kind guess is grounded in the console descriptor format (8-dword image vs 4-dword buffer ranges), the structured-buffer stride check (stride >= 4 && is_multiple_of(4)) is conservative, and the CBV guard from the loaded-use path is preserved. The admitted shortcut (image taken as 2D, buffer as raw/structured) is documented in the comment, and the new waterfall test pins the ray-tracing-resolve shape (size read through v_alignbit_b32) with per-lane expected values.
Verified locally: test-merge with main clean; cargo test -p victory-shader --locked (macOS arm64, rustc 1.98.1) → 96 passed / 0 failed / 1 ignored. Scope note: a_descriptor_only_read_as_data_gives_its_views_size executes on the host harness, which is Windows-gated, so macOS covers compilation + existing tests only; the build_with refactor keeps the old assertions intact (wave_ops expectation correctly parameterized). Approving; a cube/MSAA size-read case would be a good follow-up test on the Windows lane.
|
I ran the same small fixture with and without the #1067 lowering on our integration tree. The shader loads a fixed 8-dword SRV table entry with
Two distinct compute shaders hit the same translation refusal in an earlier prologue trace. This test covers a 2D table entry. Array and 3D dimensions and the effect on the prologue remain unverified. AI-assisted fixture, tested locally with generated data. |
|
Sizing for NVIDIA: with console-flow wave64 in place, this refusal becomes the largest one in compute, so it pairs well with #439. Full offline census (26,503 containers, DXIL validation,
Of the 411 compute programs my #189 (Wave32) stack refuses for its two main wave reasons, 253 reach this one next on the #439 stack, and only 103 validate. r4tedx counts 730 compute programs at it on #439 alone (#439 (comment)). JMAN730's fork has an independent change for the same class, I haven't measured this PR on the #439 stack. The known limit you mark, the 2D guess for an unnamed heap entry, is what I'd check at runtime. AI-assisted (Claude Code): the census was automated. The hardware, title copy and runs are the user's. |
|
Independent check on Linux (RX 9070 XT, RADV/Mesa 26.3.1, dxil-spirv master, spirv-val 1.3). Your head 6d30fd7 applied alone onto origin/main ffe310e, then the offline four-stage check over the 751-program world dump plus the 52-program BVH capture (768 programs once 35 duplicate containers are skipped):
Exactly those 4 programs clear and nothing else changes: no new refusal, and the 10 spirv-val failures are the same pre-existing ones. "a descriptor's address or format read as data" stays at 1. For comparison I also built my own attempt at the same 4 programs (a raw buffer view, commit 61085ee in our tree, not pushed): it clears them too, but one lands on "a descriptor's address or format read as data", so 669 translated. Taking the kind from the table is the better fix; I did not open a competing PR. Not tested: the full archive (only these dumps), in-game, native Windows. |
|
#1067 and #1130 both remove the refusal "a descriptor read only as data", in different ways, and neither mentions the other:
Tested on Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT, both on
They conflict in That order would also keep #1067's 2D guess for heap entries that #1130 can't name, instead of using it first. |
|
Reviewed
Verified across 8-dword |
|
Runtime verification on Win10/RTX 3080 (driver 621.24): this PR clears the dominant runtime failure class. We dumped the exact containers of every shader that failed at runtime ( With this PR stacked (main Note for the record: #1056 (which we tried first) gained ~0 on this class, consistent with the #1247 benchmark; this PR is the one that moves it. The residual "descriptor read only as data" cases now report as "a descriptor's address or format read as data" (40) — the dword-0/1 subset your summary routes onward. Remaining runtime classes after this: descriptor-address/format-as-data 40, address-not-from-root 29 (#1276's pattern), address-from-phi 11, image_gather4_l 9, root-UAV/typed-root-view 8. AI use: Qwen Code (underlying model name not disclosed by the tool) ran the builds/censuses and drafted this comment at the user's request. |
|
Offline pipeline-creation check on an RTX 5060 Ti: #1067 on top of #585 adds 540 host pipelines and loses none. Together with #585 it adds 563 over
I measured #1067 stacked on #585 (
In the game (same machine, same save, empty shader cache), the stacked build had 0 regressions: no shader whose pipeline was created on AI-assisted (Claude Code); everything was run on our machine. |
A descriptor dword read only as data no longer stops the program: when no instruction uses it, the table's range names its kind (eight dwords is an image, else a structured or raw buffer), and an SMEM buffer load of a descriptor reads it as a raw buffer view. A constant buffer's descriptor read as data stays refused. Pixel inputs of packed 16-bit values now pair each packed row with its unlisted partner row, as the console's input table does, instead of refusing a packed input half no element holds. Ported from Marvisak/VIctory Marvisak#1067, Marvisak#953 and Marvisak#176. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
#1067 vs #1130 head-to-head, full archive, bare
AI-assisted (Claude); counts only, no game data. |
|
In-game Linux + Proton + NVIDIA RTX 5080 A/B verification combining
No regressions observed ( AI-assisted log analysis; built and run locally on my own retail copy, no game files or raw logs attached. |
Port of Marvisak#1067 (6d30fd7) onto the victory-gta6 base, after its lane-copied, sampler and view-address cases. An s_load_dword* of a descriptor whose dwords the code reads as numbers (an image's width and levels) but never samples was refused with "a descriptor read only as data": the view's kind came only from a use. Now the table's range names it, and an entry in the resource heap that no range names is an image if it is eight dwords, taken for 2D (shortcut noted in the code). Upstream measured over the whole corpus: "a descriptor read only as data" 395 -> 18. The two pixel shaders 7d0f14ce44746d7e and 6b6db9f1a526daeb that victory-gta6 JMAN730#26 still drops in the prison interior fail this way. (cherry picked from commit 6d30fd7) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…sak#704 + Marvisak#1511 Conflicts in crates/victory-shader/src/emit/lower.rs, resolved by hand: 1. descriptor_data: the bundle (Marvisak#953 s_buffer_load uses, Marvisak#1067 "read only as data" from the table's range) and Marvisak#180 (twin loads of the same dwords) both rewrote how the view's kind is found. Kept Marvisak#180's lookup (own uses, else a twin load's) and the bundle's handling of the use and of the unused case, plus the one case Marvisak#180 accepted that the bundle did not: an 8-dword load outside a table/heap range, taken as a 2D image (Marvisak#180's "image the program only measures"). Where both accepted a descriptor they built the same view. 2. phi joins: the bundle's arm (Marvisak#1073, a mask dword joined by ballot) and Marvisak#180's arm (a descriptor dword at a data join is undef) were inserted at the same place. Both kept, bundle first; the first needs a tracked lane mask, which a descriptor dword is not, so they do not overlap. 3. No textual conflict, did not compile: the bundle (Marvisak#306) gave `addr_val` a start position (`addr_val(l, start, k)`); Marvisak#180's compute image_sample_b arm read the bias with the old form at dword 0 through `as_float`. It now reads it as the bundle's sampleBias does: after the offset word when there is one, an f16 with a16 (`to_float`). This is the bias half of the Marvisak#160/Marvisak#180 interaction described in Marvisak#160 (comment) , which the bundle's offset forms already expose.
|
I rebased |
|
Automated triage for the maintainers. Closing because this change is already in Main takes a size-only descriptor's kind from a twin load (75677cb). What this adds beyond that is a guess: any eight-dword entry with no use is a 2D image. Main's notes rule that out (a 2D getDimensions on a view of another dimension is invalid in D3D12; the open case, PS_PuddleDetect, needs a size table from the host). 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. |
What changed
An
s_load_dword*of a descriptor whose dwords the code reads as numbers (an image's width and levels) but never samples was refused with "a descriptor read only as data", because the view's kind came only from a use point. Now:Known limit, marked
shortcut:in the code: an unnamed eight-dword heap entry is taken as a 2D image, so a cube, 3D or array texture reads sizes of the wrong rank.Measured
victory translateover the title's shader archive, taken on our integration branch (this commit on top of other fixes, not on bare main), so the deltas on main may be smaller:A hand-assembled waterfall program that reads two textures' sizes is the new test (
waterfall_tests.rs). It fails with the old refusal without the change, and passes on the host GPU and on WARP.Checks on current main (ffe310e)
cargo clippy --workspace --all-targets --locked -- -D warnings, with and without--all-features: cleancargo test -p victory-shader --locked: 121 passed, 0 failed, 1 ignoredNo game data is included, only counts. This work was AI-assisted.
🤖 Generated with Claude Code