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:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-24 09:18:49 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-24 09:18:49 -0500
commit5668f16b490a182452521fca3ccfc29e682eca2b (patch)
treecf495c903c90374f4b8e3e1e50e06bcea90f5e1e /scripts/run_gpu_tests.py
parentd0da7dade8b688f2e0f7f23f4155d6cbb438809e (diff)
wave64 emulate: a cross-lane read of a missing lane in a partial wave gives 0
Restores old upstream PR 7450, ported onto main. With --wave64-emulate, every read of another lane's exchange slot (ds_swizzle, ds_bpermute, ds_permute, readlane, ...) now selects 0 when the source lane does not exist in a partial last wave (Gen.x_lane_word), instead of relying on the prologue's zeroed slot. RADV (Mesa 26.3.1) turned the store, barrier and load of an exchange behind a branch into masked_swizzle_amd with fetch_inactive, so in a 40-thread group lanes 32-39 of a SWAP 8 swizzle read the missing lanes' registers. Full waves emit the same module as before. scripts/run_gpu_tests.py now runs the partial-wave fixtures emulated at subgroup 32, as check.py's partial_wave_test does. It left the subgroup size to the driver, and RADV picks 64 for compute, where the new fixture passed even without the fix. GPU test cs_w64x_partial_swizzle (words measured on gfx1036 through tools/hw_oracle), semantic test test_w64x_partial_swizzle with a hand-written fixture, and a contract-table row in docs/design.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 80b380d9e..479c5b64c 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -1168,7 +1168,7 @@ def run_suite(a, work: str) -> int:
1168 "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw", 1168 "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw",
1169 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", 1169 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load",
1170 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", 1170 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent",
1171 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_w32_partial_permute", "cs_barrier_early_end", 1171 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w64x_partial_swizzle", "cs_w32_partial_scmp", "cs_w32_partial_permute", "cs_barrier_early_end",
1172 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst", "cs_lds_xchg64_ext", "cs_lds_atomics_ext", "cs_w32_andn2_exec", 1172 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst", "cs_lds_xchg64_ext", "cs_lds_atomics_ext", "cs_w32_andn2_exec",
1173 "cs_mask_vgpr_exec", "cs_w32_exec_computed", "cs_w64_exec_computed"): 1173 "cs_mask_vgpr_exec", "cs_w32_exec_computed", "cs_w64_exec_computed"):
1174 cs_dump_wants = { 1174 cs_dump_wants = {
@@ -1252,6 +1252,7 @@ def run_suite(a, work: str) -> int:
1252 "cs_w64x_lds_war": [1032, 1063, 1000, 1031, 2032, 2063, 2000, 2031], 1252 "cs_w64x_lds_war": [1032, 1063, 1000, 1031, 2032, 2063, 2000, 2031],
1253 "cs_w64x_partial": [40, 40, 528, 0, 0, 532, 539, 524820], 1253 "cs_w64x_partial": [40, 40, 528, 0, 0, 532, 539, 524820],
1254 "cs_w64x_partial_scmp": [0, 1, 0, 1, 1, 1, 1, 0], # s_cmp mask, -1 in a partial wave 1254 "cs_w64x_partial_scmp": [0, 1, 0, 1, 1, 1, 1, 0], # s_cmp mask, -1 in a partial wave
1255 "cs_w64x_partial_swizzle": [508, 523, 0, 0, 528, 0, 531, 0], # swizzle from a missing lane: 0
1255 "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32 1256 "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32
1256 # ds_permute_b32 in a 20-thread wave32: a never-launched source lane sends nothing (.asm header) 1257 # ds_permute_b32 in a 20-thread wave32: a never-launched source lane sends nothing (.asm header)
1257 "cs_w32_partial_permute": [0, 29, 127, 0, 1, 0, 134, 113], 1258 "cs_w32_partial_permute": [0, 29, 127, 0, 1, 0, 134, 113],
@@ -1286,10 +1287,12 @@ def run_suite(a, work: str) -> int:
1286 # as check.py does, where the device has none 1287 # as check.py does, where the device has none
1287 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 1288 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
1288 # translated with --wave64-emulate and run on any subgroup size. 1289 # translated with --wave64-emulate and run on any subgroup size.
1289 # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for 1290 # cs_w64x_partial, cs_w64x_partial_scmp and cs_w64x_partial_swizzle (40-thread groups) can't have full
1290 # size 64 without them. 1291 # subgroups: they ask for size 64 without them. With LEONIDA_W64_EMULATE=1 they ask for 32, the width the
1292 # emulation is for, as check.py's partial_wave_test does. RADV defaults compute to 64, and there
1293 # cs_w64x_partial_swizzle came out right even before its missing-lane reads were fixed; at 32 it did not.
1291 emulated = w64_emulated() 1294 emulated = w64_emulated()
1292 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") 1295 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp", "cs_w64x_partial_swizzle")
1293 wave64 = name not in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 1296 wave64 = name not in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
1294 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 1297 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
1295 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", 1298 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
@@ -1299,8 +1302,8 @@ def run_suite(a, work: str) -> int:
1299 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 1302 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
1300 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_w32_andn2_exec", 1303 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_w32_andn2_exec",
1301 "cs_w32_exec_computed") and not emulated and not partial 1304 "cs_w32_exec_computed") and not emulated and not partial
1302 if partial and not emulated: 1305 if partial:
1303 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") 1306 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="32" if emulated else "64")
1304 if name in WAVE32_LANE_DUMPS: # 32 lanes even without index.json, as check.py requests (#774) 1307 if name in WAVE32_LANE_DUMPS: # 32 lanes even without index.json, as check.py requests (#774)
1305 cs_env = dict(os.environ, **WAVE32_LANE_ENV) 1308 cs_env = dict(os.environ, **WAVE32_LANE_ENV)
1306 rc, msg = run_cmd([vk_compute, spv, "1", "dump"] + (["--require-wave64"] if wave64 else []), env=cs_env) 1309 rc, msg = run_cmd([vk_compute, spv, "1", "dump"] + (["--require-wave64"] if wave64 else []), env=cs_env)