Repository navigation
rdna2spirv: 16-bit vector compares read the low halves whatever op_sel says (TEST-650 follow-up) - #3487
Conversation
…(TEST-650)
tools/vcmp16_opsel_probe.py runs v_cmp_{lt,eq,gt}_{f16,u16,i16}_e64 through tools/hw_oracle as raw words: llvm-mc's
encodings with OPSEL hand-set in word 0 [12:11], since llvm-mc rejects op_sel on these compares. On a gfx1036
(Radeon iGPU, AMD 26.10.1) all 50 rows read the low halves whatever OPSEL says, wave32 and wave64, three identical
runs; 20 of them would answer differently if the selected halves were read (f16 with and without neg, u16,
sign-extended i16). A control sets the same bits on v_add_nc_u16_e64, where llvm-mc puts op_sel at those
positions, and the hardware does select the high halves there, so the encoding is right.
docs/design.md's "16-bit vector compare op_sel" row records the measurement; the translator still honours op_sel
there (test_vcmp16_opsel.py pins it), which only a hand-encoded word can reach. tests/test_vcmp16_opsel_probe.py
checks the words against llvm-mc's bytes and that every kind and op_sel bit has a row telling the two apart.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From @AwkGrep256's Linux run on ItsNotRexed#3329: runner.Oracle() is the Windows HIP launcher, so on Linux the tool exited 77; open_oracle() picks the platform's launcher, as the other *_probe.py tools do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l says (TEST-650 follow-up)
RDNA2 ignores VOP3 OPSEL on v_cmp(x)_*_{f16,u16,i16}_e64: on a gfx1036, through the Windows HIP launcher and
independently the Linux DRM one (ItsNotRexed#3329), all 50 raw-word rows read the low halves, wave32 and wave64, while the
same bits on v_add_nc_u16_e64 select the high halves. Gen.compare honoured op_sel (from the ISA text and ACO) since
2026-11-22; it now reads bits [15:0] of both sources and applies neg/abs or the zero/sign extension to those.
No listing can carry op_sel on these compares (llvm-mc rejects it and drops the bits), so this changes the output
only for a hand-encoded word.
tests/semantic/test_vcmp16_opsel.py keeps every listing and op_sel combination but expects the low-half answer
(neg/abs rows computed from the low halves, v_cmpx lanes from the low-half result); the translator that honoured
op_sel fails 111 of its checks. The docs/design.md row describes the rule and the measurement.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Code read at 0bfe15b. The
None of the 25,030 clean listings has such a word (that docstring's count). The 1,473 listings that #3402 would move onto the clean path haven't been through that check, so this would matter there first. No game files. AI-assisted (Claude Code). |
|
Tested Hardware. CPU.
AI-assisted. |
|
Tested
Synthetic fixtures only, no game data. AI-assisted (Claude Code). |
|
Tested 0bfe15b 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. |
|
Merged and then reverted on main (f99ff6c). With main's test_vcmp16_opsel.py, reading the low halves whatever op_sel says fails ConstantsAndLiteralsOpSelTests and SgprHighHalvesOpSelTests from #3231 (row 403). Those record native gfx1036 runs where inline constants, literals and SGPR high halves follow op_sel. TEST-650 measured VGPR sources. The two measurements disagree, and the design.md row now says so. Please reconcile them (for example, is OPSEL ignored only for VGPR sources?) and send it again with the tests agreeing. |
Follow-up of TEST-650, claimed in #3381: #3381 (comment)
Depends on: #3329 (the measurement and its tool; this branch is on top of it, so only the last commit is new here)
What and why
#3329 measured that RDNA2 ignores VOP3 OPSEL on
v_cmp(x)_*_{f16,u16,i16}_e64. That was done on a gfx1036, through the Windows HIP launcher and independently through @AwkGrep256's Linux DRM run, with row-identical words. Both runs read the low halves on all 50 rows, while the same bits onv_add_nc_u16_e64do select the high halves.Gen.comparehas honouredop_selsince 2026-11-22 (from the ISA text and ACO). This makes it follow the hardware.tools/rdna2spirv.py:Gen.comparenow reads bits[15:0]of both sources whateverop_selsays. It then appliesneg/abs(f16) or the zero/sign extension (u16/i16) to those.op_selon these compares: llvm-mc rejects it and drops the bits when disassembling, so the printed-encoding check would see such a word anyway.tests/semantic/test_vcmp16_opsel.py: it keeps every listing and everyop_selcombination, but expects the low-half answer.v_cmpxlanes come from each lane's low-half result. The old even-on/odd-off pattern was built for selected high halves.docs/design.md: the row states the rule and both measurements.Tested
Windows 11 Pro 26300, Python 3.12, CPU only.
python -m unittest discover -s tests/semantic -p test_vcmp16_opsel.py: 7 tests OK.Gen.compare(op_sel honoured), the same file fails 111 checks.python -m unittest discover -s tests/semantic: OK. This includestest_printed_encoding.py.test_docs_links,test_docs_repo_paths,test_docs_design_rows,test_docs_list_items: OK.tests/test_translate.pywas not run: it needs pytest, which this machine doesn't have.AI-assisted (Claude Code).
🤖 Generated with Claude Code