Shaders: #612 stops 323 previously validated programs from translating #736
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#736
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?
@iurysf on GitHub · 2026-11-24 08:49 UTC · original
Since #612 was merged (
9a92ccf), 323 shader programs that emitted and validated on main no longer translate. Reverting only that merge on the current main (58fed37) restores exactly those programs.Measured offline with
victory translate --list --validateover the title'sshaders.rpf+ executable (26,096 programs), dxil.dll 1.9.2602.17, comparing outcomes program by program:c2e7254)58fed3758fed37with #612 revertedWith #612 reverted, 323 programs go from failed back to validated and 10 from failed to rejected, and nothing else moves. The refusals they now hit:
What seems to happen: following phi dependencies to a fixpoint marks many more phis as read. Their missing incoming values, which were zero-substituted before, now reach the emitter's other refusals. That goes well beyond the
s_memtimecase in #604. (I posted the same numbers on #699, which makes the same change.)Some of those zeroes may be wrong in the same silent way as the timestamp. Still, 323 working programs is a large in-game cost. Two ways out I can see:
AI-assisted.
@iurysf on GitHub · 2026-11-24 09:07 UTC · original
Independently reproduced on AMD by @slint6614-dev in #612 (RX 9070,
victory translate --validate --pipelines, main58fed37with and without the revert): the same 323 programs, 42 VS/PS, 253 compute (15% of emitted compute) and 28 mesh, and the same refusal shift, led by "a descriptor read only as data" (183 -> 388). Their reading matches ours: the transitive walk likely also marks phis that only carry descriptors or lane masks, which resource tracking and the mask pass resolve without a DXIL value. A scoped fix is in progress here. AI-assisted.@LAKSHYA-cmd-tech on GitHub · 2026-11-24 09:14 UTC · original
Analysis of the 323 program translation regression and fix:
Mechanism
In #612,
fill_phispropagatedread_phistransitively to all predecessor phis before the substitution decision. However, in retail shaders with wide joins across control flow (e.g. multi-register descriptors, structured buffer bounds, interpolation components), intermediate phis frequently join registers where one path carries a harmless non-data entity (such asVal::Missing("a descriptor read only as data")orVal::Missing("a structured buffer of unknown stride")).Prior to #612, because no instruction directly called
get(intermediate_phi), the unread join safely substituted zero and emitted clean, validated DXIL. Marking intermediate phis asread_phiscaused line 6746 (Some(Val::Missing(why)) if read_phis.contains(...) => return Err(Stop::Retry(...))) to abort emission for all 323 programs, even though no instruction in the program was actually reading that missing value as integer data.Solution
Distinguish direct readers (
direct_reads = self.read_phis.clone()) from transitive predecessors:is_direct), any incomingVal::Missing(why)triggersStop::Retry(phi.value, why).s_memtimetimestamps, i.e.why.contains("scalar memory") || why.contains("s_memtime")) still triggerStop::Retry(phi.value, why). This ensures #604 and thea_missing_value_stays_missing_through_two_live_joinstest remain 100% satisfied.falsefor bits), restoring the 323 programs without crashing emission.Verified:
a_missing_value_stays_missing_through_two_live_joinspasses, 89 passed incrates/victory-shader, clippy clean,cargo xtask policyok (153 files ok).Available on fork branch
fix/shader-phi-transitive-missing-values.@DrDarkDK on GitHub · 2026-11-24 09:42 UTC · original
Tested
53e39ccagainst its exact parent8e79c80on the Xbox v1.0.2.1 corpus usingvictory translate --list --validate --jobs 8and DXIL validator1.9.2602.17. Both runs scanned 26,096 programs and had the same 25,901 listed program keys.The patch restores 285 of the 323 validations recovered by the full #612 revert: 253 compute, 30 pixel, and 2 mesh. All 21,678 programs that validated on the parent still validate. The #604 test
a_missing_value_stays_missing_through_two_live_joinspasses on both commits.The remaining 38 programs (26 mesh, 12 pixel) all stop at
a scalar memory read as data. Of those, 26 already gave that diagnostic on the parent and 12 previously stopped ata lane mask read as data.Offline translation and DXIL validation only. AI-assisted test setup and analysis.
@iurysf on GitHub · 2026-11-24 10:08 UTC · original
Breakdown of the 323, and what brings them back correctly. Measured offline over the full corpus (25,902 programs),
victory translate --list --validate, comparing by program key against main58fed37and the same main with #612 reverted.s_getpc_b64, 1 cross-lane in mesh, 1 select on an untracked maskAI-assisted.
@sebastianspicker on GitHub · 2026-11-24 10:49 UTC · original
Not a fix for the 323, but something that would catch the simpler cases of this without the title: a corpus test in
emit/lower.rsthat lowers 48 named synthetic programs and fails with the names of those that stop translating. It covers SOP1/SOP2, the scalar bit tests, VOP1, VOP2 encoded as VOP3, the VOP3-only ops (including the cube ops), VOPC intov_cndmask, and integer add/sub with and without carry-out. It passes atffe310e.To be clear about its limit: it would not have caught #612. These programs are straight-line, and the refusals in the table above ("a descriptor read only as data", "a scalar memory read as data") come from values that meet at joins. If the 240-program family reduces to one or a few join shapes (a descriptor dword reaching a phi on one edge and being read as data on the other), I'd add one synthetic case per shape to the corpus, next to #604's
a_missing_value_stays_missing_through_two_live_joins. CI would then check them on every PR. Does it reduce to one shape, or several?AI-assisted.
@fuzeofficlal on GitHub · 2026-11-24 12:53 UTC · original
I ran a synthetic two-join control against
53e39ccand its exact parent8e79c80. The first join carries a structured-buffer descriptor word on one edge and the literal17on the other. The second branch repeats the same unchanged predicate. Flipping that second branch decides whether the descriptor word is overwritten or reaches the final LDS store.8e79c80refuses both variants witha descriptor's address or format read as data.53e39ccemits validator-clean DXIL for both. In the live variant, the first phi supplies0on the descriptor edge and the second phi carries it into the final store. A one-join control that reads the same word directly still refuses.Test-only commit checks the two-join case against the direct read. It passes on
ffe310eand fails when only the candidate'sfill_phischange is applied. This gives us a guard for any recovery that uses edge reachability. The repro covers compiler lowering and DXIL validation.@crashbashash on GitHub · 2026-11-24 16:40 UTC · original
A head-to-head of the fixes for the "a descriptor read only as data" part of this, now that #1067 is open too.
Setup: RX 6800 XT (RDNA2, RADV), GE-Proton11-14, everything merged onto
mainffe310e. Shaders: the 19,105 containers the title created in one run (menus, load, first mission's opening cutscene), dumped at pipeline creation. So this is the set the game actually uses, not the whole archive.victory translate --list --validate, withdxil.dllfrom DXC 1.9.2609, compared shader by shader againstmain.mainmain: 384)main: 91)after-180branch)lower.rs(both rewritedescriptor_data), so one has to rebase on the other.GPU check (per lane). A synthetic wave32 waterfall in the console's shape: one loop reloads each lane's image descriptor and reads width − 1 from its bits (
v_alignbit_b32), and a later loop samples it. Two 2D textures, 4 and 8 wide; even lanes use one, odd lanes the other. All three return[3, 7, 3, 7, …]on the RX 6800 XT, with DXIL validated. #180 and #1067 lower the size loop as a real loop (wave ops); #853 collapses it (no wave ops). The test only uses 2D textures, so it says nothing about #1067's "unnamed eight-dword entry is 2D" shortcut.So on this hardware and these shaders: #180 is the larger, clean gain. #853 on top changes how the loop is lowered, not what translates. #1067's 13 extra shaders could come along if it rebases on #180.
No game data attached. AI-assisted (Claude Code).
@reboot0000-cmd on GitHub · 2026-11-25 01:38 UTC · original
Confirming that
a7fc47af("Shaders: a phi edge is live only if a lane can take it to a read") closes this, measured independently here. Bisecting withtranslate --validate(DXC 1.8dxil.dll, so the stale-SDK-validator noise is out of the way) gave exactly one first-bad commit in404d7fd..ffe310e:3dd467c, PR #612, the 14-linefill_phischange. Built as a one-commit A/B against its parent25b0f88in a single tree:25b0f88(parent)3dd467c(#612)333 programs lost emission and none gained it (program pools identical, so this is pure emission change; @iurysf's 323 is the same effect measured three merges later). On current main those same 333 programs were re-checked one by one: 332 now emit and validate again; the single holdout is
barycentrics read directly, which is #442's subject. Compute emission on this archive is now 2,621 / 2,679, so #612's honest-refusal goal survived the narrowing rather than being reverted.One measurement that may save the next reader of this thread time, consistent with @LAKSHYA-cmd-tech's read of the code: during the #612 window the refusal reason reported was the joined value's reason (
Stop::Retry(phi.value, why)), so 253 of the 333 losses printeda descriptor read only as data/unknown stride/address or format read as datawhile only 32 printeda scalar memory read as data, the class #604 was written for. That 7.9:1 split is a reporting artefact, not evidence that descriptor handling caused the regression - worth remembering when these counts are reused in a census.(Zero refusals at any point carried
a join of mismatched valuesoran SCC joined with SGPR values, so the closure was never over-broad about constants: the 333 were values the old code silently zeroed - e.g.shaders.rpf@0xbf5be69refusing at0x2ad4,buffer_store_format_xyzw ... s[4:7]withs[4:7]reloaded as a descriptor at threes_load_dwordx4sites. Offline counts only, no title data, per the asset policy.)@Marvisak on GitHub · 2026-11-25 01:49 UTC · original
Automated triage for the maintainers.
The regression is fixed in
mainby commita7fc47a("Shaders: a phi edge is live only if a lane can take it to a read"). It reworksfill_phisincrates/victory-shader/src/emit/lower.rs, so a missing value now makes a phi live only when a lane can carry it along a branch to an actual read. #612's protection for thes_memtimecase (#604) is kept. reboot0000-cmd's bisect above found that 332 of the 333 programs #612 cost now emit and validate onmain. The one left is thebarycentrics read directlyrefusal, which is a separate subject (#442).One request for the thread: please keep disassembly of the title's shaders, even single instructions, out of the tracker. Program counts and refusal reasons are enough.
Proposed close: fixed in main by
a7fc47a. This issue will be closed in 48 hours unless the reporter replies or a maintainer removes thetriage: proposed closelabel.Generated by Claude Code