Skip to content

cs_w32_dot2_f16: words 4 and 5 are the unclamped hardware results (with #8652) - #1

Open
crastinator wants to merge 2 commits into
xelerb-debug:gpu-dot2-f16from
crastinator:dot2-7315-hw-words
Open

crastinator wants to merge 2 commits into
xelerb-debug:gpu-dot2-f16from
crastinator:dot2-7315-hw-words

Conversation

@crastinator

Copy link
Copy Markdown

For #7315 (ItsNotRexed/Leonida). This makes cs_w32_dot2_f16 agree with RDNA2 hardware and with ItsNotRexed/Leonida#8652.

Two commits on top of your head b59a90adf:

  1. 39c3b849: #8652's translator change (v_dot2_f32_f16 clamp is a no-op on the hardware; v_dot2c_f32_f16 clamp is refused), cherry-picked. Only design.md needed a merge with your row. If #8652 lands first, this commit drops out on a rebase.
  2. fca2f93a: out[4] / out[5] become the unclamped hardware words 0x41280000 (10.5) and 0xc1080000 (-8.5), in check.py, run_gpu_tests.py, the fixture header and your design.md sentence. The other six words don't change.

Why: on an RX 6700 XT (gfx1031), tools/hw_oracle returns 10.5 / -8.5 for those two instructions (details in #8652 and my earlier comment on #7315). matheusfermiano-source got the same words on a Radeon 660M (gfx1035) on #8652.

Tested on the RX 6700 XT (RADV Mesa 26.3.1, CachyOS, Linux 7.3.5):

  • run_gpu_tests.py --filter cs_w32_dot2_f16: PASS natively and with LEONIDA_W64_EMULATE=1, 1093140480 1096810496 3238526976 1095237632 1093140480 3238526976 1092354048 1052770308.
  • Full run_gpu_tests.py: 224/241, 16 skipped. The one failure is ms_wave_info_s3, which is intermittent on main (#6172).
  • test_dot2_f32_f16_clamp_hw and test_alu_dot_complete: OK. The pytest files for the GPU runner, test_shader_checks and test_rdna2_decode give the same failures as your head b59a90adf.

With this, #7315 depends on #8652 (or carries it). AI-assisted (Claude Code).

The clamp bit of v_dot2_f32_f16 is encoded, but an RX 6700 XT (gfx1031, tools/hw_oracle) ignores it: 10.5,
-8.5, 1.25, NaN and +-inf come back unclamped in wave32 and wave64 under every MODE tried, and 2,560 random and
special inputs per wave size give the same words with and without clamp, while v_fma_f32 clamp in the same
kernels clamps. The translator clamped the sum to [0, 1]; it now accepts clamp and leaves the result alone.

v_dot2c_f32_f16 has no clamp bit in VOP2 and no VOP3 form on gfx103x (llvm-mc rejects _e64 and calls the bytes
an invalid encoding), so a clamp on it is refused instead of guessed.

tests/semantic/test_dot2_f32_f16_clamp_hw.py pins 14 measured words and a hand-written fixture; both fail on the
old translator. design.md gets a contract row.
RDNA2 hardware ignores v_dot2_f32_f16's clamp bit (gfx1031, tools/hw_oracle), and with the translator fix the
fixture's clamp cases come out as 10.5 and -8.5, not 1.0 and 0. The expected words in check.py and
run_gpu_tests.py, the fixture's header and the design.md sentence now say so.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant