Shaders: a descriptor dword needed as another s_load's address stops translation (879 programs on 1.0.2.1) #798
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#798
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@HrHd on GitHub · 2026-11-24 11:08 UTC · original
A descriptor dword that the program also reads as a number is rebuilt from the host view's dimensions (
descriptor_data) and stops there (a scalar memory read as data). The largest sub-case is not a dimension read at all: the dword is consumed as the address operand of anothers_load_dword*, so what is needed is a memory address, and the descriptor-bit rebuild in that function has none for it.879 programs of 25,322 on build 1.0.2.1, the largest remaining emit class on the whole pack; for comparison the 64-bit image atomic class was 653 before #539. All 879 are this shape — bucketing them by the fields of the consuming instruction gives 879 "used by an SMEM" and no other kind.
Repro, no game and no GPU:
The class is listed with an example;
--listgives one line per program.Examples (build 1.0.2.1, all mesh/vertex in the mirror-reflection family):
shaders.rpf@0x1000c65 MSNC_VS_MirrorReflectionPedTransformSkinD_907647ea_Wrappedat0x5838(offset within the program is from the same run; take it as a pointer, the programs differ per build)shaders.rpf@0x1006b86 MS_VS_MirrorReflectionPedTransformDecalsD_db76baa6_Wrappedshaders.rpf@0x100897b MSNC_VS_MirrorReflectionPedTransformSkinDecalsD_907647ea_WrappedThe shape in
descriptor_data: the site is ans_load_dword*from a table or heap;used_kind/the descriptor'sRole::Resourceentry resolves a using instruction whoseFieldsareSmem, i.e. the register is the base (plus a constant) or the soffset of a further scalar load, usually afters_mov/s_addcopies.descriptor_datatakes theFields::ImageandFields::Buffercases and the rest fall to the catch-all refusal.Two ways this could go, and the reason I am filing rather than patching:
why_no_basethen reportsan address loaded from memory/an address in an SGPR that is no root parameter(268 programs between them today), so the two classes would trade rather than shrink;Per-build offsets and counts only, no assets. Written with AI assistance from my own runs.
@MartinIndra02 on GitHub · 2026-11-24 12:54 UTC · original
Found why
descriptor_datawas falling through toa scalar memory read as dataforFields::Smem:In
crates/victory-shader/src/emit/lower.rs,descriptor_datamatched onlyFields::ImageandFields::Bufferon the using instructionui, missingFields::Smemfors_buffer_load*(which is a buffer load using aV#descriptor, just likeFields::Buffer).Handling
Fields::Smem { .. } if un.starts_with("s_buffer_load")as a raw buffer ((11 | u, 0), still refusingResourceType::Cbv) resolves 100% ofa scalar memory read as dataand immediately unlocks +231 emitted shaders (the subset that readsV#dword 2num_records), while accurately routing the remaining subset that readsdword 0/1(base address / format) toa descriptor's address or format read as data:mainffe310e): https://github.com/MartinIndra02/VIctory/tree/fix/shader-smem-descriptor-data (commitc42cbb0)Full-corpus A/B (
victory translateon retail 1.0.2.1, 26,084 programs, release build)main(ffe310e)fix/shader-smem-descriptor-data(c42cbb0)12,231 / 14,02712,288 / 14,027+571,441 / 2,5821,449 / 2,582+88,214 / 8,7138,380 / 8,713+16621,88622,117+231a scalar memory read as data7710-771a descriptor's address or format read as data92589+497Verification (Windows 11, RTX 3080
621.24, Rust1.98.1)emit::lower::tests::s_buffer_load_descriptor_size_reads_as_data(checks bothResourceType::Srvlowering andResourceType::Cbvrefusal).cargo test -p victory-shader --lib -- --test-threads=1: 121 passed, 0 failed, 1 ignoredcargo clippy -p victory-shader --all-targets -- -D warnings(default +--features diagnostics): 0 warningscargo xtask policy: 154 files okReady to open as a PR whenever PRs reopen.
Aggregate counts only; no game data posted. AI-assisted; all builds and tests executed on my machine.
@fuzeofficlal on GitHub · 2026-11-24 13:12 UTC · original
I ran a raw SRV readback on
c42cbb0. The synthetic shader stores two dwords independently:s_buffer_load_dwordfrom byte offset 20 and dword 2 of the same input descriptor.With the same shader and the same payload at offset 20, the 32-byte view returned
[86, 32]and the 48-byte view returned[86, 48]. Both the native Windows hardware adapter and software WARP matched. Onffe310ethe same fixture stops in lowering witha scalar memory read as data.Test-only commit on the candidate adds the two-size readback to the existing shader test harness. This exercises the raw SRV path with stride zero.
@HrHd on GitHub · 2026-11-24 13:57 UTC · original
Independent confirmation of
c42cbb0at corpus scale, on a different machine and card (RTX 4060 Ti, 1.0.2.1), with the branch merged into a stack that already carries the waterfall series, #704, #539, #180 and #621.Offline translator over the whole pack (26,084 programs, no title, no GPU), before and after the arm:
s_load_dword*(the class this issue is about)So the split you predicted holds exactly: the
num_records(dword 2) subset all emit, and only one program in the corpus still falls through to the address/format refusal. TheCbvrefusal keeps the CBV-dword cases out of the raw-buffer path as intended — the unit test's second assertion exercises that and is the part worth keeping if the arm is ever narrowed.Two things from the merge that may matter to you:
Fields::Bufferarm and after whatever prefers image/vector-buffer uses over thes_bufferfallback. With #180 on top, the use-site lookup returns a preferred site and a fallback; thes_bufferarm only ever sees the fallback. Putting it first silently takess_bufferfor descriptors whose real use is a typed image.un.starts_with("s_buffer_load")(yours) is broader thans_buffer_load_dword(what I had); the_dwordx2/x4forms also route here and behave, so keep it broad.The remaining 195/73 address-in-SGPR classes are untouched by this and still need the address provenance work; this issue's fix does not reach them.
@Machad3x on GitHub · 2026-11-24 14:48 UTC · original
Offline measurement (fork github.com/Machad3x/VIctory branch claude/gta6-shader-translation-crashes-705550, tip 9018be9) over 78 console shader containers dumped from an RTX 3080 Ti world run (victory translate --list --validate): MESH programs emitted 0 of 21 on the branch without these changes; 4 of 21 after cherry-picking MartinIndra02's
c42cbb0(PR #953: a descriptor whose only use is s_buffer_load is a raw buffer; 'a scalar memory read as data' 25 -> 0); 19 of 21 (18 validated) after one more change: when the console reuses a dead descriptor's SGPRs for loaded data, a join of that descriptor's address/format dword with a data edge no longer refuses the program (the join reads undefined on that edge, like the lane-mask join already does; commit 9018be9, assumption: the value is only read on paths from the data edge). One of the newly emitted mesh programs (mesh f841ad74ec6e7367) fails DXIL validation: "Container part 'Program Output Signature' does not match expected for module". Remaining mesh failures: structured buffer of unknown stride (2), descriptor read from the first lane of computed VGPRs (4 by group count), descriptor partly joined by control flow (1). In the game (4-minute runs, wave64 mesh allowed by a diagnostics switch) the world still shows only the background plus the loading artwork; one run ended with a title fault writing to a reserved never-committed address.@rafaconvaitis on GitHub · 2026-11-24 17:28 UTC · original · edited 2026-11-24 17:37 UTC
I tried the descriptor-join change from @Machad3x's
9018be9on the two exact mesh-shader containers discussed in #293 and tested in #1269. The baseline is #1269 at8c3092fplus #953 atc42cbb0. I applied the descriptor-join change locally and kept the existing SCC arm when resolving their overlap infill_phis.ef5409053e14aa82235e56869c1ea883Windows 11 build 26300, RTX 4070 explicitly selected, NVIDIA driver
32.0.16.1664, Microsoft DXIL validator1.8.2502.8. Both PSOs use a generated pixel shader. No draw was submitted and the game was not started.This confirms the two containers clear translation and native pipeline creation in this stack. The incoming edge rewritten as undefined still needs a correctness check before using this change in gameplay. A useful control would exercise both sides of the join and establish which edge can reach the read.
AI-assisted test harness and report.
Correctness follow-up
I added two source-only controls using a synthetic descriptor load, a join with replacement scalar data, and an LDS store. On the unguarded control, the selector for the descriptor arm reaches the store. The
9018be9shortcut still emits a phi with anundefinput on that arm; the phi feeds the value written to LDS, and Microsoft DXIL 1.8 accepts the module. The baseline without the shortcut refuses that control. The guarded control routes the descriptor arm past the store.I also isolated the branch-threading portion of #48 on top of the same #1269 + #953 baseline, without the shortcut. On a synthetic variant with a constant flag, it proves the guarded edge and validates the emitted module, while the unguarded control remains refused. On the two real hash matches above, the pass found zero proven edges and both remained refused.
Using the dword classification from #1083 while keeping the #953 lowering, both real cases report a buffer descriptor's format or swizzle read as data (dword 3). This narrows the remaining work to that word. The runtime reachability of the descriptor edge in those two shaders is still unverified. No title or shader dispatch was run for these controls.
AI-assisted controls and analysis.
@rafaconvaitis on GitHub · 2026-11-24 18:15 UTC · original · edited 2026-11-24 18:37 UTC
Follow-up on the two mesh hashes from #293. I compared #1269
8c3092f+ #953c42cbb0with a local translator that follows the descriptor value through its SSA joins and accepts the Z selector bit only when all first reads mask out every other bit.0xa40bytes, then mask0x100. This is the high bit of GFX10DST_SEL_Z. The bit distinguishes a memory component from the supported constant selectors. This step translated235e56869c1ea883.ef5409053e14aa82then reaches dword 1 from the same root table at+0x300. Its first consumer at0x1b18masks0x00ff0000, the low byte of the stride field. The exact shader metadata declares stride 100 for that slot. Substituting only those masked bits from the declared stride in a separate offline probe let both exact programs pass the Microsoft DXIL validator. The stride bound by the title still needs to be observed. The raw SRV seen in the #984 discussion shows why the declaration alone is insufficient for a runtime change.victory translate --validate --list, the Z-bit change alone gained 8 mesh programs across 26,084 programs. Validated mesh programs went from 8,361 to 8,369 and total validated programs from 22,003 to 22,011. No previously validated program lost that status in the per-program comparison. The separate stride substitution was omitted from this corpus run.I also tested the binding problem behind a #193-style metadata table with a synthetic D3D12 compute readback, on the RTX 4070 and WARP. When slot 0 switched from memory Z to force-1 after closing the command list and before submission, rewriting the descriptor and its metadata together changed the readback from
(Z=7, bit=256)to(Z=1, bit=0). Changing the descriptor alone reproduced stale metadata(Z=1, bit=256). A neighboring slot stayed(Z=13, bit=256)in all runs. This was an isolated hardware test of synchronization before submission. It leaves runtime descriptor reconstruction and in-title rendering unverified.Update from exact-hash PSO creation. On the RTX 4070 the Z-bit-only experiment creates a mesh PSO for
235e56869c1ea883and still refusesef5409053e14aa82. With the separate stride substitution, both exact meshes create D3D12 PSOs on the RTX 4070 and WARP using a generated pixel stage. This test stops at PSO creation. The title's pixel partner, bound descriptors and mesh output remain unverified.Paired offline corpus update. Using one executable with the Z-bit experiment enabled, toggling the stride substitution raised validation from 22,011 to 22,085 of 26,084 programs. The 74 gains were mesh programs and zero previously validated programs lost their status. Another 45 programs reached an untracked lane-mask join and 4 vertex programs progressed to an output-signature validation failure. The stride-off control reproduced the earlier Z-bit-only outcomes for every program. This measures the compiler impact of the stride hypothesis. The actual guest descriptors at
+0x300and+0xa40still need to be observed during the title's draws.In-title update for
ef5409053e14aa82. On RTX 4070 and Series S, an observer on94e0ea5recorded the guest view before the host pipeline gate on its first indirect mesh draw in the prologue. Root table slot 0 at+0x300was a non-RAW structured buffer SRV with stride 100 and 3,000 elements. At+0xa40it was a non-RAW structured buffer SRV with stride 256 and 600 elements. Both had DXGI formatUNKNOWN, first element 0 and D3D12 component mapping 5768 (identity, so Z selects memory component 2). This confirms the stride against the actual bound guest view for this draw. The observer sees VIctory's logical D3D12 descriptor records. Native AMD descriptor bits and corrected mesh output still need validation. I have not caught235e56869c1ea883bound in this run so far.AI-assisted testing on the user's machine. No title files or shader containers are attached.
@Marvisak on GitHub · 2026-11-25 03:53 UTC · original
Automated triage for the maintainers.
Fixed in
main. Commit75677cb("Shaders: buffer sizes read from descriptors, and size-only waterfall loops", 2026-11-24) added aFields::Smemarm todescriptor_dataincrates/victory-shader/src/emit/lower.rs. A descriptor whose use is a scalar buffer load is now read as a raw or structured buffer, taking the stride from the used-resource entry, and constant buffers are still refused. That is the case the comments narrowed this class to (thes_buffer_load*users, dword 2). A load with no use goes toview_addresses. The remaining address/format and dword-3 cases discussed in the comments refuse with their own reasons, so they are different classes.@HrHd, if
victory translateon currentmainstill lists programs undera scalar memory read as datawith a scalar-load user, please reply with the counts.This issue will be closed in 48 hours unless the reporter replies or a maintainer removes the
triage: proposed closelabel.Generated by Claude Code