From f9c7624359a9332896039e499e54f114726539ab Mon Sep 17 00:00:00 2001 From: vgineer <360335233+vgineer@users.noreply.github.com> Date: Tue, 24 Nov 2026 03:06:52 +0800 Subject: [PATCH] Test wave32 VCC_HI compares and EXEC masking with GPU readback --- runtime/test/shaders/check.py | 6 +++-- .../test/shaders/cs_w32_vcc_hi_compare.asm | 23 +++++++++++++++++++ scripts/run_gpu_tests.py | 7 +++--- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 runtime/test/shaders/cs_w32_vcc_hi_compare.asm diff --git a/runtime/test/shaders/check.py b/runtime/test/shaders/check.py index 9be55b3667..1c17dea586 100644 --- a/runtime/test/shaders/check.py +++ b/runtime/test/shaders/check.py @@ -103,10 +103,11 @@ def not_found_message(build, missing): CS_SMEM = [0x5eed0024, 0x5eed0028, 0x5eed002c, 0x5eed0030, 0x5eed0010, 0x5eed0014, 0x5eed0018, 0x5eed001c] # -0, and NaN checks that need SignedZeroInfNanPreserve (cs_signed_zero_nan.asm); 0 in out[4..7] means it's missing SIGNED_ZERO_NAN = [0x80000000, 0x80000000, 0x80008000, 0x00008000, 1, 1, 1, 0x00007c00] +VCC_HI_COMPARE_WORDS = [9, 8, 11, 8, 9, 8, 8, 8] WAVE32_DUMPS = ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", "cs_w32_lds_u8_d16", "cs_bpermute32", "cs_w32_lds_subdword", "cs_w32_lds_wide", - "cs_w32_partial_scmp", "cs_exec_const", "cs_w32_mask_imm", "cs_w32_int_ext", + "cs_w32_partial_scmp", "cs_w32_vcc_hi_compare", "cs_exec_const", "cs_w32_mask_imm", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", "cs_w32_sincos", "cs_lds_b64_cmpst", "cs_w32_andn2_exec", "cs_mask_vgpr_exec", "cs_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", "cs_w32_permlane_fi") # Wave32 lane-mask dumps: their EXEC/VCC masks and lane selects cover 32 lanes, so a device whose widest subgroup is @@ -114,7 +115,7 @@ def not_found_message(build, missing): # 32 lanes requested (WAVE32_LANE_ENV), as run_gpu_tests.py does: a device with a range like 8..32 (Intel ANV) may # otherwise pick a narrower size and return different words (#774). WAVE32_LANE_ENV = {"VKC_SUBGROUP_SIZE": "32"} -WAVE32_LANE_DUMPS = ("cs_wqm_w32", "cs_w32_lane_wrap", "cs_w32_permute", "cs_bpermute32", "cs_w32_partial_scmp", "cs_exec_const", +WAVE32_LANE_DUMPS = ("cs_wqm_w32", "cs_w32_lane_wrap", "cs_w32_permute", "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_vcc_hi_compare", "cs_exec_const", "cs_w32_mask_imm", "cs_lds_b64_cmpst", "cs_w32_andn2_exec", "cs_mask_vgpr_exec", "cs_w32_permlane_fi") CS_DPP = [("cs_dpp", [1, 0, 3, 2, 5, 4, 7, 6]), ("cs_dpp_row", [0, 0, 1, 2, 3, 4, 5, 6]), @@ -173,6 +174,7 @@ def not_found_message(build, missing): ("cs_w64_mask_detect", [48]), ("cs_wqm_w64", [20, 4, 12, 8, 1, 0, 15728895, 20]), ("cs_wqm_w32", [12, 1, 4, 0, 8, 15728880, 4, 32]), ("cs_bpermute32", [0, 50, 162, 99, 36, 218, 183, 15]), + ("cs_w32_vcc_hi_compare", VCC_HI_COMPARE_WORDS), ("cs_w32_partial_scmp", [0, 1, 1, 0, 1, 1, 1, 1]), # a 20-thread wave32: s_cmp mask, -1 # SHADER-88: v_sin/v_cos reduce the angle in turns (a regression guard, tolerance 1e-3) ("cs_w32_sincos", [1, 1, 1, 1, 1, 1]), diff --git a/runtime/test/shaders/cs_w32_vcc_hi_compare.asm b/runtime/test/shaders/cs_w32_vcc_hi_compare.asm new file mode 100644 index 0000000000..4e28667616 --- /dev/null +++ b/runtime/test/shaders/cs_w32_vcc_hi_compare.asm @@ -0,0 +1,23 @@ +; group: 32,1,1 +; mattr: +wavefrontsize32,-wavefrontsize64 +; VCC_LO records lane 2. Only lanes 0, 2, 4 and 6 run the second compare, +; and lanes below 6 pass. The resulting VCC_HI word must be 0x15. +; Each lane stores 8 for the exact word, 2 for its VCC_LO bit and 1 for its VCC_HI bit. +; Expected out[0..7] = 9 8 11 8 9 8 8 8. +v_cmp_eq_u32_e64 vcc_lo, v0, 2 +s_mov_b32 vcc_hi, -1 +s_mov_b32 s6, exec_lo +s_mov_b32 exec_lo, 0x55 +v_cmp_lt_u32_e64 vcc_hi, v0, 6 +s_mov_b32 exec_lo, s6 +s_cmp_eq_u32 vcc_hi, 0x15 +s_cselect_b32 s7, 8, 0 +v_mov_b32_e32 v1, 1 +v_mov_b32_e32 v2, 2 +v_cndmask_b32_e64 v3, 0, v1, vcc_hi +v_cndmask_b32_e64 v4, 0, v2, vcc_lo +v_or_b32_e32 v3, v4, v3 +v_or_b32_e32 v3, s7, v3 +v_lshlrev_b32_e32 v5, 2, v0 +buffer_store_dword v3, v5, s[0:3], 0 offen +s_endpgm diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index 3e4b17ffa9..7e1af4f2c9 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py @@ -42,7 +42,7 @@ from check import failure # "exit : ", check.py's detail for a program that exited non-zero from check import run_readback from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS -from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip, +from check import (VCC_HI_COMPARE_WORDS, WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip, unpinned_subgroup_skip, vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py from check import PIXEL_VERTEX, VINT_ENV, interp_f16_high_problem, ij_computed_problem, mandelbrot_problem # pixel producers and checks from check import barycentric_problem @@ -1156,7 +1156,7 @@ def run_suite(a, work: str) -> int: "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw", "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", - "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", + "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_w32_vcc_hi_compare", "cs_barrier_early_end", "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst", "cs_w32_andn2_exec", "cs_mask_vgpr_exec"): cs_dump_wants = { @@ -1234,6 +1234,7 @@ def run_suite(a, work: str) -> int: "cs_w64x_lds_war": [1032, 1063, 1000, 1031, 2032, 2063, 2000, 2031], "cs_w64x_partial": [40, 40, 528, 0, 0, 532, 539, 524820], "cs_w64x_partial_scmp": [0, 1, 0, 1, 1, 1, 1, 0], # s_cmp mask, -1 in a partial wave + "cs_w32_vcc_hi_compare": VCC_HI_COMPARE_WORDS, "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32 "cs_w32_andn2_exec": [1, 8, 16, 2064, 2068, 3, 20, 1544], # s_andn2_saveexec/wrexec_b32 (.asm header) "cs_w32_sincos": [1, 1, 1, 1, 1, 1], # SHADER-88 (cs_w32_sincos.asm): angles in turns @@ -1270,7 +1271,7 @@ def run_suite(a, work: str) -> int: "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", "cs_w32_lds_subdword", "cs_w32_lds_wide", - "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_permlane_fi", "cs_w32_sincos", "cs_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", + "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_vcc_hi_compare", "cs_w32_permlane_fi", "cs_w32_sincos", "cs_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_w32_andn2_exec") and not emulated and not partial