Repository navigation
Conversation
7b4c021 to
d96f330
Compare
|
Rebased onto upstream/main (f847748) to resolve merge conflict in tests/semantic/test_interp_computed_ij.py (now d96f330). Kept all 3 new upstream tests alongside the 4 tests added here, and strengthened both forward-branched insn-0 tests (test_write_at_insn_zero_before_branch_is_computed and test_non_v0_write_at_insn_zero_before_branch_is_computed) to also execute via support.mrt0_words(...) and check the interpolated pixel output. Verified 22/22 in tests/semantic/test_interp_computed_ij.py, 235/235 in test_interp.py, and spirv-val --target-env vulkan1.2 on ps_ij_insn0_v0, ps_ij_insn0_v5, and ps_ij_loop_backedge. AI-assisted. |
|
In case it's useful for this PR: while #3309 (now closed in favour of this one) was open, we wrote two GPU fixtures for the |
|
Tested
Synthetic fixtures only, no game data. AI-assisted (Claude Code). |
|
Tested d96f330 on AMD Radeon RX 9070 XT (RADV GFX1201) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
Tested
AI-assisted (Claude Code). Synthetic test shaders only, no game files. |
|
Tested d96f330 on Steam Deck LCD (Jupiter), AMD Custom GPU 0405 "Van Gogh", RADV Mesa 26.2.0-devel (git-5c65d4fc31), Vulkan 1.4.350, SteamOS 3.9.5 (holo), kernel 7.2.7-valve2-2-neptune-72-g31504582a073: pass
No runtime C++ changes; GPU suite run from the PR worktree against the existing main runtime build. AI-assisted (OpenCode). |
|
Tested on Windows 11 with two GPUs on one machine (head merged with main f847748, MSVC 14.51, Python 3.13.1):
The vk_* programs came from a runtime built from main. |
|
Tested d96f330 on AMD Radeon RX 9070 (RDNA4, subgroup 32..64), AMD 26.10.1 (LLPC), Vulkan 1.4.359, Windows 11 26300, with @kapitche's two GPU fixtures from kap-interp-reaching (ec7f9c5) applied on main f847748: pass.
This matches @kapitche's RTX 4080 SUPER result on #3309, which was run against #3309's own fix (d7c0d4b). Here the fixtures run against this PR's head, on AMD. AI-assisted (Claude Code). |
|
Tested
AI-assisted (Claude Code). No game files. |
|
I checked a hand-written pixel shader that writes
The loop uses these instructions with the same four-byte fixture encoding as the PR tests. s_mov_b32 s0, 0
s_branch 0
v_interp_p1_f32_e32 v2, v0, attr0.x
v_interp_p2_f32_e32 v2, v1, attr0.x
v_mov_b32_e32 v0, 0
s_cmp_eq_u32 s0, 0
s_cbranch_scc0 2
s_mov_b32 s0, 1
s_branch -7
exp mrt0 v2, v2, v2, v2 done vm
s_endpgmThe interpolation suite also passed 235/235 tests on GPU follow-up: I ran the same loop through Synthetic inputs. AI-assisted. |
Claimed in coordination issue #3232 as
EGEN-INTERP-REACHING-WRITE(finding: #3232 (comment)).What and why
interp_ij_analysis::reaching_writeintools/rdna2spirv.pyhad two control-flow bugs when checking whether a VGPR write reaches av_interp_p1/v_interp_p2site from predecessor blocks or loops:0dropped (any(w for w in ws if blk[w] == p)): testing the truthiness of the matching instruction indexwreturnedFalsewhenever the only write in predecessor blockpwas instruction0(bool(0) == False).v0/v1at instruction0followed by a branch into the interpolation block was silently misclassified as pristine (emitting a plainOpLoadwith hardware barycentrics instead ofPerVertexKHRwith the computed value).0followed by a branch was falsely refused asUnsupportedinstead of being treated as a computed I/J pair.seen, work = {b}, [b]): seedingseen = {b}prevented revisiting blockbvia predecessors across a back-edge (b -> ... -> b), so a write at or after the interpolation site inbwas not seen as reaching subsequent iterations.Fix: Check
any(blk[w] == p for w in ws)for predecessor blockspreached fromseen = set(), work = [b](without re-queuingp == b, sincebwas already seeded).Tested
tests/semantic/test_interp_computed_ij.py):upstream/main16282101):test_write_at_insn_zero_before_branch_is_computed: FAIL (AssertionError: 'PerVertexKHR' not found)test_non_v0_write_at_insn_zero_before_branch_is_computed: ERROR (rdna2spirv.Unsupported: v_interp_p1_f32 I source v5: only v0 (or a plain v_mov copy of it) is modelled)test_loop_backedge_write_after_interp_in_same_block_is_computed: FAIL (AssertionError: 'PerVertexKHR' not found)test_straight_line_self_dest_write_stays_pristineand all 15 existing tests: PASS (Ran 19 tests in 0.217s,FAILED (failures=2, errors=1)).7b4c021d):Ran 19 tests in 0.195s,OK), emittingPerVertexKHR+OpFSub %floatinterpolation for all 3 branched/looped cases while keeping straight-line self-destination writes pristine.spirv-as+spirv-val --target-env vulkan1.2from SPIRV-Tools):ps_ij_insn0_v0: OK (PerVertexKHR=True)ps_ij_insn0_v5: OK (PerVertexKHR=True)ps_ij_loop_backedge: OK (PerVertexKHR=True)7b4c021d:python -m unittest discover -s tests/semantic -p "test_*interp*.py" -v: 181/181 OK (1.517s)python -m unittest discover -s tests/semantic -p "test_ps_semantics.py" -v: 7/7 OKpython -m unittest discover -s tests/semantic -p "test_value_semantics.py" -v: 33/33 OKpython -m unittest discover -s tests/semantic -p "test_fixtures.py" -v: 1/1 OKpython -I tests/test_ps_interp_modes.py: 26/26 OKpython -I tests/test_text_write_line_endings.py: 2/2 OKpython -m compileall -q make_game.py tools testsandgit diff --check: clean (exit 0)spirv-val; synthetic PS inputs only, no game data).Notes
b, any write to the I/J register inbreaches the start ofbon the next iteration (even a write at the interpolation site itself, if the block loops back to itself and overwrites its I/J VGPR with the partial sum); a straight-line self-destination write without a back-edge stays pristine, pinned bytest_straight_line_self_dest_write_stays_pristine.docs/design.mdis unchanged because this fixes the control-flow bug in the existingSHADER-177computed-I/J analysis rather than adding a new instruction rule.(Antigravity)
AI-assisted.