From 39c3b84925e90222ed55f3ef63e8ec6dd68762a6 Mon Sep 17 00:00:00 2001 From: crastinator Date: Mon, 23 Nov 2026 21:12:29 +0200 Subject: [PATCH 1/2] Translator: v_dot2_f32_f16 clamp is a no-op on RDNA2 hardware 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. --- docs/design.md | 3 +- .../semantic/fixtures/dot2_f32_f16_clamp.asm | 15 +++++ tests/semantic/test_alu_dot_complete.py | 35 ++++------ tests/semantic/test_dot2_f32_f16_clamp_hw.py | 66 +++++++++++++++++++ tools/rdna2spirv.py | 7 +- 5 files changed, 100 insertions(+), 26 deletions(-) create mode 100644 tests/semantic/fixtures/dot2_f32_f16_clamp.asm create mode 100644 tests/semantic/test_dot2_f32_f16_clamp_hw.py diff --git a/docs/design.md b/docs/design.md index c26526aca9..8b52767a66 100644 --- a/docs/design.md +++ b/docs/design.md @@ -306,7 +306,8 @@ How the generated SPIR-V expects the runtime to work: | Packed 16-bit integer ops (`v_pk_add/sub_u16/i16`, `v_pk_mul_lo_u16`, `v_pk_mad_u16/i16`, `v_pk_max/min_u16/i16`) | VOP3P: result half 0 takes each source's half from `op_sel[i]`, result half 1 from `op_sel_hi[i]` (defaults `[0,..]` and `[1,..]`), as for `v_pk_lshlrev_b16`. Each half is computed on its own and wraps to 16 bits. `clamp` (add, sub, mad) saturates the half to its type's range (the exact value fits in 32 bits), whereas on `v_pk_mul_lo_u16` and `v_pk_max/min_u16/i16` VOP3P `clamp` is a hardware no-op (`v_pk_mul_lo_u16 clamp` wraps modulo 2^16 rather than saturating to `0xFFFF`, and `max`/`min` results are unchanged; until 2026-11-23 `clamp` on those five ops raised `Unsupported`). `neg_lo`/`neg_hi` are float-only and unsupported modifiers (such as `mul:*`/`div:*`) raise `Unsupported`. `clamp` (add, sub, mad) saturates the half to its type's range; the exact value fits in 32 bits. `neg_lo`/`neg_hi` are float-only and raise `Unsupported`, as does `clamp` on the other ops. A constant operand is treated as a 32-bit dword `C`: `op_sel[i] == 0` selects bits `[15:0]`, `op_sel[i] == 1` selects bits `[31:16]`. Positive inline constants zero-extend (`5` → `0x00000005`), negative inline constants sign-extend (`-1` → `0xFFFFFFFF`, `-16` → `0xFFFFFFF0`), and 32-bit literals retain their full dword (`0x12345678`). Lowered via `OpBitField*Extract` at `16 * sl[i]` (the packed 16-bit *shifts* read their halves with a shift and a mask instead, like every other high-half reader: see the 16-bit high-half reads row). Lowered via `OpBitField*Extract` at `16 * sl[i]`. Until 2026-11-22 reading the high half of a constant raised `Unsupported`. A constant operand reads as its low 16 bits. Its high half under `op_sel`/`op_sel_hi` is **not measured** for integer ops (for f16 constants it reads +0.0, see the row above), so a constant whose high half would be read raises `Unsupported` instead of guessing; the compiler's usual form, `op_sel_hi:[1,0]` with the constant second, reads only the low half. Until 2026-11-22 all eleven ops raised `Unsupported`. CPU-checked by `tests/semantic/test_alu_pk_int16.py` (value grids, seeded `mad`, `op_sel`/`op_sel_hi` combinations, `clamp` including the unsigned `sub` floor, inline and literal constants, rejected forms) and `tests/semantic/test_pk_int16_clamp.py` (all 26 probe cases plain vs `clamp`, SPIR-V non-saturation assertion, inactive `EXEC` preservation, `spirv-val` Vulkan 1.2 validation, rejected modifiers), plus `tests/test_pk_int16_clamp_probe.py`. **Hardware-verified on RDNA2** (`gfx1035`, Windows 11, driver `26.5.1`, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pk_int16`, and independently on `gfx1036` desktop APU, Windows 11, driver `32.0.21045.29003`, across 380 raw compute kernels covering all 11 ops, constants under `op_sel`/`op_sel_hi`, `clamp`, and wave32/wave64 parity with 0 wave diffs and 0 mismatches, and via `tools/pk_int16_clamp_probe.py --hw-arch gfx1036` across 624 wave32 & wave64 evaluations with `mismatches=0, wave_diffs=0, target_clamp_diffs=0, control_clamp_diffs=34`, plus a 96-word wave32 Vulkan compute check under `VK_LAYER_KHRONOS_validation` passing with 0 mismatches on `AMD Radeon RX 9070 XT` driver `26.11.2` and `AMD Radeon(TM) Graphics` driver `26.11.2`): all eleven ops (wrap, `clamp` saturation on add/sub/mad, `clamp` no-op on `mul_lo`/`max`/`min`, and constant `op_sel`/`op_sel_hi`) match bit-for-bit. CPU-checked by `tests/semantic/test_alu_pk_int16.py` (value grids, seeded `mad`, `op_sel`/`op_sel_hi` combinations, `clamp` including the unsigned `sub` floor, inline and literal constants, rejected forms). **Hardware-verified on RDNA2** (`gfx1035`, Windows 11, driver `26.5.1`, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pk_int16`, and independently on `gfx1036` desktop APU, Windows 11, driver `32.0.21045.29003`, across 380 raw compute kernels covering all 11 ops, constants under `op_sel`/`op_sel_hi`, `clamp`, and wave32/wave64 parity with 0 wave diffs and 0 mismatches): all eleven ops (wrap, `clamp` saturation on add/sub/mad, and constant `op_sel`/`op_sel_hi`) match bit-for-bit. **Not GPU-verified.** **Hardware-verified on RDNA2** (`gfx1035`, Windows 11, driver `26.5.1`, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pk_int16`): all eleven ops (wrap, `clamp` saturation on add/sub/mad, and `op_sel`/`op_sel_hi`) match bit-for-bit. **`v_pk_mul_lo_u16` low 16 bits (found with `pk16_diff --oracle hw,vk`, GPU test `cs_pk_mul_lo_const`):** each half is `((x << 16) * y) >> 16`, not `(x * y) & 0xffff`: with a constant half of 0 in the other half of the result the AMD Windows driver (Radeon iGPU gfx1036, 26.10.1) dropped the mask (`0x1234 * 0xaaaa` gave `0x0c229e88`, hardware `0x00009e88`); the RTX 5080 was right either way. Words measured on the same gfx1036 in `runtime/test/shaders/cs_pk_mul_lo_const.asm`. | | `v_sin_f32`, `v_cos_f32`, `v_sin_f16`, `v_cos_f16` | The operand is an angle in turns (the ISA says valid over +-256; the measurement below finds no such limit on gfx1030). `turn_angle` reduces it in turns first, `x - RoundEven(x)` (exact in binary32, in [-0.5, 0.5]), then scales by `2*pi` and calls `Sin`/`Cos`, so the angle stays in [-pi, pi], the only range where GLSL guarantees them (2^-11 absolute). Scaling first rounded the fractional turn away (about 1.2e-4 rad near 255 turns, #594); the first fix (#1283) reduced with `Fract`, which rounds `1 - \| x \| ` for a negative x and lost `-2^-26` (it returned +0; absolute errors up to ~1.7e-7 at -0.1 turns), so the reduction is `RoundEven`-centred. `RoundEven` rather than `Round` so +-0.5 turn reduce symmetrically. inf and NaN still give NaN, and a zero operand is passed through unreduced so `sin(-0)` stays -0. CPU-checked by `tests/semantic/test_alu_sincos.py` against `sin`/`cos(2*pi*x)` in double (large angles, tiny arguments, whole turns of either sign, +-0, inf/NaN, modifiers, f16) and `tests/semantic/test_valu_sin_cos_turns.py` (#1283). GPU test `cs_w32_sincos` (large angles within 1e-3, since the driver `Sin` is only good to 2^-11) is a regression guard, not proof the old form failed on a given driver. Measured on an AMD Radeon RX 6800 (gfx1030, not the console's gfx1013) by @shelbykb2 (#616): whole and half turns of either sign give +0 (only `sin(-0)` is -0, so no sign needs copying onto a zero result, as here); there is no +-256 limit on that card (any finite x reduces exactly: `sin(300.25)` = 1, `sin(2^24)` = +0); the f16 forms reduce the same way as the f32 ones; +-inf gives a NaN and a NaN passes through, quieted with IEEE mode on. Re-measured natively on gfx1036 (RDNA2, SHADER-134) for f32 and f16 over every quarter turn from 0.25 to 2^24 of either sign and around +-256: the same rules. At an odd half turn `sin`, and at an odd quarter turn `cos`, is exactly +0 (either sign of x), where `Sin`/`Cos` of the rounded 2*pi give about -+8.7e-8 (f32) or a +-1-ulp f16 denormal; since 2026-11-22 the translator selects +0 there (`Gen.trig_exact_zero`), checked against 500 measured words by `tests/semantic/test_alu_sincos_turns_hw.py`. Known differences from this translation: for Known differences from this translation: at half turns `Sin` of the rounded pi gives about -+8.7e-8 where the hardware returns exactly 0, likewise `cos` at quarter turns; for \| x \| <= 2^-12 the hardware multiplies by `0x40c90fd5`, not the rounded 2*pi; the inf/NaN words are whatever the host driver returns. Not checked on gfx1013. | | `v_pack_b32_f16` source modifiers | A VOP3 `abs` or `neg` on an operand of this instruction acts on **the 16-bit half that operand contributes**, not on the whole 32-bit source, and only on that half: `abs` clears bit 15 and `neg` flips it, `abs` first, both as plain bit moves — the operand is not converted to a float. Until 2026-11-22 any such operand was rejected as `Unsupported`. **`neg` is measured** on gfx1036 (RDNA2 iGPU, AMD Windows driver 32.0.21044.64) with 192 raw kernels: `0x7c01` gives `0xfc01` under IEEE mode 0 and `0xfe01` under mode 1, in either half and with `op_sel`, so the sign move does not depend on the mode. **`neg`, `abs`, and `neg_abs` are hardware-verified on RDNA2** across both `gfx1035` (Windows 11, driver 26.5.1, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pack_b32_f16_abs` and raw `ieee=0` kernels) and `gfx1036` (Windows 11, driver 32.0.21045.29003, 1,088 raw kernels across wave32 and wave64, 0 mismatches): **`abs` and `- **`neg`, `abs`, and `- **`abs` rests on the ISA's definition of ABS on a float operand as the sign clear, applied before `neg`; no hardware run of this instruction with `abs` exists yet**, and `abs` on a NaN half is therefore unmeasured too. **Not modelled: IEEE mode 1 also quiets a signalling-NaN half** (`0x7c01` → `0x7e01`); which mode the game's shaders run in is SHADER-190, and under mode 0, where the bits move unchanged, the translation is exact. Checked by `tests/test_values.py`, `tests/semantic/test_vop3_const_mods.py`, `tests/semantic/test_pack_b32_f16_mods.py` (exact bits through the interpreter) and the GPU fixture `ps_f16_pack_mods` (words derived from the rule, not a readback); the gfx1036 measurement above is @Sanonymous01's, not repeated here. \| x src \| ` are hardware-verified on RDNA2** across both `gfx1035` (Windows 11, driver 26.5.1, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pack_b32_f16_abs` and raw `ieee=0` kernels) and `gfx1036` (Windows 11, driver 32.0.21045.29003, 1,088 raw kernels across wave32 and wave64): ` (neg+abs) are measured** on gfx1036 (RDNA2 iGPU, AMD Windows driver 32.0.21045.29003) with 1,088 raw kernels across wave32 and wave64 (0 mismatches): `abs` clears bit 15 (`& 0x7FFF`), `neg` flips it (`^ 0x8000`), and `neg_abs` sets bit 15 across all normal numbers, zeros, infinities, subnormals, quiet NaNs, and signaling NaNs, in either half and with `op_sel`. Under IEEE mode 0, signaling NaN payloads are preserved untouched (`0x7c01` gives `0xfc01` under `neg` and `0x7c01` under `abs`); under IEEE mode 1, a signaling-NaN half is quieted (bit 9 set: `0x7c01` gives `0xfe01` under `neg` and `0x7e01` under `abs`). ` are hardware-verified on RDNA2** (`gfx1035`, Windows 11, driver `26.5.1`, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pack_b32_f16_abs` and raw `ieee=0` kernels): On `gfx1035`, `abs` clears bit 15 and applies before `neg` on `-1.0`, `-0.0`, `-qNaN` (`0xfe05` → `0x7e05`), and `-sNaN` (`0xfc01` → `0x7c01` under `ieee=0`), with and without `op_sel`. **Not modelled: IEEE mode 1 also quiets a signalling-NaN half** (`0x7c01` → `0x7e01`); which mode the game's shaders run in is SHADER-190, and under mode 0, where the bits move unchanged, the translation is exact. Checked by `tests/test_values.py`, `tests/semantic/test_vop3_const_mods.py`, `tests/semantic/test_pack_b32_f16_mods.py` (exact bits through the interpreter) and the GPU fixture `ps_f16_pack_mods` (words derived from the rule, not a readback); the gfx1036 measurement above is @Sanonymous01's, not repeated here. | -| Packed integer dot products (`v_dot2_i32_i16`, `v_dot2_u32_u16`, `v_dot4_u32_u8`, `v_dot8_i32_i4`, `v_dot8_u32_u4`, plus VOP2 accumulating `v_dot2c_i32_i16`, `v_dot2c_u32_u16`, `v_dot4c_u32_u8`, `v_dot8c_i32_i4`, `v_dot8c_u32_u4`), `v_dot2_f32_f16` / `v_dot2c_f32_f16`, and `v_pk_fmac_f16` | RDNA2 ISA: `v_dot2_i32_i16`/`u16` (2×16-bit), `v_dot4_u32_u8` (4×8-bit unsigned), and `v_dot8_i32_i4`/`u4` (8×4-bit) — and their VOP2 accumulating `v_dot*c_*` forms (reading old `vdst` as `acc`) — extract each element with `OpBitFieldSExtract`/`OpBitFieldUExtract`, sum the elementwise products with `S2` (or old `vdst`) wrapping at 32 bits, and saturate to `[INT32_MIN, INT32_MAX]` / `[0, UINT32_MAX]` under `clamp` (signed carry tracking handles the `v_dot2_i32_i16` `(-32768)^2 + (-32768)^2 + acc` overflow/cancellation edge). For VOP3P `v_dot*_*`, the hardware default `op_sel:[0,0,0]` and `op_sel_hi:[1,1,1]` is accepted and any other `op_sel`/`op_sel_hi`, `neg_lo`/`neg_hi`, DPP/SDWA, or source `neg`/`abs` raises `Unsupported`; for VOP2 `v_dot*c_*`, only optional `clamp` and VGPR `vdst` are accepted. `v_dot2_f32_f16` (VOP3P) and `v_dot2c_f32_f16` (VOP2) compute `a0*b0 + a1*b1 + acc` in f32 (`f16_in` per half, `flush_f32` on `acc`, optional `clamp`, and for `v_dot2_f32_f16` `op_sel`/`op_sel_hi`/`neg_lo`/`neg_hi` on the inputs and `neg_lo[2]` on `acc`). All 6 new `v_dot*c_*` ops mark `vdst` as read-before-write in `read_before_write_vgprs` and `reg_reads_writes`. (`v_dot4_i32_i8` and `v_dot4c_i32_i8` are covered separately in the Signed-byte dot products row, #1754.) `v_pk_fmac_f16` (VOP2) unpacks `src0`, `vsrc1` and `vdst` as `f16x2` (`Gen.src_h`, so inline float constants apply in the low half with `+0.0` high), computes `fma(src0[k], vsrc1[k], vdst[k])` per half with single f16 rounding (`Gen.fma_f16_odd`, SHADER-55), and packs with `Gen.f16_pack2`; any modifier outside `_dpp` or non-VGPR `vdst` raises `Unsupported`, and `v_pk_fmac_f16` marks `vdst` as read before write in `read_before_write_vgprs` and `reg_reads_writes`. **Hardware-confirmed on RDNA2** for the 5 VOP3P integer forms and `v_pk_fmac_f16`: on `gfx1036` (Ryzen 9 7950X3D iGPU, `tools/hw_oracle`, @aslan2142), all 60 integer dot-product sets and all 22 `v_pk_fmac_f16` default-MODE words match; independently confirmed on `gfx1035` (Radeon 680M, @Youssefrah16) across 18 cases × wave32/wave64 (36/36 bit-exact), pinned by `tests/semantic/test_alu_dot_pk_fmac.py`. The 5 VOP2 `v_dot*c_*` integer forms and `v_dot2_f32_f16` / `v_dot2c_f32_f16` are CPU-checked by `tests/semantic/test_alu_dot_complete.py` and not yet hardware-measured on RDNA2. `v_dot2_f32_f16` / `v_dot2c_f32_f16` are GPU-checked by `runtime/test/shaders/cs_w32_dot2_f16.asm` (assembled for gfx1030 through its `; mcpu:` line): exact-in-f32 values through the default halves, `op_sel`/`op_sel_hi` (swapped and both high), `neg_lo`/`neg_hi` on the inputs and on `acc`, `clamp` above 1 and below 0, the old `D` as `v_dot2c`'s addend and a denormal half; passes on an RTX 4060 (NVIDIA 621.01), and the translator with `op_sel_hi`, a negation, the accumulator or `clamp` broken fails it. Non-default f16 MODEs (denormal flush, RTZ) are not modelled on `v_pk_fmac_f16` while the translator has no MODE input. | +| Packed integer dot products (`v_dot2_i32_i16`, `v_dot2_u32_u16`, `v_dot4_u32_u8`, `v_dot8_i32_i4`, `v_dot8_u32_u4`, plus VOP2 accumulating `v_dot2c_i32_i16`, `v_dot2c_u32_u16`, `v_dot4c_u32_u8`, `v_dot8c_i32_i4`, `v_dot8c_u32_u4`), `v_dot2_f32_f16` / `v_dot2c_f32_f16`, and `v_pk_fmac_f16` | RDNA2 ISA: `v_dot2_i32_i16`/`u16` (2×16-bit), `v_dot4_u32_u8` (4×8-bit unsigned), and `v_dot8_i32_i4`/`u4` (8×4-bit) — and their VOP2 accumulating `v_dot*c_*` forms (reading old `vdst` as `acc`) — extract each element with `OpBitFieldSExtract`/`OpBitFieldUExtract`, sum the elementwise products with `S2` (or old `vdst`) wrapping at 32 bits, and saturate to `[INT32_MIN, INT32_MAX]` / `[0, UINT32_MAX]` under `clamp` (signed carry tracking handles the `v_dot2_i32_i16` `(-32768)^2 + (-32768)^2 + acc` overflow/cancellation edge). For VOP3P `v_dot*_*`, the hardware default `op_sel:[0,0,0]` and `op_sel_hi:[1,1,1]` is accepted and any other `op_sel`/`op_sel_hi`, `neg_lo`/`neg_hi`, DPP/SDWA, or source `neg`/`abs` raises `Unsupported`; for VOP2 `v_dot*c_*`, only optional `clamp` and VGPR `vdst` are accepted. `v_dot2_f32_f16` (VOP3P) and `v_dot2c_f32_f16` (VOP2) compute `a0*b0 + a1*b1 + acc` in f32 (`f16_in` per half, `flush_f32` on `acc`, and for `v_dot2_f32_f16` `op_sel`/`op_sel_hi`/`neg_lo`/`neg_hi` on the inputs and `neg_lo[2]` on `acc`; its `clamp` is accepted and not applied, see the `v_dot2_f32_f16` `clamp` row; `v_dot2c_f32_f16` takes no modifier). All 6 new `v_dot*c_*` ops mark `vdst` as read-before-write in `read_before_write_vgprs` and `reg_reads_writes`. (`v_dot4_i32_i8` and `v_dot4c_i32_i8` are covered separately in the Signed-byte dot products row, #1754.) `v_pk_fmac_f16` (VOP2) unpacks `src0`, `vsrc1` and `vdst` as `f16x2` (`Gen.src_h`, so inline float constants apply in the low half with `+0.0` high), computes `fma(src0[k], vsrc1[k], vdst[k])` per half with single f16 rounding (`Gen.fma_f16_odd`, SHADER-55), and packs with `Gen.f16_pack2`; any modifier outside `_dpp` or non-VGPR `vdst` raises `Unsupported`, and `v_pk_fmac_f16` marks `vdst` as read before write in `read_before_write_vgprs` and `reg_reads_writes`. **Hardware-confirmed on RDNA2** for the 5 VOP3P integer forms and `v_pk_fmac_f16`: on `gfx1036` (Ryzen 9 7950X3D iGPU, `tools/hw_oracle`, @aslan2142), all 60 integer dot-product sets and all 22 `v_pk_fmac_f16` default-MODE words match; independently confirmed on `gfx1035` (Radeon 680M, @Youssefrah16) across 18 cases × wave32/wave64 (36/36 bit-exact), pinned by `tests/semantic/test_alu_dot_pk_fmac.py`. The 5 VOP2 `v_dot*c_*` integer forms and `v_dot2_f32_f16` / `v_dot2c_f32_f16` are CPU-checked by `tests/semantic/test_alu_dot_complete.py`; of these, only the `clamp` of `v_dot2_f32_f16` is hardware-measured on RDNA2 (next row). `v_dot2_f32_f16` / `v_dot2c_f32_f16` are GPU-checked by `runtime/test/shaders/cs_w32_dot2_f16.asm` (assembled for gfx1030 through its `; mcpu:` line): exact-in-f32 values through the default halves, `op_sel`/`op_sel_hi` (swapped and both high), `neg_lo`/`neg_hi` on the inputs and on `acc`, `clamp` above 1 and below 0, the old `D` as `v_dot2c`'s addend and a denormal half; passes on an RTX 4060 (NVIDIA 621.01), and the translator with `op_sel_hi`, a negation, the accumulator or `clamp` broken fails it. Non-default f16 MODEs (denormal flush, RTZ) are not modelled on `v_pk_fmac_f16` while the translator has no MODE input. | +| `v_dot2_f32_f16` `clamp` | The `clamp` bit of `v_dot2_f32_f16` is encoded (bit 15 of the VOP3P word, llvm-mc 23.1.5) but **the hardware ignores it**: the result is the unclamped f32 sum, NaN and infinities included. Measured on an AMD Radeon RX 6700 XT (gfx1031, Linux, amdgpu DRM backend of `tools/hw_oracle`) in wave32 and wave64, with MODE `0x3c0` and with DX10_CLAMP or IEEE off: 10.5, -8.5, 1.25, `2*65504^2`, NaN and +-inf come back unchanged, and over 2,560 random and special inputs per wave size (`neg_lo`/`neg_hi`/`op_sel` variants included) the words with and without `clamp` are identical, while `v_fma_f32`, `v_pk_fma_f16` and `v_dot2_i32_i16` with `clamp` in the same kernels clamp. **Until 2026-11-23 the translator clamped the result 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 `v_dot2c_f32_f16_e64` and calls its bytes an invalid encoding), so a `clamp` on it is refused as `Unsupported`. The console's gfx1013 has neither instruction (GFX10.1 / GFX10.3 opcode differences row), so desktop gfx103x is the only hardware that defines it. CPU-checked by `tests/semantic/test_dot2_f32_f16_clamp_hw.py` (14 measured words and the fixture `tests/semantic/fixtures/dot2_f32_f16_clamp.asm`) and `tests/semantic/test_alu_dot_complete.py`. **Not GPU-verified through Vulkan.** | | Packed integer dot products (`v_dot2_i32_i16`, `v_dot2_u32_u16`, `v_dot4_u32_u8`, `v_dot8_i32_i4`, `v_dot8_u32_u4`) and `v_pk_fmac_f16` | RDNA2 ISA: `v_dot2_i32_i16`/`u16` (2×16-bit), `v_dot4_u32_u8` (4×8-bit unsigned), and `v_dot8_i32_i4`/`u4` (8×4-bit) extract each element with `OpBitFieldSExtract`/`OpBitFieldUExtract`, sum the elementwise products with `S2` wrapping at 32 bits, and saturate to `[INT32_MIN, INT32_MAX]` / `[0, UINT32_MAX]` under VOP3P `clamp` (signed carry tracking handles the `v_dot2_i32_i16` `(-32768)^2 + (-32768)^2 + S2` overflow/cancellation edge). The hardware default `op_sel:[0,0,0]` and `op_sel_hi:[1,1,1]` (whether omitted or written explicitly) is accepted; any other `op_sel`/`op_sel_hi` (such as `op_sel_hi:[0,0,0]` or `[0,1,1]`, which select the low half for lane 1 on `v_dot2_*`), `neg_lo`/`neg_hi`, DPP/SDWA forms, and source `neg`/`abs` raise `Unsupported`. (`v_dot4_i32_i8` and `v_dot4c_i32_i8` are covered separately in the Signed-byte dot products row, #1754.) `v_pk_fmac_f16` (VOP2) unpacks `src0`, `vsrc1` and `vdst` as `f16x2` (`Gen.src_h`, so inline float constants apply in the low half with `+0.0` high), computes `fma(src0[k], vsrc1[k], vdst[k])` per half with single f16 rounding (`Gen.fma_f16_odd`, SHADER-55), and packs with `Gen.f16_pack2`; any modifier outside `_dpp` or non-VGPR `vdst` raises `Unsupported`, and `v_pk_fmac_f16` marks `vdst` as read before write in `read_before_write_vgprs` and `reg_reads_writes`. Until 2026-11-22 all six ops raised `Unsupported`. **Hardware-confirmed on RDNA2:** on `gfx1036` (Ryzen 9 7950X3D iGPU, `tools/hw_oracle`, @aslan2142), all 60 integer dot-product sets (plain, swapped/SGPR sources, and `clamp`) match bit-for-bit, all measured `op_sel`/`neg_*` variants are refused, and all 22 `v_pk_fmac_f16` default-MODE (`0x000003C0`: round-to-nearest-even, f16 denormals kept, IEEE and DX10_CLAMP on) words match in both source orders (all 34 non-NaN halves bit-exact; the 10 NaN halves yield quiet f16 NaN, as SPIR-V does not preserve NaN payload bits or sign); independently confirmed on `gfx1035` (Radeon 680M, `tools/hw_oracle`, @Youssefrah16) across 18 cases × wave32/wave64 (36/36 bit-exact). Pinned by `tests/semantic/test_alu_dot_pk_fmac.py` (all 82 `gfx1036` measured tables plus hand-written `.asm` fixture, boundary/clamp cases, default/non-default `op_sel`/`op_sel_hi`, `read_before_write_vgprs`/`reg_reads_writes`, DPP, seeded sweeps, and rejected forms). Non-default f16 MODEs (denormal flush, RTZ) are not modelled on `v_pk_fmac_f16` while the translator has no MODE input. | | `v_med3_f32` output modifiers | The translator applies `mul:2`, `mul:4` or `div:2` to the median before clamping to [0, 1], following [LLVM’s modifier order](https://llvm.org/docs/AMDGPUModifierSyntax.html#omod). The finite-input fixture `ps_med3_mods.asm` produced 4,096 exact pixels on an Apple M3 Max with MoltenVK and on Mesa llvmpipe (software Vulkan); it also passes (4,096/4,096) on an NVIDIA RTX 4050 Laptop and an AMD Radeon 740M (RADV), both Linux, and on an RTX 2060 SUPER per #634. This uses the existing float MODE assumptions described above. | | `v_div_fmas_f32`, `v_div_fmas_f64` | Scaled FMA for IEEE-754 division (VOP3): `D = fma(S0, S1, S2)` when `VCC[lane] == 0`; when `VCC[lane] == 1`, `D = (exp(S2) > bias ? 2^+S : 2^-S) * fma_exact(S0, S1, S2)` where `(bias, S)` is `(127, 64)` for f32 and `(1023, 128)` for f64 (`OpCapability Float64`, no `Int64`), i.e. `\|S2\| >= 2.0` scales up and `\|S2\| < 2.0` scales down. Scale-up uses `fma(S0, S1, S2) * 2^S` (any non-zero cancellation residual against `\|S2\| >= 2.0` stays well above normal minimum). Scale-down pre-scales `S0`/`S1` only when `\|S0*S1\|` can overflow (`\|S0\| >= 2^S` and `\|S1\| >= 1`, symmetric, or both `>= 2^(S/2)`), with a raw-bit sticky value `copysign(min_normal, S2)` whenever `0 < \|S2\| < 2^(Emin + S)` so half-ULP tie-breaking stays exact; otherwise it post-scales `fma(S0, S1, S2) * 2^-S`, with a TwoSum + product-error half-ULP tie adjustment in f64 when `\|fma\|` falls in `[2^-947, 2^-894)` so f64 subnormal outputs single-round. For f32 under the game MODE (`denorm32=0`), subnormal inputs and intermediate products are kept while subnormal outputs flush to signed zero before (and after) output modifiers; for f64 (`denorm16_64=3`), subnormals are kept throughout. VOP3 input (`abs`/`neg`) and output (`mul:2`/`mul:4`/`div:2`, then `clamp`) modifiers apply via `clamp_mods` / `clamp_mods_f64`. **Until 2026-11-22 the translator scaled unconditionally by `2^32` (f32) / `2^64` (f64) whenever `VCC[lane] == 1`, omitting the `exp(S2) > bias` branch and using half the hardware exponent shift.** **Hardware-verified on RDNA2** (`gfx1036`, AMD Radeon Graphics, Windows driver 32.0.21042.62, `tools/hw_oracle`, wave32 and wave64, game MODE `ieee=0`/`dx10_clamp=1`/`denorm32=0`/`denorm16_64=3`): 150/150 f32 and 153/153 f64 stress cases match bit-for-bit, including the `\|S2\| = 2.0` vs `nextbelow(2.0)` threshold, scale-down overflow prevention, sticky-bit tie-breaking, f32 output denormal flushing, and f64 subnormal single rounding. Checked bit-for-bit on the CPU (`spirv_mini_interp` for f32, SSA `%double` evaluator for f64) and assembled with `tools/spirv_asm.py` (plus `spirv-val` when present) by `tests/semantic/test_alu_div_fmas.py`; not run on the shader corpus. | diff --git a/tests/semantic/fixtures/dot2_f32_f16_clamp.asm b/tests/semantic/fixtures/dot2_f32_f16_clamp.asm new file mode 100644 index 0000000000..78fb06a43f --- /dev/null +++ b/tests/semantic/fixtures/dot2_f32_f16_clamp.asm @@ -0,0 +1,15 @@ +; v_dot2_f32_f16 with clamp: the hardware ignores the bit (gfx1031, tools/hw_oracle, wave32 and wave64). +; Expected MRT0 words: 41280000 c1080000 3fa00000 4fffc004 (10.5, -8.5, 1.25, 2 * 65504^2), all unclamped. + v_mov_b32 v1, 0x42004000 + v_mov_b32 v2, 0x38004400 + v_mov_b32 v3, 1.0 + v_dot2_f32_f16 v4, v1, v2, v3 clamp + v_dot2_f32_f16 v5, v1, v2, v3 neg_lo:[1,0,0] neg_hi:[0,1,0] clamp + v_mov_b32 v1, 0x38003400 + v_mov_b32 v2, 0x3c003c00 + v_mov_b32 v3, 0.5 + v_dot2_f32_f16 v6, v1, v2, v3 clamp + v_mov_b32 v1, 0x7bff7bff + v_dot2_f32_f16 v7, v1, v1, 0 clamp + exp mrt0 v4, v5, v6, v7 done vm + s_endpgm diff --git a/tests/semantic/test_alu_dot_complete.py b/tests/semantic/test_alu_dot_complete.py index 78a92daac9..33119c3016 100644 --- a/tests/semantic/test_alu_dot_complete.py +++ b/tests/semantic/test_alu_dot_complete.py @@ -2,8 +2,9 @@ Covers the 7 remaining RDNA2 dot-product instructions: - v_dot2c_i32_i16, v_dot2c_u32_u16, v_dot4c_u32_u8, v_dot8c_i32_i4, v_dot8c_u32_u4 (VOP2 accumulating) - - v_dot2_f32_f16 (VOP3P half-to-float dot product with op_sel, op_sel_hi, neg_lo, neg_hi, clamp) - - v_dot2c_f32_f16 (VOP2 accumulating half-to-float dot product with optional clamp) + - v_dot2_f32_f16 (VOP3P half-to-float dot product with op_sel, op_sel_hi, neg_lo, neg_hi; clamp is accepted + and, as on the hardware, has no effect) + - v_dot2c_f32_f16 (VOP2 accumulating half-to-float dot product, no modifiers) Standard library only; no GPU, no LLVM, no SPIRV-Tools, no game files. """ @@ -110,7 +111,6 @@ def ref_dot2_f32_f16( selhi=(1, 1, 1), nlo=(0, 0, 0), nhi=(0, 0, 0), - clamp: bool = False, ) -> int: a0 = bits_f16((s0 >> (16 * sel[0])) & 0xFFFF) a1 = bits_f16((s0 >> (16 * selhi[0])) & 0xFFFF) @@ -131,8 +131,6 @@ def ref_dot2_f32_f16( p1 = f32(a1 * b1) s = f32(p0 + p1) r = f32(s + acc) - if clamp: - r = max(0.0, min(1.0, r)) return f32_bits(r) @@ -236,18 +234,18 @@ def test_v_dot2_f32_f16_and_v_dot2c_f32_f16_values(self): self.assertEqual(got[0], want) self.assertEqual(got[3], want) - def test_v_dot2_f32_f16_opsel_neg_and_clamp(self): + def test_v_dot2_f32_f16_opsel_neg_and_ignored_clamp(self): s0 = pack_f16x2(1.5, -2.0) s1 = pack_f16x2(4.0, 0.5) acc = f32_bits(0.75) cases = [ - ("op_sel:[1,0,0] op_sel_hi:[0,1,1]", (1, 0, 0), (0, 1, 1), (0, 0, 0), (0, 0, 0), False), - ("neg_lo:[1,0,0] neg_hi:[0,1,0]", (0, 0, 0), (1, 1, 1), (1, 0, 0), (0, 1, 0), False), - ("neg_lo:[0,0,1]", (0, 0, 0), (1, 1, 1), (0, 0, 1), (0, 0, 0), False), - ("clamp", (0, 0, 0), (1, 1, 1), (0, 0, 0), (0, 0, 0), True), - ("neg_lo:[1,1,1] clamp", (0, 0, 0), (1, 1, 1), (1, 1, 1), (0, 0, 0), True), + ("op_sel:[1,0,0] op_sel_hi:[0,1,1]", (1, 0, 0), (0, 1, 1), (0, 0, 0), (0, 0, 0)), + ("neg_lo:[1,0,0] neg_hi:[0,1,0]", (0, 0, 0), (1, 1, 1), (1, 0, 0), (0, 1, 0)), + ("neg_lo:[0,0,1]", (0, 0, 0), (1, 1, 1), (0, 0, 1), (0, 0, 0)), + ("clamp", (0, 0, 0), (1, 1, 1), (0, 0, 0), (0, 0, 0)), + ("neg_lo:[1,1,1] clamp", (0, 0, 0), (1, 1, 1), (1, 1, 1), (0, 0, 0)), ] - for mods, sel, selhi, nlo, nhi, clamp in cases: + for mods, sel, selhi, nlo, nhi in cases: with self.subTest(mods=mods): got = run_ps([ f"v_mov_b32 v1, {s0:#x}", @@ -255,17 +253,7 @@ def test_v_dot2_f32_f16_opsel_neg_and_clamp(self): f"v_mov_b32 v3, {acc:#x}", f"v_dot2_f32_f16 v0, v1, v2, v3 {mods}", ])[0] - self.assertEqual(got, ref_dot2_f32_f16(s0, s1, acc, sel, selhi, nlo, nhi, clamp=clamp)) - - # v_dot2c_f32_f16 clamp - got_c = run_ps([ - f"v_mov_b32 v0, {f32_bits(0.5):#x}", - f"v_mov_b32 v1, {pack_f16x2(2.0, 1.0):#x}", - f"v_mov_b32 v2, {pack_f16x2(1.0, 1.0):#x}", - "v_mov_b32 v3, 0", - "v_dot2c_f32_f16_e64 v0, v1, v2 clamp", - ])[0] - self.assertEqual(got_c, f32_bits(1.0)) + self.assertEqual(got, ref_dot2_f32_f16(s0, s1, acc, sel, selhi, nlo, nhi)) def test_subnormals_inf_and_nan(self): # f16 subnormal input (2^-24) * 2.0 + 0.0 -> 2^-23 (exact normal f32, kept) @@ -336,6 +324,7 @@ def test_rejects_unsupported_forms(self): "v_dot2c_f32_f16 v0, v1, v2 neg_lo:[1,0,0]", "v_dot2c_f32_f16_sdwa v0, v1, v2 dst_sel:DWORD", "v_dot2c_f32_f16_e64 v0, |v1|, v2", + "v_dot2c_f32_f16_e64 v0, v1, v2 clamp", "v_dot2c_f32_f16 s0, v1, v2", ] for line in bad_lines: diff --git a/tests/semantic/test_dot2_f32_f16_clamp_hw.py b/tests/semantic/test_dot2_f32_f16_clamp_hw.py new file mode 100644 index 0000000000..75ae0807d7 --- /dev/null +++ b/tests/semantic/test_dot2_f32_f16_clamp_hw.py @@ -0,0 +1,66 @@ +"""v_dot2_f32_f16 `clamp` is a no-op on RDNA2: the translator gives the words measured on the hardware. + +Measured on an AMD Radeon RX 6700 XT (gfx1031, RADV / amdgpu DRM, `tools/hw_oracle`) in wave32 and wave64, which +agree word for word. Over 2,560 random and special inputs per wave size the words with and without `clamp` were +identical, while `v_fma_f32 ... clamp` in the same kernels clamped. The console's gfx1013 has no `v_dot2_f32_f16` +(docs/design.md, GFX10.1 / GFX10.3 opcode differences), so desktop gfx103x is the only hardware for it. +""" + +import math +from pathlib import Path +import struct +import unittest + +from support import HERE, mrt0_words, translate_listing, translate_lines + +# (S0, S1, S2, extra modifiers, measured v_dot2_f32_f16 ... clamp word) +HW_WORDS = [ + (0x42004000, 0x38004400, 0x3f800000, "", 0x41280000), + (0x42004000, 0x38004400, 0x3f800000, "neg_lo:[1,0,0] neg_hi:[0,1,0]", 0xc1080000), + (0x38003400, 0x3c003c00, 0x3f000000, "", 0x3fa00000), + (0x38003400, 0x3c003c00, 0x3e800000, "", 0x3f800000), + (0x38003400, 0x3c003c00, 0xbe800000, "", 0x3f000000), + (0x3c00bc00, 0x3c003c00, 0x00000000, "", 0x00000000), + (0xbc00bc00, 0x3c003c00, 0x00000000, "", 0xc0000000), + (0x7bff7bff, 0x7bff7bff, 0x00000000, "", 0x4fffc004), + (0x42004000, 0x38004400, 0x7fc00000, "", 0x7fc00000), + (0x42004000, 0x38004400, 0x7f800000, "", 0x7f800000), + (0x42004000, 0x38004400, 0xff800000, "", 0xff800000), + (0x7c003c00, 0x00003c00, 0x00000000, "", 0xffc00000), + (0x40003c00, 0x44004200, 0x3f800000, "op_sel:[1,0,0] op_sel_hi:[0,1,1]", 0x41300000), + (0x40003c00, 0x44004200, 0xc1a00000, "neg_lo:[0,0,1]", 0x41f80000), +] + + +def is_nan(word): + return math.isnan(struct.unpack(" Date: Mon, 23 Nov 2026 21:29:18 +0200 Subject: [PATCH 2/2] cs_w32_dot2_f16: words 4 and 5 are the unclamped hardware results 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. --- docs/design.md | 2 +- runtime/test/shaders/check.py | 2 +- runtime/test/shaders/cs_w32_dot2_f16.asm | 9 +++++---- scripts/run_gpu_tests.py | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/design.md b/docs/design.md index 8b52767a66..bd214c72a8 100644 --- a/docs/design.md +++ b/docs/design.md @@ -306,7 +306,7 @@ How the generated SPIR-V expects the runtime to work: | Packed 16-bit integer ops (`v_pk_add/sub_u16/i16`, `v_pk_mul_lo_u16`, `v_pk_mad_u16/i16`, `v_pk_max/min_u16/i16`) | VOP3P: result half 0 takes each source's half from `op_sel[i]`, result half 1 from `op_sel_hi[i]` (defaults `[0,..]` and `[1,..]`), as for `v_pk_lshlrev_b16`. Each half is computed on its own and wraps to 16 bits. `clamp` (add, sub, mad) saturates the half to its type's range (the exact value fits in 32 bits), whereas on `v_pk_mul_lo_u16` and `v_pk_max/min_u16/i16` VOP3P `clamp` is a hardware no-op (`v_pk_mul_lo_u16 clamp` wraps modulo 2^16 rather than saturating to `0xFFFF`, and `max`/`min` results are unchanged; until 2026-11-23 `clamp` on those five ops raised `Unsupported`). `neg_lo`/`neg_hi` are float-only and unsupported modifiers (such as `mul:*`/`div:*`) raise `Unsupported`. `clamp` (add, sub, mad) saturates the half to its type's range; the exact value fits in 32 bits. `neg_lo`/`neg_hi` are float-only and raise `Unsupported`, as does `clamp` on the other ops. A constant operand is treated as a 32-bit dword `C`: `op_sel[i] == 0` selects bits `[15:0]`, `op_sel[i] == 1` selects bits `[31:16]`. Positive inline constants zero-extend (`5` → `0x00000005`), negative inline constants sign-extend (`-1` → `0xFFFFFFFF`, `-16` → `0xFFFFFFF0`), and 32-bit literals retain their full dword (`0x12345678`). Lowered via `OpBitField*Extract` at `16 * sl[i]` (the packed 16-bit *shifts* read their halves with a shift and a mask instead, like every other high-half reader: see the 16-bit high-half reads row). Lowered via `OpBitField*Extract` at `16 * sl[i]`. Until 2026-11-22 reading the high half of a constant raised `Unsupported`. A constant operand reads as its low 16 bits. Its high half under `op_sel`/`op_sel_hi` is **not measured** for integer ops (for f16 constants it reads +0.0, see the row above), so a constant whose high half would be read raises `Unsupported` instead of guessing; the compiler's usual form, `op_sel_hi:[1,0]` with the constant second, reads only the low half. Until 2026-11-22 all eleven ops raised `Unsupported`. CPU-checked by `tests/semantic/test_alu_pk_int16.py` (value grids, seeded `mad`, `op_sel`/`op_sel_hi` combinations, `clamp` including the unsigned `sub` floor, inline and literal constants, rejected forms) and `tests/semantic/test_pk_int16_clamp.py` (all 26 probe cases plain vs `clamp`, SPIR-V non-saturation assertion, inactive `EXEC` preservation, `spirv-val` Vulkan 1.2 validation, rejected modifiers), plus `tests/test_pk_int16_clamp_probe.py`. **Hardware-verified on RDNA2** (`gfx1035`, Windows 11, driver `26.5.1`, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pk_int16`, and independently on `gfx1036` desktop APU, Windows 11, driver `32.0.21045.29003`, across 380 raw compute kernels covering all 11 ops, constants under `op_sel`/`op_sel_hi`, `clamp`, and wave32/wave64 parity with 0 wave diffs and 0 mismatches, and via `tools/pk_int16_clamp_probe.py --hw-arch gfx1036` across 624 wave32 & wave64 evaluations with `mismatches=0, wave_diffs=0, target_clamp_diffs=0, control_clamp_diffs=34`, plus a 96-word wave32 Vulkan compute check under `VK_LAYER_KHRONOS_validation` passing with 0 mismatches on `AMD Radeon RX 9070 XT` driver `26.11.2` and `AMD Radeon(TM) Graphics` driver `26.11.2`): all eleven ops (wrap, `clamp` saturation on add/sub/mad, `clamp` no-op on `mul_lo`/`max`/`min`, and constant `op_sel`/`op_sel_hi`) match bit-for-bit. CPU-checked by `tests/semantic/test_alu_pk_int16.py` (value grids, seeded `mad`, `op_sel`/`op_sel_hi` combinations, `clamp` including the unsigned `sub` floor, inline and literal constants, rejected forms). **Hardware-verified on RDNA2** (`gfx1035`, Windows 11, driver `26.5.1`, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pk_int16`, and independently on `gfx1036` desktop APU, Windows 11, driver `32.0.21045.29003`, across 380 raw compute kernels covering all 11 ops, constants under `op_sel`/`op_sel_hi`, `clamp`, and wave32/wave64 parity with 0 wave diffs and 0 mismatches): all eleven ops (wrap, `clamp` saturation on add/sub/mad, and constant `op_sel`/`op_sel_hi`) match bit-for-bit. **Not GPU-verified.** **Hardware-verified on RDNA2** (`gfx1035`, Windows 11, driver `26.5.1`, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pk_int16`): all eleven ops (wrap, `clamp` saturation on add/sub/mad, and `op_sel`/`op_sel_hi`) match bit-for-bit. **`v_pk_mul_lo_u16` low 16 bits (found with `pk16_diff --oracle hw,vk`, GPU test `cs_pk_mul_lo_const`):** each half is `((x << 16) * y) >> 16`, not `(x * y) & 0xffff`: with a constant half of 0 in the other half of the result the AMD Windows driver (Radeon iGPU gfx1036, 26.10.1) dropped the mask (`0x1234 * 0xaaaa` gave `0x0c229e88`, hardware `0x00009e88`); the RTX 5080 was right either way. Words measured on the same gfx1036 in `runtime/test/shaders/cs_pk_mul_lo_const.asm`. | | `v_sin_f32`, `v_cos_f32`, `v_sin_f16`, `v_cos_f16` | The operand is an angle in turns (the ISA says valid over +-256; the measurement below finds no such limit on gfx1030). `turn_angle` reduces it in turns first, `x - RoundEven(x)` (exact in binary32, in [-0.5, 0.5]), then scales by `2*pi` and calls `Sin`/`Cos`, so the angle stays in [-pi, pi], the only range where GLSL guarantees them (2^-11 absolute). Scaling first rounded the fractional turn away (about 1.2e-4 rad near 255 turns, #594); the first fix (#1283) reduced with `Fract`, which rounds `1 - \| x \| ` for a negative x and lost `-2^-26` (it returned +0; absolute errors up to ~1.7e-7 at -0.1 turns), so the reduction is `RoundEven`-centred. `RoundEven` rather than `Round` so +-0.5 turn reduce symmetrically. inf and NaN still give NaN, and a zero operand is passed through unreduced so `sin(-0)` stays -0. CPU-checked by `tests/semantic/test_alu_sincos.py` against `sin`/`cos(2*pi*x)` in double (large angles, tiny arguments, whole turns of either sign, +-0, inf/NaN, modifiers, f16) and `tests/semantic/test_valu_sin_cos_turns.py` (#1283). GPU test `cs_w32_sincos` (large angles within 1e-3, since the driver `Sin` is only good to 2^-11) is a regression guard, not proof the old form failed on a given driver. Measured on an AMD Radeon RX 6800 (gfx1030, not the console's gfx1013) by @shelbykb2 (#616): whole and half turns of either sign give +0 (only `sin(-0)` is -0, so no sign needs copying onto a zero result, as here); there is no +-256 limit on that card (any finite x reduces exactly: `sin(300.25)` = 1, `sin(2^24)` = +0); the f16 forms reduce the same way as the f32 ones; +-inf gives a NaN and a NaN passes through, quieted with IEEE mode on. Re-measured natively on gfx1036 (RDNA2, SHADER-134) for f32 and f16 over every quarter turn from 0.25 to 2^24 of either sign and around +-256: the same rules. At an odd half turn `sin`, and at an odd quarter turn `cos`, is exactly +0 (either sign of x), where `Sin`/`Cos` of the rounded 2*pi give about -+8.7e-8 (f32) or a +-1-ulp f16 denormal; since 2026-11-22 the translator selects +0 there (`Gen.trig_exact_zero`), checked against 500 measured words by `tests/semantic/test_alu_sincos_turns_hw.py`. Known differences from this translation: for Known differences from this translation: at half turns `Sin` of the rounded pi gives about -+8.7e-8 where the hardware returns exactly 0, likewise `cos` at quarter turns; for \| x \| <= 2^-12 the hardware multiplies by `0x40c90fd5`, not the rounded 2*pi; the inf/NaN words are whatever the host driver returns. Not checked on gfx1013. | | `v_pack_b32_f16` source modifiers | A VOP3 `abs` or `neg` on an operand of this instruction acts on **the 16-bit half that operand contributes**, not on the whole 32-bit source, and only on that half: `abs` clears bit 15 and `neg` flips it, `abs` first, both as plain bit moves — the operand is not converted to a float. Until 2026-11-22 any such operand was rejected as `Unsupported`. **`neg` is measured** on gfx1036 (RDNA2 iGPU, AMD Windows driver 32.0.21044.64) with 192 raw kernels: `0x7c01` gives `0xfc01` under IEEE mode 0 and `0xfe01` under mode 1, in either half and with `op_sel`, so the sign move does not depend on the mode. **`neg`, `abs`, and `neg_abs` are hardware-verified on RDNA2** across both `gfx1035` (Windows 11, driver 26.5.1, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pack_b32_f16_abs` and raw `ieee=0` kernels) and `gfx1036` (Windows 11, driver 32.0.21045.29003, 1,088 raw kernels across wave32 and wave64, 0 mismatches): **`abs` and `- **`neg`, `abs`, and `- **`abs` rests on the ISA's definition of ABS on a float operand as the sign clear, applied before `neg`; no hardware run of this instruction with `abs` exists yet**, and `abs` on a NaN half is therefore unmeasured too. **Not modelled: IEEE mode 1 also quiets a signalling-NaN half** (`0x7c01` → `0x7e01`); which mode the game's shaders run in is SHADER-190, and under mode 0, where the bits move unchanged, the translation is exact. Checked by `tests/test_values.py`, `tests/semantic/test_vop3_const_mods.py`, `tests/semantic/test_pack_b32_f16_mods.py` (exact bits through the interpreter) and the GPU fixture `ps_f16_pack_mods` (words derived from the rule, not a readback); the gfx1036 measurement above is @Sanonymous01's, not repeated here. \| x src \| ` are hardware-verified on RDNA2** across both `gfx1035` (Windows 11, driver 26.5.1, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pack_b32_f16_abs` and raw `ieee=0` kernels) and `gfx1036` (Windows 11, driver 32.0.21045.29003, 1,088 raw kernels across wave32 and wave64): ` (neg+abs) are measured** on gfx1036 (RDNA2 iGPU, AMD Windows driver 32.0.21045.29003) with 1,088 raw kernels across wave32 and wave64 (0 mismatches): `abs` clears bit 15 (`& 0x7FFF`), `neg` flips it (`^ 0x8000`), and `neg_abs` sets bit 15 across all normal numbers, zeros, infinities, subnormals, quiet NaNs, and signaling NaNs, in either half and with `op_sel`. Under IEEE mode 0, signaling NaN payloads are preserved untouched (`0x7c01` gives `0xfc01` under `neg` and `0x7c01` under `abs`); under IEEE mode 1, a signaling-NaN half is quieted (bit 9 set: `0x7c01` gives `0xfe01` under `neg` and `0x7e01` under `abs`). ` are hardware-verified on RDNA2** (`gfx1035`, Windows 11, driver `26.5.1`, wave32 & wave64 via `tools/int_hw_probe.py --oracle both --group valu_pack_b32_f16_abs` and raw `ieee=0` kernels): On `gfx1035`, `abs` clears bit 15 and applies before `neg` on `-1.0`, `-0.0`, `-qNaN` (`0xfe05` → `0x7e05`), and `-sNaN` (`0xfc01` → `0x7c01` under `ieee=0`), with and without `op_sel`. **Not modelled: IEEE mode 1 also quiets a signalling-NaN half** (`0x7c01` → `0x7e01`); which mode the game's shaders run in is SHADER-190, and under mode 0, where the bits move unchanged, the translation is exact. Checked by `tests/test_values.py`, `tests/semantic/test_vop3_const_mods.py`, `tests/semantic/test_pack_b32_f16_mods.py` (exact bits through the interpreter) and the GPU fixture `ps_f16_pack_mods` (words derived from the rule, not a readback); the gfx1036 measurement above is @Sanonymous01's, not repeated here. | -| Packed integer dot products (`v_dot2_i32_i16`, `v_dot2_u32_u16`, `v_dot4_u32_u8`, `v_dot8_i32_i4`, `v_dot8_u32_u4`, plus VOP2 accumulating `v_dot2c_i32_i16`, `v_dot2c_u32_u16`, `v_dot4c_u32_u8`, `v_dot8c_i32_i4`, `v_dot8c_u32_u4`), `v_dot2_f32_f16` / `v_dot2c_f32_f16`, and `v_pk_fmac_f16` | RDNA2 ISA: `v_dot2_i32_i16`/`u16` (2×16-bit), `v_dot4_u32_u8` (4×8-bit unsigned), and `v_dot8_i32_i4`/`u4` (8×4-bit) — and their VOP2 accumulating `v_dot*c_*` forms (reading old `vdst` as `acc`) — extract each element with `OpBitFieldSExtract`/`OpBitFieldUExtract`, sum the elementwise products with `S2` (or old `vdst`) wrapping at 32 bits, and saturate to `[INT32_MIN, INT32_MAX]` / `[0, UINT32_MAX]` under `clamp` (signed carry tracking handles the `v_dot2_i32_i16` `(-32768)^2 + (-32768)^2 + acc` overflow/cancellation edge). For VOP3P `v_dot*_*`, the hardware default `op_sel:[0,0,0]` and `op_sel_hi:[1,1,1]` is accepted and any other `op_sel`/`op_sel_hi`, `neg_lo`/`neg_hi`, DPP/SDWA, or source `neg`/`abs` raises `Unsupported`; for VOP2 `v_dot*c_*`, only optional `clamp` and VGPR `vdst` are accepted. `v_dot2_f32_f16` (VOP3P) and `v_dot2c_f32_f16` (VOP2) compute `a0*b0 + a1*b1 + acc` in f32 (`f16_in` per half, `flush_f32` on `acc`, and for `v_dot2_f32_f16` `op_sel`/`op_sel_hi`/`neg_lo`/`neg_hi` on the inputs and `neg_lo[2]` on `acc`; its `clamp` is accepted and not applied, see the `v_dot2_f32_f16` `clamp` row; `v_dot2c_f32_f16` takes no modifier). All 6 new `v_dot*c_*` ops mark `vdst` as read-before-write in `read_before_write_vgprs` and `reg_reads_writes`. (`v_dot4_i32_i8` and `v_dot4c_i32_i8` are covered separately in the Signed-byte dot products row, #1754.) `v_pk_fmac_f16` (VOP2) unpacks `src0`, `vsrc1` and `vdst` as `f16x2` (`Gen.src_h`, so inline float constants apply in the low half with `+0.0` high), computes `fma(src0[k], vsrc1[k], vdst[k])` per half with single f16 rounding (`Gen.fma_f16_odd`, SHADER-55), and packs with `Gen.f16_pack2`; any modifier outside `_dpp` or non-VGPR `vdst` raises `Unsupported`, and `v_pk_fmac_f16` marks `vdst` as read before write in `read_before_write_vgprs` and `reg_reads_writes`. **Hardware-confirmed on RDNA2** for the 5 VOP3P integer forms and `v_pk_fmac_f16`: on `gfx1036` (Ryzen 9 7950X3D iGPU, `tools/hw_oracle`, @aslan2142), all 60 integer dot-product sets and all 22 `v_pk_fmac_f16` default-MODE words match; independently confirmed on `gfx1035` (Radeon 680M, @Youssefrah16) across 18 cases × wave32/wave64 (36/36 bit-exact), pinned by `tests/semantic/test_alu_dot_pk_fmac.py`. The 5 VOP2 `v_dot*c_*` integer forms and `v_dot2_f32_f16` / `v_dot2c_f32_f16` are CPU-checked by `tests/semantic/test_alu_dot_complete.py`; of these, only the `clamp` of `v_dot2_f32_f16` is hardware-measured on RDNA2 (next row). `v_dot2_f32_f16` / `v_dot2c_f32_f16` are GPU-checked by `runtime/test/shaders/cs_w32_dot2_f16.asm` (assembled for gfx1030 through its `; mcpu:` line): exact-in-f32 values through the default halves, `op_sel`/`op_sel_hi` (swapped and both high), `neg_lo`/`neg_hi` on the inputs and on `acc`, `clamp` above 1 and below 0, the old `D` as `v_dot2c`'s addend and a denormal half; passes on an RTX 4060 (NVIDIA 621.01), and the translator with `op_sel_hi`, a negation, the accumulator or `clamp` broken fails it. Non-default f16 MODEs (denormal flush, RTZ) are not modelled on `v_pk_fmac_f16` while the translator has no MODE input. | +| Packed integer dot products (`v_dot2_i32_i16`, `v_dot2_u32_u16`, `v_dot4_u32_u8`, `v_dot8_i32_i4`, `v_dot8_u32_u4`, plus VOP2 accumulating `v_dot2c_i32_i16`, `v_dot2c_u32_u16`, `v_dot4c_u32_u8`, `v_dot8c_i32_i4`, `v_dot8c_u32_u4`), `v_dot2_f32_f16` / `v_dot2c_f32_f16`, and `v_pk_fmac_f16` | RDNA2 ISA: `v_dot2_i32_i16`/`u16` (2×16-bit), `v_dot4_u32_u8` (4×8-bit unsigned), and `v_dot8_i32_i4`/`u4` (8×4-bit) — and their VOP2 accumulating `v_dot*c_*` forms (reading old `vdst` as `acc`) — extract each element with `OpBitFieldSExtract`/`OpBitFieldUExtract`, sum the elementwise products with `S2` (or old `vdst`) wrapping at 32 bits, and saturate to `[INT32_MIN, INT32_MAX]` / `[0, UINT32_MAX]` under `clamp` (signed carry tracking handles the `v_dot2_i32_i16` `(-32768)^2 + (-32768)^2 + acc` overflow/cancellation edge). For VOP3P `v_dot*_*`, the hardware default `op_sel:[0,0,0]` and `op_sel_hi:[1,1,1]` is accepted and any other `op_sel`/`op_sel_hi`, `neg_lo`/`neg_hi`, DPP/SDWA, or source `neg`/`abs` raises `Unsupported`; for VOP2 `v_dot*c_*`, only optional `clamp` and VGPR `vdst` are accepted. `v_dot2_f32_f16` (VOP3P) and `v_dot2c_f32_f16` (VOP2) compute `a0*b0 + a1*b1 + acc` in f32 (`f16_in` per half, `flush_f32` on `acc`, and for `v_dot2_f32_f16` `op_sel`/`op_sel_hi`/`neg_lo`/`neg_hi` on the inputs and `neg_lo[2]` on `acc`; its `clamp` is accepted and not applied, see the `v_dot2_f32_f16` `clamp` row; `v_dot2c_f32_f16` takes no modifier). All 6 new `v_dot*c_*` ops mark `vdst` as read-before-write in `read_before_write_vgprs` and `reg_reads_writes`. (`v_dot4_i32_i8` and `v_dot4c_i32_i8` are covered separately in the Signed-byte dot products row, #1754.) `v_pk_fmac_f16` (VOP2) unpacks `src0`, `vsrc1` and `vdst` as `f16x2` (`Gen.src_h`, so inline float constants apply in the low half with `+0.0` high), computes `fma(src0[k], vsrc1[k], vdst[k])` per half with single f16 rounding (`Gen.fma_f16_odd`, SHADER-55), and packs with `Gen.f16_pack2`; any modifier outside `_dpp` or non-VGPR `vdst` raises `Unsupported`, and `v_pk_fmac_f16` marks `vdst` as read before write in `read_before_write_vgprs` and `reg_reads_writes`. **Hardware-confirmed on RDNA2** for the 5 VOP3P integer forms and `v_pk_fmac_f16`: on `gfx1036` (Ryzen 9 7950X3D iGPU, `tools/hw_oracle`, @aslan2142), all 60 integer dot-product sets and all 22 `v_pk_fmac_f16` default-MODE words match; independently confirmed on `gfx1035` (Radeon 680M, @Youssefrah16) across 18 cases × wave32/wave64 (36/36 bit-exact), pinned by `tests/semantic/test_alu_dot_pk_fmac.py`. The 5 VOP2 `v_dot*c_*` integer forms and `v_dot2_f32_f16` / `v_dot2c_f32_f16` are CPU-checked by `tests/semantic/test_alu_dot_complete.py`; of these, only the `clamp` of `v_dot2_f32_f16` is hardware-measured on RDNA2 (next row). `v_dot2_f32_f16` / `v_dot2c_f32_f16` are GPU-checked by `runtime/test/shaders/cs_w32_dot2_f16.asm` (assembled for gfx1030 through its `; mcpu:` line): exact-in-f32 values through the default halves, `op_sel`/`op_sel_hi` (swapped and both high), `neg_lo`/`neg_hi` on the inputs and on `acc`, `clamp` on results above 1 and below 0 (which the hardware leaves unclamped, see the next row), the old `D` as `v_dot2c`'s addend and a denormal half; passes on an RTX 4060 (NVIDIA 621.01), and the translator with `op_sel_hi`, a negation or the accumulator broken fails it, as does one that applies `clamp`. Words 4 and 5 match gfx1031 hardware (`tools/hw_oracle`). Non-default f16 MODEs (denormal flush, RTZ) are not modelled on `v_pk_fmac_f16` while the translator has no MODE input. | | `v_dot2_f32_f16` `clamp` | The `clamp` bit of `v_dot2_f32_f16` is encoded (bit 15 of the VOP3P word, llvm-mc 23.1.5) but **the hardware ignores it**: the result is the unclamped f32 sum, NaN and infinities included. Measured on an AMD Radeon RX 6700 XT (gfx1031, Linux, amdgpu DRM backend of `tools/hw_oracle`) in wave32 and wave64, with MODE `0x3c0` and with DX10_CLAMP or IEEE off: 10.5, -8.5, 1.25, `2*65504^2`, NaN and +-inf come back unchanged, and over 2,560 random and special inputs per wave size (`neg_lo`/`neg_hi`/`op_sel` variants included) the words with and without `clamp` are identical, while `v_fma_f32`, `v_pk_fma_f16` and `v_dot2_i32_i16` with `clamp` in the same kernels clamp. **Until 2026-11-23 the translator clamped the result 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 `v_dot2c_f32_f16_e64` and calls its bytes an invalid encoding), so a `clamp` on it is refused as `Unsupported`. The console's gfx1013 has neither instruction (GFX10.1 / GFX10.3 opcode differences row), so desktop gfx103x is the only hardware that defines it. CPU-checked by `tests/semantic/test_dot2_f32_f16_clamp_hw.py` (14 measured words and the fixture `tests/semantic/fixtures/dot2_f32_f16_clamp.asm`) and `tests/semantic/test_alu_dot_complete.py`. **Not GPU-verified through Vulkan.** | | Packed integer dot products (`v_dot2_i32_i16`, `v_dot2_u32_u16`, `v_dot4_u32_u8`, `v_dot8_i32_i4`, `v_dot8_u32_u4`) and `v_pk_fmac_f16` | RDNA2 ISA: `v_dot2_i32_i16`/`u16` (2×16-bit), `v_dot4_u32_u8` (4×8-bit unsigned), and `v_dot8_i32_i4`/`u4` (8×4-bit) extract each element with `OpBitFieldSExtract`/`OpBitFieldUExtract`, sum the elementwise products with `S2` wrapping at 32 bits, and saturate to `[INT32_MIN, INT32_MAX]` / `[0, UINT32_MAX]` under VOP3P `clamp` (signed carry tracking handles the `v_dot2_i32_i16` `(-32768)^2 + (-32768)^2 + S2` overflow/cancellation edge). The hardware default `op_sel:[0,0,0]` and `op_sel_hi:[1,1,1]` (whether omitted or written explicitly) is accepted; any other `op_sel`/`op_sel_hi` (such as `op_sel_hi:[0,0,0]` or `[0,1,1]`, which select the low half for lane 1 on `v_dot2_*`), `neg_lo`/`neg_hi`, DPP/SDWA forms, and source `neg`/`abs` raise `Unsupported`. (`v_dot4_i32_i8` and `v_dot4c_i32_i8` are covered separately in the Signed-byte dot products row, #1754.) `v_pk_fmac_f16` (VOP2) unpacks `src0`, `vsrc1` and `vdst` as `f16x2` (`Gen.src_h`, so inline float constants apply in the low half with `+0.0` high), computes `fma(src0[k], vsrc1[k], vdst[k])` per half with single f16 rounding (`Gen.fma_f16_odd`, SHADER-55), and packs with `Gen.f16_pack2`; any modifier outside `_dpp` or non-VGPR `vdst` raises `Unsupported`, and `v_pk_fmac_f16` marks `vdst` as read before write in `read_before_write_vgprs` and `reg_reads_writes`. Until 2026-11-22 all six ops raised `Unsupported`. **Hardware-confirmed on RDNA2:** on `gfx1036` (Ryzen 9 7950X3D iGPU, `tools/hw_oracle`, @aslan2142), all 60 integer dot-product sets (plain, swapped/SGPR sources, and `clamp`) match bit-for-bit, all measured `op_sel`/`neg_*` variants are refused, and all 22 `v_pk_fmac_f16` default-MODE (`0x000003C0`: round-to-nearest-even, f16 denormals kept, IEEE and DX10_CLAMP on) words match in both source orders (all 34 non-NaN halves bit-exact; the 10 NaN halves yield quiet f16 NaN, as SPIR-V does not preserve NaN payload bits or sign); independently confirmed on `gfx1035` (Radeon 680M, `tools/hw_oracle`, @Youssefrah16) across 18 cases × wave32/wave64 (36/36 bit-exact). Pinned by `tests/semantic/test_alu_dot_pk_fmac.py` (all 82 `gfx1036` measured tables plus hand-written `.asm` fixture, boundary/clamp cases, default/non-default `op_sel`/`op_sel_hi`, `read_before_write_vgprs`/`reg_reads_writes`, DPP, seeded sweeps, and rejected forms). Non-default f16 MODEs (denormal flush, RTZ) are not modelled on `v_pk_fmac_f16` while the translator has no MODE input. | | `v_med3_f32` output modifiers | The translator applies `mul:2`, `mul:4` or `div:2` to the median before clamping to [0, 1], following [LLVM’s modifier order](https://llvm.org/docs/AMDGPUModifierSyntax.html#omod). The finite-input fixture `ps_med3_mods.asm` produced 4,096 exact pixels on an Apple M3 Max with MoltenVK and on Mesa llvmpipe (software Vulkan); it also passes (4,096/4,096) on an NVIDIA RTX 4050 Laptop and an AMD Radeon 740M (RADV), both Linux, and on an RTX 2060 SUPER per #634. This uses the existing float MODE assumptions described above. | diff --git a/runtime/test/shaders/check.py b/runtime/test/shaders/check.py index 1bffc77040..f2add2fb46 100644 --- a/runtime/test/shaders/check.py +++ b/runtime/test/shaders/check.py @@ -123,7 +123,7 @@ def not_found_message(build, missing): ("cs_w32_fcmpswap", [0, 0x3F800000, 0x7FC00000, 0x3F800000, 0x80000000, 0x40400000, 0x3F800000, 0x7FC00000]), ("cs_w32_new_ops", [0x55, 0x8001, 0xC0000000, 0x80014000, 0x4000FFFF, 0x77, 0x99, 0x1234]), # v_dot2_f32_f16 / v_dot2c_f32_f16 (derivations in cs_w32_dot2_f16.asm) - ("cs_w32_dot2_f16", [0x41280000, 0x41600000, 0xC1080000, 0x41480000, 0x3F800000, 0x00000000, 0x411C0000, 0x3EC00004]), + ("cs_w32_dot2_f16", [0x41280000, 0x41600000, 0xC1080000, 0x41480000, 0x41280000, 0xC1080000, 0x411C0000, 0x3EC00004]), ("cs_w32_misc_ext", [0x0FFF0FFF, 0xE2C4A688, 0x0007FFFF, 0x7FFF8000, 0xFFFE0002, 0xFFFF0005, 0x509, 0xCAFEF00D]), ("cs_w32_salu64", [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE]), # SHADER-85: 8-bit LDS reads into one half of a VGPR, the other half kept diff --git a/runtime/test/shaders/cs_w32_dot2_f16.asm b/runtime/test/shaders/cs_w32_dot2_f16.asm index 88313b1024..890e6ecd14 100644 --- a/runtime/test/shaders/cs_w32_dot2_f16.asm +++ b/runtime/test/shaders/cs_w32_dot2_f16.asm @@ -4,21 +4,22 @@ ; v_dot2_f32_f16 and the old D for v_dot2c_f32_f16 (docs/design.md, "Packed integer dot products ... v_dot2_f32_f16"). ; gfx1013 has neither instruction, so this file is assembled for gfx1030 (the "; mcpu:" line above). ; Every product and sum below is exact in f32, so the words do not depend on how a GPU rounds or fuses; what they -; check is which half each operand reads (op_sel / op_sel_hi), the negations, the accumulator and clamp. +; check is which half each operand reads (op_sel / op_sel_hi), the negations, the accumulator, and that clamp +; changes nothing: RDNA2 hardware ignores v_dot2_f32_f16's clamp bit (docs/design.md, "v_dot2_f32_f16 clamp"). ; Halves: 2.0 = 0x4000, 3.0 = 0x4200, 4.0 = 0x4400, 0.5 = 0x3800, 1.5 = 0x3e00, 0.25 = 0x3400, 2^-24 = 0x0001. ; A = 0x42004000 (lo 2.0, hi 3.0) B = 0x38004400 (lo 4.0, hi 0.5) C = 1.0f ; out[0] v_dot2_f32_f16 A, B, C 2*4 + 3*0.5 + 1 = 10.5 0x41280000 ; out[1] op_sel:[1,0,0] op_sel_hi:[0,1,1] (A's halves swapped) 3*4 + 2*0.5 + 1 = 14.0 0x41600000 ; out[2] neg_lo:[1,0,0] neg_hi:[0,1,0] (-a0, -b1) -2*4 + 3*-0.5 + 1 = -8.5 0xc1080000 ; out[3] op_sel:[1,0,0] op_sel_hi:[1,1,1] neg_lo:[0,0,1] (both from A.hi, -acc) 3*4 + 3*0.5 - 1 = 12.5 0x41480000 -; out[4] clamp 10.5 -> 1.0 0x3f800000 -; out[5] neg_lo:[1,0,0] neg_hi:[0,1,0] clamp -8.5 -> 0 0x00000000 +; out[4] clamp (ignored) 10.5 = 10.5 0x41280000 +; out[5] neg_lo:[1,0,0] neg_hi:[0,1,0] clamp (ignored) -8.5 = -8.5 0xc1080000 ; out[6] v_dot2c_f32_f16 A, B with D = 0.25 8 + 1.5 + 0.25 = 9.75 0x411c0000 ; out[7] v_dot2c_f32_f16 0x3e000001, 0x34004000 with D = 0 (a denormal half: 2^-24 * 2 + 1.5 * 0.25) ; 2^-23 + 0.375 0x3ec00004 ; group: 32,1,1 ; Run: vk_compute_test cs_w32_dot2_f16.spv 1 dump -> out[0..7] = 1093140480 1096810496 3238526976 1095237632 -; 1065353216 0 1092354048 1052770308 +; 1093140480 3238526976 1092354048 1052770308 ; mattr: +wavefrontsize32,-wavefrontsize64 v_mov_b32_e32 v1, 0x42004000 v_mov_b32_e32 v2, 0x38004400 diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index 9db69af149..7b2c62d765 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py @@ -1107,8 +1107,8 @@ def run_suite(a, work: str) -> int: # ds_cmpst_f32 and buffer_atomic_fcmpswap: float compare (cs_w32_fcmpswap.asm) "cs_w32_fcmpswap": [0, 0x3F800000, 0x7FC00000, 0x3F800000, 0x80000000, 0x40400000, 0x3F800000, 0x7FC00000], "cs_w32_new_ops": [0x55, 0x8001, 0xC0000000, 0x80014000, 0x4000FFFF, 0x77, 0x99, 0x1234], - # v_dot2_f32_f16 / v_dot2c_f32_f16: half selects, negations, accumulator, clamp (cs_w32_dot2_f16.asm) - "cs_w32_dot2_f16": [0x41280000, 0x41600000, 0xC1080000, 0x41480000, 0x3F800000, 0x00000000, 0x411C0000, 0x3EC00004], + # v_dot2_f32_f16 / v_dot2c_f32_f16: half selects, negations, accumulator, ignored clamp (cs_w32_dot2_f16.asm) + "cs_w32_dot2_f16": [0x41280000, 0x41600000, 0xC1080000, 0x41480000, 0x41280000, 0xC1080000, 0x411C0000, 0x3EC00004], "cs_w32_misc_ext": [0x0FFF0FFF, 0xE2C4A688, 0x0007FFFF, 0x7FFF8000, 0xFFFE0002, 0xFFFF0005, 0x509, 0xCAFEF00D], "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE], # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header)