Repository navigation
Conversation
|
Tested
|
|
Tested I translated the nine |
|
Tested
One question, not a blocker: Minor: I also ran the whole |
|
Follow-up to my check above: the same 5,889-test |
|
Tested aa85e83 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). |
lucasgillet2009-lab
left a comment
There was a problem hiding this comment.
The arithmetic passed independent CPU and GPU checks at aa85e83b1. I’m requesting one change before approval: please reject duplicate neg_lo or neg_hi fields in a textual listing before emitting SPIR-V.
Reproduction
With v1 = 0x04030201, v2 = 0x08070605, and v3 = 100, try each instruction separately:
v_dot4_i32_i8 v8, v1, v2, v3 neg_lo:[1,0,0] neg_lo:[0,1,0]
v_dot4_i32_i8 v8, v1, v2, v3 neg_hi:[1,0,0] neg_hi:[0,1,0]LLVM AMDGPU 23.1.6 rejects both lines for gfx1030. The translator on main (86a7807dd) also rejects them. On this PR, bits() takes the first matching field and silently ignores the second. The translated shaders return 0xfffffdaa and 0xfffffcaa, respectively. Running rdna2spirv.py end to end confirms the impact: both modules pass spirv-val and appear in index.json alongside the valid control.
Could you check that each mask field occurs at most once, validate its three binary entries before converting them, and raise Unsupported for malformed fields? I tried that change in a separate local checkout. A regression test checks the exception, and a CLI test checks that only the valid control appears in the index and has a generated .spv. Both tests passed with the proposed change, as did all 90 dot-product tests.
Validation
- The PR passed all 8 new tests and 90/90 dot-product tests. The original suite on
mainpassed 82/82. Applying the 8 new tests tomainreproduced the missing modifier support. - The CPU interpreter matched an independent integer reference for 1,408/1,408 output words.
- On an AMD Radeon RX 7600, all 8,192/8,192 GPU readbacks matched the reference: 64 masks × 64 operand triples × clamp off/on. This included 256 positive-overflow and 252 negative-overflow comparisons. All eight SPIR-V modules passed
spirv-val. These were Vulkan executions of the translated shaders on Windows 11 25H2, AMD driver 26.11.2 (LLPC), Vulkan 1.4.359.
Open RDNA2 question
What does native RDNA2 produce when op_sel_hi broadcasts the low half of S0 and neg_lo is set? One discriminating encoding is 08 40 16 cc 01 05 0e 34, with S0=0, S1=0x01000100, and S2=0. The PR produces −256 by flipping the sign bit before duplication. Flipping it only for the low pair after selection would give −128. The RX 7600 runs the translation on RDNA3, so it cannot settle which result native RDNA2 gives. This is an open measurement question; the duplicate-mask reproduction above is the reason for requesting changes.
Testing was assisted by Codex and used synthetic shaders and data throughout.
|
Tested aa85e83 (merged onto main 86a7807) on NVIDIA GeForce RTX 2060 (Turing), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 (10.0.26300), subgroup size 32: pass (no regression) What I ran:
No GPU test changed status against main. This PR adds no GPU fixture of its own, so the run checks that the translator change breaks none of the existing GPU tests; it does not exercise the new rule directly. Unit tests changed by the PR: The one failure on both sides is AI-assisted run (Claude Code); the numbers are from my machine. |
|
Tested aa85e83 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass, including a GPU readback Runtime built with GPU readback. I ran
On the base Two local changes were needed to run Suite. CPU. |
|
@lucasgillet2009-lab Thanks for the thorough CPU/GPU verification and catch! Addressed in
AI-assisted (Gemini 4 Neon). |
Support the measured RDNA2 VOP3P
neg_lo/neg_himodifiers onv_dot4_i32_i8intools/rdna2spirv.py.Claim: #7049 (comment)
Summary
tools/rdna2spirv.py: Lowerneg_lo/neg_hionv_dot4_i32_i8following the measured RDNA2 (gfx1036) hardware rule documented indocs/design.md("Signed-byte dot products") andtests/semantic/test_alu_dot4_i8.py:S0andS1:neg_lo[k]XORs bit 15 (0x00008000),neg_hi[k]XORs bit 31 (0x80000000).S2(addend):neg_hi[2]clears bit 31 (& 0x7FFFFFFF) andneg_lo[2]then flips bit 31 (^ 0x80000000), emitted as a singleOpBitwiseOrwith0x80000000when both are set.v_dot4c_i32_i8(VOP2) and malformedneg_lo/neg_hifields remain refused withUnsupported.tests/semantic/test_dot4_i8_neg.py: New semantic, binary-decode, andspirv-valtest suite covering:gfx1036cases (MEASURED_NEG)neg_lo[0..2] x neg_hi[0..2]sweep for positive and negative addends0x80,0x00,0x7F,0xFF) and edge addends (INT32_MIN,INT32_MAX,0,-1)clampsaturation combined withneg_lo/neg_hion S0/S1/S2v_dot4c_i32_i8neg modifiers and malformed masksllvm-mc -arch=amdgcn -mcpu=gfx1030 -show-encoding->rdna2_decoderound-tripspirv-as+spirv-val --target-env vulkan1.2validationtests/semantic/test_alu_dot4_i8.py&docs/design.md: Updated the existingneg_lo/neg_hirefusal test to verifyMEASURED_NEGagainst the translator output and updated the design doc row.Verification (Windows 11 + NVIDIA GeForce RTX 5090)
python -I -m unittest discover -s tests/semantic -p test_dot4_i8_neg.py -v(withLLVM_MC="wsl -d Ubuntu-24.04 -e /usr/lib/llvm-21/bin/llvm-mc"and Vulkan SDK1.4.363.0spirv-as/spirv-val): 8/8 passed (OK)python -I -m unittest discover -s tests/semantic -p "test_*dot*.py" -v: 90/90 passed (OK)python -I -m compileall -q tools tests: cleangit diff --check: cleanAI-assisted (Gemini 4 Neon).