rdna2spirv: treat VOP3P v_dot2_f32_f16 clamp as hardware no-op (SHADER-DOT2-F32-F16-CLAMP) #410
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/410"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by tahffo68hk-hash on 2026-11-24T04:46:48Z.
Claimed in the coordination issue as:
SHADER-DOT2-F32-F16-CLAMPProblem
tools/rdna2spirv.pyappliedclamp_mods([0.0, 1.0]saturation) when VOP3Pv_dot2_f32_f16had theclampmodifier set. As noted indocs/design.md,v_dot2_f32_f16had not previously been hardware-measured on RDNA2.Measured natively on AMD RDNA2 (
gfx1036viatools/hw_oracle) across all fourieee/dx10_clamp/denorm32/denorm16_64MODE combinations: the VOP3Pclampbit onv_dot2_f32_f16is a hardware no-op:1.0*1.0 + 1.0*1.0 + 1.0withclamp->0x40400000(+3.0f), whereas the translator returned0x3f800000(1.0f).-1.0*1.0 + -1.0*1.0 + -1.0withclamp->0xc0400000(-3.0f), whereas the translator returned0x00000000(0.0f).+infwithclamp->0x7f800000;NaNwithclamp->0x7fc00000.Fix
clamp_modson VOP3Pv_dot2_f32_f16intools/rdna2spirv.py.tests/semantic/test_alu_dot_complete.pyto match the hardware-measured no-op behavior and add explicit+3.0f/-3.0f/+infregression assertions.docs/design.md.Verification
python -I tests/semantic/test_alu_dot_complete.py-> OK.spirv-val):tools/hw_oracle-> 4/4 dwords across+3.0f,-3.0f,+inf, andop_sel+neg_lo+clamp(verified across all 4 MODE combinations).vk_compute_test.exe:spirv-valPASS)--wave64-emulate): 4/4 exact dwords (spirv-valPASS)中文翻译
在协调帖 #14 中认领的 ID:
SHADER-DOT2-F32-F16-CLAMP问题描述
tools/rdna2spirv.py此前对带有clamp的 VOP3P 指令v_dot2_f32_f16施加了[0.0, 1.0]截断(docs/design.md注明此前尚未在 RDNA2 硬件实测)。经原生 AMD RDNA2(
gfx1036)在全部 4 种ieee/dx10_clamp/denormMODE 组合下实测确认:VOP3Pv_dot2_f32_f16的clamp位为硬件空操作(+3.0f保持0x40400000、-3.0f保持0xc0400000、+inf保持0x7f800000、NaN保持0x7fc00000)。修复方案
tools/rdna2spirv.py中对 VOP3Pv_dot2_f32_f16不再施加clamp_mods。tests/semantic/test_alu_dot_complete.py并新增+3.0f/-3.0f/+inf回归用例。docs/design.md契约表中记录硬件实测结果。验证结果
tests/semantic/test_alu_dot_complete.py全部通过。--wave64-emulate)4/4 精确一致,spirv-val全部通过。Imported from ubiquitarianism/leonida. Originally posted by Oliwettoo on 2026-11-24T10:36:34Z.
Code and test look right, and
test_alu_dot_complete.pypasses with the PR on currentmain. The measured words are only in the PR text, so nobody can reproduce them: please commit a reproducible gfx103x case (anint_hw_probe.pycase, or thetools/hw_oracle.asm plus its raw output), as the maintainer asked on #392/#398 (AGENTS.md: a new rule goes in with how it was confirmed). AI-assisted review.Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:45:27Z.
#410 | head
abb68a9ab2964fce5c39e652b66095df11a94b64|python3 -m unittest discover -s tests/semantic -p test_alu_dot_complete.py -v| red: 9 run, 5 failures | green: 9 passed | Red → greenOn main the packed dot-product clamp cases produced incorrect words. The merged translator passed the clamp and negation combinations.
Captured 81 distinct complete SPIR-V module(s) emitted while rerunning test_alu_dot_complete.py on the merged tree. All assembled and passed spirv-val for Vulkan 1.2 with --allow-offset-texture-operand.
Base
3bd936ecd98995bca3e1da83d5e28d2343001aefwas merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:51:31Z.
Merged, thank you @tahffo68hk-hash! This translator PR (rdna2spirv: treat VOP3P v_dot2_f32_f16 clamp as hardware no-op (SHADER-DOT2-F32-F16-CLAMP)) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.