Repository navigation
feat(rdna2spirv): implement v_cvt_pknorm_i16_f16 and v_cvt_pknorm_u16_f16 - #3020
klarnet2009 wants to merge 2 commits into
Conversation
IAmNotSiob
left a comment
There was a problem hiding this comment.
heads up, this overlaps my #1976, which also adds v_cvt_pknorm_{i16,u16}_f16 (plus v_cvt_norm_*_f16). that PR also handles the op_sel dst bit (op_sel:[x,y,1] shifts the packed result left by 16, which Vonsek measured on gfx103x). so whichever lands second needs to drop its copy. i'm fine either way, yours has the nicer dedicated test file :)
on the code itself:
- ran
test_alu_cvt_pknorm_f16.py(6 ok) andtest_alu_cvt_pknorm_f32.py(ok) locally - rejecting
op_sel[2]=1is the safe choice here, just know it's measurable behaviour now, not unknown - small doc thing: for f16 inputs
x * 32767in f32 isn't always exact (11-bit mantissa × 15-bit scale = up to 26 bits), so the "one off near ties" caveat from the f32 row applies to the f16 ops too. the new row reads like it's only an f32 thing - nit: the test rolls its own STUB_DXBC + temp dir,
support.translate_linesdoes the same thing
AI-assisted (Claude Code).
TL;DR: code looks right and tests pass, but it duplicates part of #1976, so we need to pick one. small doc caveat about f16 rounding.
|
Verified the translated Vulkan output on an RTX 4070 Ti (621.24, Windows 11) at All eight generated fragment modules passed spirv-val. I rendered each through vk_harness built from this commit and checked the entire RGBA32F readback against a Python reference, with the two 16-bit results carried in separate channels to preserve the exact bits. 4,096/4,096 pixels matched in each draw, including lane placement, signed and unsigned half-way rounding, NaN to zero and positive infinity to the upper bound for these inputs. The parent translator at AI-assisted verification · GPT-6.2 Astra Medium |
|
Tested I also checked the rounding detail raised above. For signed packing, f16 input AI-assisted |
3a794d4 to
2e087a6
Compare
…1 on v_cvt_pknorm_*_f16
|
Thank you @IAmNotSiob for the review and the pointer to Updated
Re-verified (
|
|
Superseded by 39d57fe on main — closing to keep the PR queue clean. Thanks @IAmNotSiob, @TieruYT, and @KiryaAfimin for the reviews and testing! |
What and why
Implements
v_cvt_pknorm_i16_f16andv_cvt_pknorm_u16_f16intools/rdna2spirv.py:self.f16_in(src, sel)(widening f16 -> f32 and applying sourceabs/negmodifiers) with VOP3op_sel:[s0,s1,0], refusingclamp,_dpp/_sdwa, other modifiers, orop_sel[2] != 0withUnsupported.v_cvt_pknorm_*_f32(OpIsNan->%f0,FClampto[-1, 1]or[0, 1],OpFMulby32767.0/65535.0,RoundEven,OpConvertFToS/OpConvertFToU, pack{hi16, lo16}intoa[0]).docs/design.md(explicitly noting CPU-checked, not yet hardware-measured on RDNA2) and adds synthetic translator-to-interpreter tests intests/semantic/test_alu_cvt_pknorm_f16.py(6 tests).Claim: #2891 (comment)
Tested
spirv_mini_interp.py)py -3.12 -I -m compileall -q tools/rdna2spirv.py tests/semantic/test_alu_cvt_pknorm_f16.py: passed (exit 0)py -3.12 -I tests/semantic/test_alu_cvt_pknorm_f16.py -v: Ran 6 tests in 2.076s, OKpy -3.12 -I tests/semantic/test_alu_cvt_pknorm_f32.py -v: Ran 4 tests in 2.147s, OKpy -3.12 -I tests/test_isa_coverage.py -v: Ran 13 tests in 3.305s, OK (skipped=3 forLEONIDA_RDNA2_ISA_XML)py -3.12 -I tests/test_ctest_registration.py -v: Ran 4 tests in 0.050s, OKtools/rdna2spirv.pytoHEADand confirmedtest_alu_cvt_pknorm_f16.pyfailed (Unsupported, 337 errors), then restored and re-ran 6/6 passing.Checklist
python -Icompatible)