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:
authorQemmHD <stephenlethco2@gmail.com>2026-11-24 16:04:56 -0500
committerGitHub <noreply@github.com>2026-11-24 16:04:56 -0500
commit6261ca916e3994a6b051b9a3d612da5f9015cc67 (patch)
treedbc0f45cf3fb3164269d42a8d7c00adcf47ed36a /scripts/run_gpu_tests.py
parentc9e5fb7bebed15cbb035406c6b8c74a88cc2e131 (diff)
parentd046559435c22f1dc834001b1e117a992358f89e (diff)
Merge pull request #957 from quartz-heron-58/vopc-dpp
Merging. **Why merged:** SHADER-VOPC-DPP decodes and translates VOPC compares in DPP16/DPP8 form. `shader_disasm` gets a second llvm-mc pass that patches the word llvm-mc rejects to a `v_max_f32` stand-in, then restores the name and encoding. KernelSmoker approved it, Timon360SB ran it on Blackwell native and w64, and kawaii-shakal ran all 2,684 CS programs of the real library through it. **Why it's good:** on the RTX 4070 SUPER, `scripts/run_gpu_tests.py --filter cs_dpp`: - native: 9/10 pass, and `cs_dpp_w64` is skipped (no 64-wide compute subgroup on this device); - with `LEONIDA_W64_EMULATE=1` under the Khronos validation layer: 10/10 pass, with no VUIDs; - `cs_dpp_cmp` reads the expected `3 2 3 2 1 0 1 0`, and all 10 shaders pass spirv-val. Own tests (dpp_compare, dpp_eager_subgroup, rdna2_decode, shader_disasm, run_gpu_tests*, docs): 207 passed, 0 skipped. The llvm-mc cases ran with a real AMDGPU llvm-mc. Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 66d4f5aa3. With it in, the repo-consistency set gives 573 passed / 5 skipped / 0 failed, and check_no_game_data is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: decoder and translator branches plus the tool changes above, with no binaries, downloads, network calls or CI changes. Heads-up from the PR body: this conflicts with #281 in `shader_disasm.py`, so #281 will need a rebase. AI-assisted (Claude Code, Claude Opus 5.5).
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index e8fce4277..8f17a4028 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -94,10 +94,23 @@ def make_ms_psv0(threads_x: int, maxv: int, maxp: int, topology: int = 2, group_
94 return struct.pack("<I", len(r)) + bytes(r) 94 return struct.pack("<I", len(r)) + bytes(r)
95 95
96 96
97# A comment line a .asm carries when llvm-mc cannot assemble it (cs_dpp_cmp.asm: a VOPC compare in DPP form).
98TEXT_ONLY_MARK = "; run_gpu_tests: text only, llvm-mc has no gfx1013 encoding for an instruction here"
99
100
97def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: 101def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None:
98 """Assemble raw RDNA2 .asm with llvm-mc -show-encoding into .s format for rdna2spirv.py.""" 102 """Assemble raw RDNA2 .asm with llvm-mc -show-encoding into .s format for rdna2spirv.py."""
99 with open(asm_path, encoding="utf-8") as source: 103 with open(asm_path, encoding="utf-8") as source:
100 raw = source.read() 104 raw = source.read()
105 if any(ln.strip() == TEXT_ONLY_MARK for ln in raw.splitlines()):
106 # The source holds an instruction llvm-mc has no gfx1013 encoding for. The translator reads straight-line
107 # code from its text alone (tests/semantic/regen_fixtures.py writes such listings), so the lines go through
108 # as they are.
109 lines = [f"; {name} code 0x0..0x0 (synthetic), gfx1013, 0 invalid words"]
110 lines += ["\t" + ln.strip() for ln in raw.splitlines() if ln.strip() and not ln.lstrip().startswith(";")]
111 with open(s_path, "w", encoding="utf-8", newline="\n") as f:
112 f.write("\n".join(lines) + "\n")
113 return
101 cmd = mc_command.mc_command(llvm_mc) + ["-triple=amdgcn--amdpal", "-mcpu=gfx1013"] 114 cmd = mc_command.mc_command(llvm_mc) + ["-triple=amdgcn--amdpal", "-mcpu=gfx1013"]
102 for ln in raw.splitlines(): 115 for ln in raw.splitlines():
103 s = ln.strip() 116 s = ln.strip()
@@ -1167,7 +1180,7 @@ def run_suite(a, work: str) -> int:
1167 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 1180 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
1168 elif name in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_w32_sincos", "cs_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", "cs_w32_permlane_fi", "cs_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "cs_w32_lds_subdword", "cs_w32_lds_wide", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", "cs_wave64_ballot", "cs_wm_half_ops", "cs_wm_half_cmp", "cs_wm_bfm64", "cs_wm_scc_rfl", "cs_wqm_w64", "cs_wqm_w32", "cs_wqm_w64_half", 1181 elif name in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_w32_sincos", "cs_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", "cs_w32_permlane_fi", "cs_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "cs_w32_lds_subdword", "cs_w32_lds_wide", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", "cs_wave64_ballot", "cs_wm_half_ops", "cs_wm_half_cmp", "cs_wm_bfm64", "cs_wm_scc_rfl", "cs_wqm_w64", "cs_wqm_w32", "cs_wqm_w64_half",
1169 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 1182 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
1170 "cs_dpp_bound", "cs_dpp_w64", 1183 "cs_dpp_bound", "cs_dpp_cmp", "cs_dpp_w64",
1171 "cs_w64_mask_detect", 1184 "cs_w64_mask_detect",
1172 "cs_w64x_readlane", "cs_w64x_writelane", "cs_w64x_readfirstlane", "cs_w64x_bpermute", "cs_w64x_permute", 1185 "cs_w64x_readlane", "cs_w64x_writelane", "cs_w64x_readfirstlane", "cs_w64x_bpermute", "cs_w64x_permute",
1173 "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw", 1186 "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw",
@@ -1228,6 +1241,7 @@ def run_suite(a, work: str) -> int:
1228 "cs_dpp_bound": [10, 10, 11, 12, 13, 14, 15, 16], 1241 "cs_dpp_bound": [10, 10, 11, 12, 13, 14, 15, 16],
1229 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], 1242 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7],
1230 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], 1243 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777],
1244 "cs_dpp_cmp": [3, 2, 3, 2, 1, 0, 1, 0],
1231 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], 1245 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6],
1232 # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7] 1246 # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7]
1233 # without it 1247 # without it
@@ -1302,7 +1316,7 @@ def run_suite(a, work: str) -> int:
1302 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_partial_permute", "cs_w32_permlane_fi", "cs_w32_sincos", "cs_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", 1316 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_partial_permute", "cs_w32_permlane_fi", "cs_w32_sincos", "cs_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap",
1303 "cs_lds_b64_cmpst", "cs_lds_xchg64_ext", "cs_lds_atomics_ext", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec", 1317 "cs_lds_b64_cmpst", "cs_lds_xchg64_ext", "cs_lds_atomics_ext", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec",
1304 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 1318 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
1305 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_w32_andn2_exec", 1319 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_dpp_cmp", "cs_w32_andn2_exec",
1306 "cs_w32_exec_computed") and not emulated and not partial 1320 "cs_w32_exec_computed") and not emulated and not partial
1307 if partial and not emulated: 1321 if partial and not emulated:
1308 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") 1322 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64")