Repository navigation
Conversation
kacper-serewis
left a comment
There was a problem hiding this comment.
AI-assisted independent CPU review at f765e90 found four issues:
- Operand rewrite at tools/rdna2spirv.py:11574 uses low16 value equality. A shared literal 0x40000001 in SRC0/SRC2 with independent inline integer 1 in SRC1 overwrites that inline operand: expected export 0x40000000, observed 0x40000001. Select literal users by encoded source field 0xff.
- Prefix same_encoding at 11569 accepts stored SRC1 s0 versus printed inline zero when the literal high half was dropped. Parent rejects. Require exact equality of the eight instruction bytes for this repair.
- Re-anchoring at 11615 still rejects the intended repair. The shared-literal fixture exports 4.0 on the clean path and raises normalized-encoding Unsupported on the other path.
- Printed literal 0x12343c00 versus stored 0x40003c00 is accepted. Require the printed literal to be the zero-extended low half, and restrict to the supported mix opcodes.
Three local tests pass; four of five reused #2977 semantic tests pass, with re-anchoring failing. Even the wrong-value module passes Vulkan 1.2 spirv-val. Synthetic CPU only. Consolidate with existing #2977 (SHADER-507); it handles both paths, encoded literal users and zero-extension, but its prefix same_encoding also needs the live-source negative control.
|
Tested f765e90 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.
AI-assisted (OpenCode). |
|
Measured on gfx1036 (RDNA2, driver 26.10.1, game MODE: IEEE 0, DX10_CLAMP 1, f32 denormals flushed, f16/f64 kept):
So src0 (op_sel[0] = 0) reads the low half |
|
Tested f765e90 on NVIDIA GeForce RTX 4090 (Ada, subgroup 32..32), 621.14, Windows 11 (26200): pass, no change against Test programs: MSVC 19.44 RelWithDebInfo build of
On the branch:
Not run: the full |
|
Tested As it stands (
Re-applied on current
One limit worth stating: these two cards are 32-wide, so the Machine: Linux Mint 22 (Ubuntu 24.04 base), NVIDIA driver 615.71.09, Vulkan 1.4.351, |
|
This overlaps #2977 (SHADER-507), which came first: claimed at 18:10 UTC in #2716 and open since 19:00, before this claim (20:04 in #3232). It takes the same literal from the blob for the same instruction, and already covers points 1, 3 and 4 of the review above; point 2 (identical instruction bytes) is being added there now. Unless you have a case #2977 misses, could you close this one in favour of it? |
…bytes mix_literal compared the 8 instruction bytes with same_encoding, whose unused-SRC1/SRC2 allowance (stored 0, printed 0x80) would accept a live s0 source printed as inline 0 and then repair the literal. Every source of a three-source v_fma_mix* is live, so require the bytes to be identical. Tests: that case is refused (it is repaired without this change), and an inline constant whose value equals the printed literal keeps its value, since the literal's users are picked by the SRC field (0xff). Found by kacper-serewis's review of ItsNotRexed#3369.
f765e90 to
c680d44
Compare
|
Rebased onto main aa2988c; conflicts in tools/rdna2spirv.py and docs/design.md (main changed same_encoding to take the operand count, and added a v_fmamk/fmaak_f16 row), kept both and passed the operand count in our branch; tests: tests/semantic 7459 run (only the 10 failures that also fail on main), test_valu_fma_mix_literal 3 OK, test_docs_* and test_fma_mix_probe OK. |
|
Tested c680d44 (merged onto main aa2988c) on RTX 3060 (Ampere), driver 617.14, Windows 11, MSVC 14.44, RelWithDebInfo: pass
AI-assisted: this check was run and written with Claude Code (Anthropic) on my machine; the numbers above are its unedited output. |
|
Tested c680d44 merged onto main aa2988c on an RTX 5090 (driver 616.92), Windows 11, Vulkan SDK 1.4.363. The GPU test programs were built from the same tree:
AI-assisted (Claude Code). |
|
Combined data point for #3369 and #3372, from a scratch merge of both onto
Caveat: as @aslan2142 found on #3372, some programs fall through into dot4 words llvm-mc can't decode at all. Those translate but may lose stores until SHADER-813 lands, so 29/29 means 'translated and valid', not yet 'computes everything'. AI-assisted (Claude Code). |
kacper-serewis
left a comment
There was a problem hiding this comment.
SHADER-507 independent CPU comparison at c680d44 and the sibling proposal against shared parent aa2988c, all 29 cached inputs. Both proposals improved LLVM 22 from 21 to 22 valid and LLVM 23 from 26 to 27 valid. LLVM 21 remained 22 valid, but #2977 kept the residual shader’s two truncated literals while #3369 restored the full literals. Conversely, #3369’s low-half matching changed an unrelated inline constant in a synthetic control and did not accept the reanchored control. Source-field targeting, reanchoring and restoration on the LLVM 21 path need coverage together. No GPU semantics inferred. AI-assisted.
…r SRC fields encoded 0xff, with exact instruction bytes, a zero-extended printed literal, on the mix opcodes, and on the re-anchor path too
…es and paths take it
|
Thanks for the controls. I reproduced them on c680d44 and pushed 293ba66 (two commits on top). Measured on c680d44 (Python 3.12.16, Linux, synthetic blob and listing):
Changes: the dword goes only to sources whose encoded SRC field is 0xff; the eight instruction bytes must be equal, the literal's low half equal and the printed high half zero; only v_fma_mix_f32/mixlo_f16/mixhi_f16; the same match is used when re-anchoring. Tests: tests/semantic/test_valu_fma_mix_literal.py is 8 tests now. With tools/rdna2spirv.py put back to c680d44, the shared-literal control, the zero-extension control and the re-anchor control fail (2 failures, 1 error) and the other five pass; with the change all 8 pass. Also green: test_valu_fma_mix.py (15), test_printed_encoding.py (7), test_valu_fma*.py (128), test_semantic_translator_use.py, the 7 test_docs_*.py. On #2977: it covers the same ground; I have not measured it. Either one can go in, and this PR's tests are meant to be reusable against it. I did not run the 29 FSPX programs again. |
|
Tested I rendered the SPIR-V produced from four of the synthetic listing/blob pairs in
All four pixel shaders passed Vulkan 1.2 SPIR-V validation, and the eight focused semantic tests passed separately. AI-assisted verification. |
|
Closing as a duplicate of #2977, merged this round, which reads the v_fma_mix literal by its SRC field. This one was merged and then reverted on main: it widened every immediate whose value matched the literal's low half, so an inline constant printed the same way took the literal (test_fma_mix_literal). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… literal's low half #2977 (merged this round) reads the literal by the SRC field; #3369 replaced any operand whose value matched the literal's low half, so an inline constant printed as the same value took the literal (test_fma_mix_literal's inline-constant case). The two PRs fix the same thing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ion cases mix_literal compares the 8 instruction bytes with same_encoding counting all three sources as used, so since ItsNotRexed#2932 nothing is forgiven there and a live s0 can't pass as an inline 0. Say so in the docstring and pin it: - a stored SRC1 s0 against a printed inline 0 is refused (repaired if the sources are under-counted); - an inline constant whose value equals the printed literal keeps its value, since the literal's users are picked by the SRC field (0xff). Asked for by kacper-serewis's review of ItsNotRexed#3369.
|
Re-tested the new head
So on the state people will actually merge, this head is green here. Machine: Linux Mint 22 (Ubuntu 24.04 base), |
Claims: #3232 (comment)
What broke.
v_fma_mix_f32 v0, 0x3e00, 1.0, 0x3e00 op_sel:[0,0,1] op_sel_hi:[1,0,1]with the literal dword0xc1003e00: llvm-mc prints the literal as an f16 (low half) and re-encodes the high half as 0, socheck_printed_encodingsrefused it ("a field the disassembler dropped").op_sel[2]=1reads that high half (-2.5). Seen in 1 shader of my own 1.0.2.1 copy (counts only), 2 instructions.Fix. For
v_fma_mix*with a 12-byte encoding where only the literal's high half differs, take the literal dword from the code blob and use it for the printed literal operands. Any other difference is still refused. Row added to docs/design.md.Tested.
tests/semantic/test_valu_fma_mix_literal.py(synthetic, blob built in a temp dir): high half read gives -1.0, zero high half gives 1.5, a different low half is still refused. Linux (WSL2), Python 3.12.16: fulltests/semantic4145 tests OK (4 skipped);tests/test_rdna2spirv_decode.py,test_isa_coverage.py,test_docs_design_rows.py,test_rdna2spirv_cli.pyOK. The real program now translates and passes spirv-val (1 of 1).Negative control. Without the
tools/rdna2spirv.pychange the high-half test fails with the "field the disassembler dropped" Unsupported.AI-assisted.