mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 17:28:37 +00:00
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>
17 lines
670 B
NASM
17 lines
670 B
NASM
; v_dot4_u32_u8 and v_dot4c_u32_u8 as SPV_KHR_integer_dot_product: zero-extended bytes, the sum wrapping at 32 bits,
|
|
; unsigned saturation under clamp, and the accumulating form reading its destination (twice: 2 * 17027).
|
|
; 0x80ff0102 . 0x7f02ff03 = 128*127 + 255*2 + 1*255 + 2*3 = 17027; 4 * 255 * 255 = 260100.
|
|
; Expected MRT0 words: 00004288 0003f803 ffffffff 00008506.
|
|
v_mov_b32 v0, 0x80ff0102
|
|
v_mov_b32 v1, 0x7f02ff03
|
|
v_mov_b32 v2, 5
|
|
v_dot4_u32_u8 v3, v0, v1, v2
|
|
v_mov_b32 v4, -1
|
|
v_dot4_u32_u8 v5, v4, v4, v4
|
|
v_dot4_u32_u8 v6, v4, v4, v4 clamp
|
|
v_mov_b32 v7, 0
|
|
v_dot4c_u32_u8 v7, v0, v1
|
|
v_dot4c_u32_u8 v7, v0, v1
|
|
exp mrt0 v3, v5, v6, v7 done vm
|
|
s_endpgm
|