Files
mandy/runtime/test/shaders/cs_dpp_cmp.asm
quartz-heron-58 d046559435 rdna2spirv, shader_disasm: VOPC compares in DPP form (SHADER-VOPC-DPP)
Three pipeline-library compute programs of 1.0.2.1 hold v_cmp_gt_f32 with a
DPP16 or DPP8 src0. llvm-mc has no gfx10 decoding for the pair, so the
listing dropped the words and the programs were refused.

shader_disasm.py prints the pair through a VOP2 stand-in that takes the same
DPP word, rdna2_decode.py decodes it directly, and Gen.dpp_insn translates
the compare for the forms where every lane writes its bit. Other forms and
v_cmpx are refused: what an unwritten lane does to VCC is not measured.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 23:41:08 +08:00

23 lines
1.3 KiB
NASM

; DPP on a VOPC compare: src0 is read from the permuted lane, src1 from the lane itself, and the result goes to VCC.
; v1 = float(lane). The first compare takes src0 from the other lane of each pair (quad_perm [1,0,3,2]), so
; "neighbour > self" is true on even lanes. The second takes it from the other half of each 8 lanes (dpp8), so it
; is true on lanes 0-3. out = (first ? 1 : 0) + (second ? 2 : 0).
; Run: vk_compute_test cs_dpp_cmp.spv 1 dump -> out[0..7] = 3 2 3 2 1 0 1 0
; llvm-mc assembles neither compare for gfx1013 ("dpp variant of this instruction is not supported"), so the GPU
; test takes this file's text as its listing; tools/shader_disasm.py prints the same lines for the encoded words.
; run_gpu_tests: text only, llvm-mc has no gfx1013 encoding for an instruction here
; regen_fixtures: this source has a translator fixture in tests/semantic/fixtures/disasm
v_mbcnt_lo_u32_b32 v0, -1, 0
v_cvt_f32_u32 v1, v0
v_mov_b32 v3, 0
v_mov_b32 v4, 1
v_mov_b32 v5, 2
v_cmp_gt_f32_dpp vcc_lo, v1, v1 quad_perm:[1,0,3,2] row_mask:0xf bank_mask:0xf bound_ctrl:1
v_cndmask_b32 v6, v3, v4, vcc_lo
v_cmp_gt_f32_dpp vcc_lo, v1, v1 dpp8:[4,5,6,7,0,1,2,3]
v_cndmask_b32 v7, v3, v5, vcc_lo
v_add_nc_u32 v6, v6, v7
v_lshlrev_b32 v2, 2, v0
buffer_store_dword v6, v2, s[0:3], 0 offen
s_endpgm