upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/scripts/run_gpu_tests.py
diff options
context:
space:
mode:
authormilk4sale <53350507+milk4sale@users.noreply.github.com>2026-11-24 12:30:40 -0600
committermilk4sale <53350507+milk4sale@users.noreply.github.com>2026-11-24 12:40:29 -0600
commitcec2c7074c8b086b28d276f573573c22899200af (patch)
tree1b2db7f56b461719293c0522026f54d70eb41027 /scripts/run_gpu_tests.py
parent6293c1c4f88c7ea2088ec595fea51362f1759996 (diff)
tests: GPU readback for 38 scalar ALU ops on run-time operands (GPU-SALU-EXT)
No fixture in runtime/test/shaders ran s_sub_i32, s_andn2_b32, s_orn2_b32, s_xor_b32, s_ashr_i32, s_mul_hi_u32, s_lshl3_add_u32, s_lshl4_add_u32, s_pack_ll_b32_b16, s_pack_hh_b32_b16, s_abs_i32, s_bcnt0_i32_b32, s_bitset0_b32, s_bitset1_b32, s_brev_b32, s_flbit_i32, s_flbit_i32_b32, s_sext_i32_i8, the six s_cmp_*_i32, s_cmp_gt_u32, s_cmp_le_u32, s_bitcmp0_b32, s_bitcmp1_b32, s_addk_i32, s_mulk_i32, s_cmovk_i32, s_ashr_i64, s_lshl_b64, s_lshr_b64, s_bcnt0_i32_b64, s_bitset0_b64, s_cmov_b64 or s_ff0_i32_b64. cs_w32_salu_ext gets sixteen operand words in s4..s19 from VKC_SGPRS, so each op reaches the driver as SPIR-V and is not folded by the translator as an op on literals is. One thread stores every destination and four words of SCC bits: SCC after each op that writes it, run on operands that set it and on operands that clear it, each compare both ways, and SCC after each op that must keep it, set to 1 and to 0 in turn before them. The 73 expected words are literals in check.py, derived in the fixture's header. tests/test_gpu_salu_ext.py recomputes them from the fixture's own instruction lines with the reference of tools/salu_diff.py, checks that every op that writes SCC is seen with both values, and checks the readback and both runners' verdicts. The fixture is the first in the folder with bit 15 set in the immediate of a signed SOPK op (s_addk_i32 s52, 0x8000). tools/rdna2_decode.py gives that immediate sign-extended and llvm-mc 23.1.4 prints the same word as 0x8000, so test_parity_with_llvm_mc_on_shader_fixtures failed on it. That test now compares the immediates of the ten signed SOPK ops as the 16 bits they are, as it already does for SOPP branch offsets, and a hand-encoded test pins which of the sixteen ops the decoder sign-extends. No translator, decoder or runtime change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index e8fce4277..355797181 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -35,6 +35,7 @@ from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, CVT_PK_U8_WORDS, PK_MUL_
35 pick_build_dir, start_failure, table_fetch_test, texture_gradient_a16_test, texture_mip_test) 35 pick_build_dir, start_failure, table_fetch_test, texture_gradient_a16_test, texture_mip_test)
36from check import SIGNED_MIP_TEST, UINT_MIP_TEST 36from check import SIGNED_MIP_TEST, UINT_MIP_TEST
37from check import cbv_modulate_test 37from check import cbv_modulate_test
38from check import salu_ext_test # 38 scalar ALU ops on operands seeded through VKC_SGPRS
38from check import HEAP_INIT_EXPECTED, heap_init_env # cs_heap_init: vk_compute_test's VKC_HEAP_INIT 39from check import HEAP_INIT_EXPECTED, heap_init_env # cs_heap_init: vk_compute_test's VKC_HEAP_INIT
39from check import shift64_test # dynamic 64-bit vector shifts and overlapping destinations 40from check import shift64_test # dynamic 64-bit vector shifts and overlapping destinations
40from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan) 41from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan)
@@ -1096,6 +1097,10 @@ def run_suite(a, work: str) -> int:
1096 vals = words[:len(USER_SGPRS_WORDS)] if words else [] 1097 vals = words[:len(USER_SGPRS_WORDS)] if words else []
1097 results.append((name,) + compute_result(rc, msg, rc == 0 and vals == USER_SGPRS_WORDS, 1098 results.append((name,) + compute_result(rc, msg, rc == 0 and vals == USER_SGPRS_WORDS,
1098 " ".join(hex(x) for x in vals) if vals else msg)) 1099 " ".join(hex(x) for x in vals) if vals else msg))
1100 elif name == "cs_w32_salu_ext":
1101 detail = salu_ext_test(a.build, spirv_dir, cs_env)
1102 results.append((name, None if isinstance(detail, Skip) else not detail,
1103 detail or "80 words exact (73 results of 38 scalar ops and the untouched fill)"))
1099 elif name == "cs_f64_add": 1104 elif name == "cs_f64_add":
1100 rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=cs_env) 1105 rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=cs_env)
1101 if rc == 77: # Float64, or Int64 where the module declares both: quote whichever it names 1106 if rc == 77: # Float64, or Int64 where the module declares both: quote whichever it names