Files
mandy/tests/semantic/fixtures/packed_dot4_i8.asm
Jan Trencansky 0513e00b07 rdna2spirv: the 4x8-bit dot products as SPV_KHR_integer_dot_product
v_dot4_i32_i8, v_dot4c_i32_i8, v_dot4_u32_u8 and v_dot4c_u32_u8 become one
OpSDot / OpUDot on the packed bytes plus OpIAdd for the addend, and
OpSDotAccSat / OpUDotAccSat under clamp (both saturate the addend plus the
exact sum, as the hardware does). op_sel halves are put together into one
dword first. RADV did not re-form v_dot4 from the old expansion (four
extracts, multiplies and adds each), which made the FidelityFX upscaler
passes ALU bound.

--integer-dot-fallback keeps the expansion for a device without
shaderIntegerDotProduct (required by Vulkan 1.3): vk_subgroup_info.py
reports integer_dot_product and make_game.py turns the flag on where it is
false. The runtime and vk_pipeline_check enable the feature where the
device has it; the interpreters of the semantic tests run the new ops.

Tested: tests/semantic/test_packed_dot4.py (new fixtures), the translator
suite, tools/dot_diff.py on the four ops, a wave32 GPU program on the
Radeon iGPU (gfx1036) and the RX 7900 XTX against the gfx1036-measured
words, RADV statistics of the upscaler passes (docs/design.md row).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 05:48:33 -05:00

17 lines
638 B
NASM

; v_dot4_i32_i8 as SPV_KHR_integer_dot_product: the wrapping sum, both saturations under clamp, and op_sel.
; Operands and words are the gfx1036 measurements of tests/semantic/test_alu_dot4_i8.py.
; Expected MRT0 words: 8000fc03 7fffffff 80000000 0000003e.
v_mov_b32 v0, 0x7f7f7f7f
v_mov_b32 v1, 0x7fffffff
v_dot4_i32_i8 v2, v0, v0, v1
v_dot4_i32_i8 v3, v0, v0, v1 clamp
v_mov_b32 v4, 0x80808080
v_mov_b32 v5, 0x80000000
v_dot4_i32_i8 v4, v4, v0, v5 clamp
v_mov_b32 v6, 0x04030201
v_mov_b32 v7, 0x08070605
v_mov_b32 v8, 0
v_dot4_i32_i8 v5, v6, v7, v8 op_sel:[0,1,0] op_sel_hi:[1,0,1]
exp mrt0 v2, v3, v4, v5 done vm
s_endpgm