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). |
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.