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?
Imported from Marvisak/VIctory. Originally posted by bittertea0323 on 2026-11-25T09:25:19Z.
Upstream labels: bug, area: shader, triage: has patch
Three user-data and mask corrections take the corpus from 298 failures to 103
Baseline first, because it changes what is worth working on:
940d32fonmaintranslates 14205/14247 vertex and pixel, 2621/2679 compute, 8765/8765 mesh — 298 failing programs in total. We had been working a branch cut fromffe310e(319 commits behind), where 3,576 programs failed, and most of what we were fixing there had already been fixed here. If anyone else is still on an old base, rebase first; the numbers below are against940d32fonly.The three corrections below start from that base. They are on the class both trees still fail: 195 programs with
an address in an SGPR that is no root parameter, all of them geometry shaders.1. A geometry shader's user data starts at s0 when it runs standalone
HwStage::user_sgpradded 8 to every stage that can run merged. A standalone GS's user data starts at s0; with the +8, parameter lookup was shifted by eight dwords and nothing matched. SplittingGsout of the merged group took that class from 195 to 167.2. A table's high half is not checked
A table base is a 32-bit address whose high half is zero, and an offset added to it stays inside the 4 GiB, so requiring the address's high half to equal the parameter's second dword rejected addresses that were fine. (The parameter genuinely has only one SGPR — forcing
sgprs = 2for tables is wrong and explodes the corpus to 20,586 failures, which is worth knowing before anyone tries it.)3. Both placements are tried for a geometry shader
Nothing in a GS's metadata says whether it runs standalone or merged —
Ls/Hs/Gsare separate FSSM slots either way — and both shapes occur in this title.param_ofnow tries s0, then s8. That took the last 167 GS cases to 0.Result
940d32fan address in an SGPR that is no root parameterEmitted does not move, and the reason is worth stating:
translateonly lowersVs/Ps/Cs/Ms(apps/victory/src/translate.rs:534), so a geometry shader is resource-tracked and never emitted. The 195 were passing resource tracking, not reaching DXIL. Whether these GS programs actually compile is therefore unmeasured here — it needs a title run, nottranslate.4. A reused register read as data takes its mask argument
mask_numberrefused the program when any phi argument was not a tracked lane mask (the compiler reuses one register for a mask on one path and data on another). Following the mask argument instead takesa register joining a lane mask and datafrom 40 to 0 — but those programs move on toa lane mask read as data(8 → 41) anda lane-mask join of an untracked mask(6 → 13), so the total goes 98 → 103 with nothing emitted. Recorded because the semantic is right and because it says where the real gap is: lane-mask tracking does not cover every source (spill, carry, joins), which is the one class left with more than 40 programs.Not measured: whether the GS corrections change anything at runtime, and whether the mask classes collapse together once tracking covers spills — that is what we are testing next.
Branch:
try/upstream-baseon our fork, four commits on top of940d32f.Imported from Marvisak/VIctory. Originally posted by bittertea0323 on 2026-11-25T09:34:43Z.
Update: the last 41 are one class, and two obvious fixes for it are dead ends
After the four corrections above the corpus sits at 93 failing programs, and the largest remaining class is
a lane mask read as data(41). All 41 come from the same place:soprefuses any scalar instruction that writesEXECor writes a tracked lane mask (lower.rs:3324), because the value of such a write is not computed here —the structure pass owns lane masks.
We tried the two cheap repairs and measured both. Recording them so nobody else spends the time.
1. Skip the write entirely (
return Ok(())).Skipping leaves the written SSA value undefined, so a later join cannot type it.
2. Skip the computation but record the value as missing.
Either way the same 41 programs fail, so the write's value has to be computed, not elided: the structure pass
knows the per-lane bits of that mask, and the instruction needs the number they give. That is a structural change,
not another guard.
What we did keep from that line of work, because it does pay:
9bf94e1) tooka register joining a lane mask and data40 → 0 on its own.
mask_dwordand the phi join (1a1e1f2) tooka lane-mask join of an untracked mask13 → 0 and emitted 13 more compute programs (2621 → 2634) — the onlychange in this series that actually produces DXIL rather than moving a failure.
So the honest state of the corpus on
940d32fplus these five commits:a lane mask read as data(needs the write's value computed)a descriptor read only as datav_cvt_f32_f64barycentrics read directlya descriptor neither loaded nor builta descriptor chosen by control flow/v_permlanex16_b32If anyone has already made
sopcompute the value of a mask write, this is the place to say so — that one changeis worth 41 programs and we have no working path to it from here.
Imported from Marvisak/VIctory. Originally posted by bittertea0323 on 2026-11-25T09:35:26Z.
The five commits are pushed so they can be reviewed or cherry-picked without waiting on a PR:
https://github.com/bittertea0323/VIctory/tree/try/upstream-base — four commits on top of
940d32f:They touch
ative.rs (the SGPR mapping and a table's SGPR count) and lower.rs (the mask paths), which is
narrow enough to cherry-pick individually if only one of them is wanted. 1a1e1f2 is the one that emits more
programs; 35b26d and 5eaf119 are the ones that clear the address class.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:54:43Z.
Automated triage for the maintainers.
The geometry-shader placement is as described on
main(13f91ca):HwStage::user_sgprincrates/victory-shader/src/native.rsadds 8 forGsunconditionally. Two of the four changes are already in open PRs: #2284 (GS user data at s0 or s8, chosen per program) and #2546 (a table's address is not checked for a high half).No PR carries the two mask changes on the branch (9bf94e1, 1a1e1f2). New: a reviewer checked them against current
mainand found that neither can be ported as is.mainnow has tests that pin the shapes they change as refused, and both tests exist inmain:a_mask_joined_with_data_needs_a_uniform_joinincrates/victory-shader/src/emit/lower.rsa_compare_mask_joined_with_data_on_the_skip_edge_is_0_thereincrates/victory-shader/src/emit/synthetic_tests.rsThe suggested shape is to follow the mask argument only for joins off a cycle (9bf94e1), and to replace 1a1e1f2's every-lane default with an exact rule next to
no_mask_lane_on_edge. PRs are open to everyone. Please open one for those, with a synthetic test each that reaches an instruction with an effect, so they can be reviewed here.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-25T16:56:35Z.
Porting notes for the two mask commits, against current main (
67e8ae1) — a straight port is not shippable as-is, because main pinned the two shapes they change after the branch was cut:9bf94e1(a reused register read as data takes its mask argument). Applies cleanly, but it makesemit::lower::tests::a_mask_joined_with_data_needs_a_uniform_joinpass its first assertion — i.e. the per-lane loop shape that test pins as refused now translates. That refusal is exact: on a back edge the data argument is the mask itself transformed (s_lshronce an iteration), so lanes leaving at different iterations hold different numbers, and following the mask argument returns the pre-loop mask's number for all of them. Restricting the follow to phis off a cycle keeps the loop refusal and still covers the straight-line reuse (mask on one path, data on the other).1a1e1f2(an untracked mask reads as every-lane). Itsmask_dwordhalf applies cleanly; the pending-mask join half conflicts semantically with the arms main added in between (lane_bitfor uniform joins,no_mask_lane_on_edgefor provably-empty edges). Kept as a catch-all after those arms, it makesemit::synthetic_tests::a_compare_mask_joined_with_data_on_the_skip_edge_is_0_therefail its second half: the saved-EXEC variant — a mask holding lanes off its edge, joined with data — is exactly what the test pins as refused, because every-lane gives the skipping lanes bit 1 where the console gives 0. So the every-lane default for the join is not safe on current main.Where that leaves the two classes:
a register joining a lane mask and dataclass can be covered by the follow with the off-cycle guard; straight-line reuse (the shape the commit message describes) is unaffected by the guard.a lane-mask join of an untracked maskclass needs an exact rule for the untracked argument rather than a default:no_mask_lane_on_edgecovers the provably-empty case (0 there), and a constant argument would be exact as the lane's own bit of the constant — but anything the pass cannot prove has to stay refused, per the saved-EXEC test. Which of those the 13 programs actually are is a corpus question.One testing note for anyone continuing this: a read of the reused register through a side-effect-free instruction (
s_cmp+ branch) is not a discriminating regression test — the instruction's failure is swallowed and its result marked missing, so the program "translates" either way with different DXIL. The read has to reach an instruction with an effect (e.g. a buffer store) for main to refuse the program outright.AI-assisted (Kimi).
upstream-sync referenced this issue2026-11-25 21:03:09 +00:00