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 20:26:00 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-24 20:26:00 -0500
commit154e4ec034902deffa4b89b2cbca9a949f38baec (patch)
tree1b2ef5656de42c172291bc6009efa4c510650815 /scripts/run_gpu_tests.py
parenteb6a08cd359d98b5777e70d54d0ae8a75879495a (diff)
parent8a242efebf823aeb23c72d17c3d666daf0bbd3e2 (diff)
Merge the #984 result (main + RT-PROTON-STORY-LOAD) into #939
The base is 8a242efeb, the merge of main and #984. 68 files conflicted; they were resolved in seven groups by one rule: the same change in two forms keeps the base's form, everything only #939 has is kept, and where the two solve one problem in two ways the base's is the frame and #939's plugs into it. A, the Xbox proxy (d3d12_xs_device.cpp/.h, d3d12_xs.cpp, d3d12_xs_pso_stream.cpp/.h, d3d12_xs_alloc_size.h, d3d12_xs_desc_clean.h, device_proxy_test.cpp, queue_proxy_test.cpp): the base's files with #939's additions ported in. Device slot 57 asks #939's NativeGraphicsFactory first and falls back to the base's proxy_create_graphics_pipeline_from_native_code on E_NOTIMPL. Kept from #939: the providers (texture lease, raw texture view, resource by address, constant view, descriptor mapping, depth-stencil UAV, texture pages), the title-backed descriptor mirror, slot 13's feature answers, GPU labels on list slots 71/72. Dropped: #939's duplicates of the boot ladder routes, its fallback window, its slot 133 stand-in. A2 (xs_proxy_mock_test.cpp): the base's test with #939's slot 70 raw-buffer case; presentation cases follow #939's rule that a device which ever had a handler has no queue fallback. B1, the Vulkan device (d3d12_vulkan_device.cpp, d3d12_com.cpp/.h, shader_library.h, queue_families.h, pipeline_cache_file.h, startup_trace.h): one lazy-pipeline mechanism, the base's; #939's pending_base_compile and first_use_backend_pipelines dropped, prepare_on_bind and cold_graphics_compile kept. create_texture keeps the base's signature; #939's deferred backing is folded into the base's placed-memory binder. #939's quad lists as triangle indices. B2, the D3D12 tests (d3d12_existing_heap, a8_dimensions, pipeline_cache_seed, title_va, rect_list, shader_library, loader_tls_index0, draw, compute, xmem_placed, shader_library_corpus): the base's tests where both carry the same case, #939's cases added (rebound tables, linear texture map, large vertex batch, executable shaders, default A8 views). C, the backend (vulkan_replay.h, vulkan_backend.h, vulkan_bindless.h, vulkan_scratch.h, vulkan_present.h, rect_list_geometry.h, vk_test_device.h, vk_pipeline_check.cpp, vk_store_test.cpp, bindless_sizing_test.cpp, replay_texture_barrier_test.cpp): the base's prepare_draw and lazy compute, its #1055 release rule and its rectangle generator; #939's rectangle variants, GPU quad index expansion, 1D/3D and depth-stencil UAVs, the label fence on the base's submit. D, memory, services, presentation (xmem.cpp/.h, xg_xs.cpp, xg_xs_test.cpp, title_va_alias.h and its test, main.cpp, frame_pacer.h, xbox_present.cpp/.h; xgameruntime_offline.cpp for one comment): the base's xmem with #939's label hooks, file-backed sections and pin_mapped_data; both texture computers in xg_xs.cpp, the base's answering first; --first-run-ui kept without host speech in its profile. E, build, tools, docs (runtime/CMakeLists.txt, make_game.py, tools/rdna2spirv.py, tools/shader_disasm.py, scripts, tests, docs; docs/README.md and tests/test_exe_shaders_stage.py beyond the conflicts): the base's v_dot4 decode, #281's disassembler form and tests/semantic/test_fspx_dot4_op_sel_disasm.py dropped; the base's executable-shader step with #939's cache fix; 366 registered tests. 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.py50
1 files changed, 43 insertions, 7 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 4e6454b90..141b7e4b9 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -37,6 +37,9 @@ from check import cbv_modulate_test
37from check import IMAGE_STORE_CASES, texture_uav_test 37from check import IMAGE_STORE_CASES, texture_uav_test
38from check import HEAP_INIT_EXPECTED, heap_init_env # cs_heap_init: vk_compute_test's VKC_HEAP_INIT 38from 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 39from check import shift64_test # dynamic 64-bit vector shifts and overlapping destinations
40from check import cmp_f64_test # the 32 binary64 vector compares on memory-fed operands
41from check import round_f64_test # the four binary64 roundings on memory-fed inputs
42from check import frexp_ldexp_test # binary32 and binary64 frexp, and v_ldexp_f32, on memory-fed records
40from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan) 43from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan)
41from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py 44from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py
42from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 45from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8
@@ -94,10 +97,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) 97 return struct.pack("<I", len(r)) + bytes(r)
95 98
96 99
100# A comment line a .asm carries when llvm-mc cannot assemble it (cs_dpp_cmp.asm: a VOPC compare in DPP form).
101TEXT_ONLY_MARK = "; run_gpu_tests: text only, llvm-mc has no gfx1013 encoding for an instruction here"
102
103
97def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: 104def 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.""" 105 """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: 106 with open(asm_path, encoding="utf-8") as source:
100 raw = source.read() 107 raw = source.read()
108 if any(ln.strip() == TEXT_ONLY_MARK for ln in raw.splitlines()):
109 # The source holds an instruction llvm-mc has no gfx1013 encoding for. The translator reads straight-line
110 # code from its text alone (tests/semantic/regen_fixtures.py writes such listings), so the lines go through
111 # as they are.
112 lines = [f"; {name} code 0x0..0x0 (synthetic), gfx1013, 0 invalid words"]
113 lines += ["\t" + ln.strip() for ln in raw.splitlines() if ln.strip() and not ln.lstrip().startswith(";")]
114 with open(s_path, "w", encoding="utf-8", newline="\n") as f:
115 f.write("\n".join(lines) + "\n")
116 return
101 cmd = mc_command.mc_command(llvm_mc) + ["-triple=amdgcn--amdpal", "-mcpu=gfx1013"] 117 cmd = mc_command.mc_command(llvm_mc) + ["-triple=amdgcn--amdpal", "-mcpu=gfx1013"]
102 for ln in raw.splitlines(): 118 for ln in raw.splitlines():
103 s = ln.strip() 119 s = ln.strip()
@@ -264,6 +280,8 @@ def read_raw_u32(path: str) -> list[tuple[int, int, int, int]]:
264 return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)] 280 return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)]
265 281
266 282
283# cs_div_fmas_f64_rt's operands a = 1 + 2^-30, c = -(1 + 2^-29) as s4..s7 (low word first).
284DIV_FMAS_F64_SGPRS = "0x00400000,0x3ff00000,0x00800000,0xbff00000"
267UNSUPPORTED = 77 # vk_harness: the device lacks a stage the test draws with (geometry or mesh shaders) 285UNSUPPORTED = 77 # vk_harness: the device lacks a stage the test draws with (geometry or mesh shaders)
268 286
269 287
@@ -429,8 +447,10 @@ def judge_cs_dump(rc: int, msg: str, want: list[int], *, wave64: bool, partial:
429 return None, "SKIP (no 64-wide compute subgroup on this device)" 447 return None, "SKIP (no 64-wide compute subgroup on this device)"
430 if rc == 0 and wave64 and "compute subgroup size: 64" not in msg.splitlines(): 448 if rc == 0 and wave64 and "compute subgroup size: 64" not in msg.splitlines():
431 return False, "64-wide subgroup was not confirmed (rebuild vk_compute_test)" 449 return False, "64-wide subgroup was not confirmed (rebuild vk_compute_test)"
450 if rc != 0:
451 return False, f"exit {rc}: {msg or 'no test output'}"
432 words = dump_words(msg) 452 words = dump_words(msg)
433 if rc != 0 or words is None: 453 if words is None:
434 return False, msg 454 return False, msg
435 vals = words[:len(want)] 455 vals = words[:len(want)]
436 return words_match(vals, want), " ".join((hex if hexwords else str)(x) for x in vals) 456 return words_match(vals, want), " ".join((hex if hexwords else str)(x) for x in vals)
@@ -982,10 +1002,22 @@ def run_suite(a, work: str) -> int:
982 if name in CLIP_CASES: 1002 if name in CLIP_CASES:
983 detail = clip_test(a.build, spirv_dir, name) 1003 detail = clip_test(a.build, spirv_dir, name)
984 results.append((name, None if isinstance(detail, Skip) else not detail, detail or "four pixel masks exact")) 1004 results.append((name, None if isinstance(detail, Skip) else not detail, detail or "four pixel masks exact"))
1005 elif name == "cs_w32_frexp_ldexp":
1006 detail = frexp_ldexp_test(a.build, spirv_dir, cs_env)
1007 results.append((name, None if isinstance(detail, Skip) else not detail,
1008 detail or "768 words exact (64 records, eight results each, and unchanged inputs)"))
985 elif name == "cs_w32_shift64": 1009 elif name == "cs_w32_shift64":
986 detail = shift64_test(a.build, spirv_dir, cs_env) 1010 detail = shift64_test(a.build, spirv_dir, cs_env)
987 results.append((name, None if isinstance(detail, Skip) else not detail, 1011 results.append((name, None if isinstance(detail, Skip) else not detail,
988 detail or "640 words exact (64 shift cases and unchanged inputs)")) 1012 detail or "640 words exact (64 shift cases and unchanged inputs)"))
1013 elif name == "cs_w32_cmp_f64":
1014 detail = cmp_f64_test(a.build, spirv_dir, cs_env)
1015 results.append((name, None if isinstance(detail, Skip) else not detail,
1016 detail or "1536 words exact (256 operand pairs and unchanged inputs)"))
1017 elif name == "cs_w32_round_f64":
1018 detail = round_f64_test(a.build, spirv_dir, cs_env)
1019 results.append((name, None if isinstance(detail, Skip) else not detail,
1020 detail or "1152 words exact (64 inputs, eight roundings each, and unchanged inputs)"))
989 elif name == "cs_workgroup_yz": 1021 elif name == "cs_workgroup_yz":
990 rc, msg = run_cmd([vk_compute, spv, "2x3x4", "workgroup_yz"], env=cs_env) 1022 rc, msg = run_cmd([vk_compute, spv, "2x3x4", "workgroup_yz"], env=cs_env)
991 results.append((name,) + compute_result(rc, msg, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" 1023 results.append((name,) + compute_result(rc, msg, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches"
@@ -1103,10 +1135,12 @@ def run_suite(a, work: str) -> int:
1103 ok, detail = judge_cs_dump(rc, msg, [0, 0x40040000], wave64=False, partial=False, emulated=False, 1135 ok, detail = judge_cs_dump(rc, msg, [0, 0x40040000], wave64=False, partial=False, emulated=False,
1104 hexwords=True) 1136 hexwords=True)
1105 results.append((name, ok, detail)) 1137 results.append((name, ok, detail))
1106 elif name == "cs_div_fmas_f64": 1138 elif name in ("cs_div_fmas_f64", "cs_div_fmas_f64_rt"):
1107 # One-rounding binary64 FMA: strict where the translator emitted OpFmaKHR on doubles (shaderFmaFloat64, 1139 # One-rounding binary64 FMA: strict where the translator emitted OpFmaKHR on doubles (shaderFmaFloat64,
1108 # --fma khr); under the default GLSL Fma the split result (0) is allowed, as cs_fma_fused allows it. 1140 # --fma khr); under the default GLSL Fma the split result (0) is allowed, as cs_fma_fused allows it.
1109 rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=cs_env) 1141 # The _rt fixture reads the same operands from s4..s7, so the driver cannot fold the Fma at compile time.
1142 env = dict(cs_env or os.environ, VKC_SGPRS=DIV_FMAS_F64_SGPRS) if name.endswith("_rt") else cs_env
1143 rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=env)
1110 if rc == UNSUPPORTED: # no shaderFloat64, or (--fma khr) no shaderFmaFloat64 1144 if rc == UNSUPPORTED: # no shaderFloat64, or (--fma khr) no shaderFmaFloat64
1111 results.append((name, None, unsupported_skip(msg))) 1145 results.append((name, None, unsupported_skip(msg)))
1112 else: 1146 else:
@@ -1116,7 +1150,8 @@ def run_suite(a, work: str) -> int:
1116 ok = rc == 0 and (words == fused or (not strict and words == split)) 1150 ok = rc == 0 and (words == fused or (not strict and words == split))
1117 detail = " ".join(hex(x) for x in words) if words else msg 1151 detail = " ".join(hex(x) for x in words) if words else msg
1118 if ok and words == split: 1152 if ok and words == split:
1119 detail += " (split: the driver rounds GLSL Fma on doubles twice; --fma khr fixes it)" 1153 detail += (" (split: the driver rounded GLSL Fma on doubles twice%s; --fma khr fixes it)"
1154 % ("" if name.endswith("_rt") else " when folding the constants"))
1120 results.append((name, ok, detail)) 1155 results.append((name, ok, detail))
1121 elif name == "cs_cvt_f32_sat": 1156 elif name == "cs_cvt_f32_sat":
1122 # #300's saturating float -> int conversions: one dispatch per input word in s4 (VKC_SGPRS). 1157 # #300's saturating float -> int conversions: one dispatch per input word in s4 (VKC_SGPRS).
@@ -1163,7 +1198,7 @@ def run_suite(a, work: str) -> int:
1163 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 1198 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
1164 elif name in ("cs_smem_vcc_base", "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", 1199 elif name in ("cs_smem_vcc_base", "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",
1165 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 1200 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
1166 "cs_dpp_bound", "cs_dpp_w64", 1201 "cs_dpp_bound", "cs_dpp_cmp", "cs_dpp_w64",
1167 "cs_w64_mask_detect", 1202 "cs_w64_mask_detect",
1168 "cs_w64x_readlane", "cs_w64x_writelane", "cs_w64x_readfirstlane", "cs_w64x_bpermute", "cs_w64x_permute", 1203 "cs_w64x_readlane", "cs_w64x_writelane", "cs_w64x_readfirstlane", "cs_w64x_bpermute", "cs_w64x_permute",
1169 "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw", 1204 "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw",
@@ -1225,6 +1260,7 @@ def run_suite(a, work: str) -> int:
1225 "cs_dpp_bound": [10, 10, 11, 12, 13, 14, 15, 16], 1260 "cs_dpp_bound": [10, 10, 11, 12, 13, 14, 15, 16],
1226 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], 1261 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7],
1227 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], 1262 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777],
1263 "cs_dpp_cmp": [3, 2, 3, 2, 1, 0, 1, 0],
1228 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], 1264 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6],
1229 # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7] 1265 # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7]
1230 # without it 1266 # without it
@@ -1299,7 +1335,7 @@ def run_suite(a, work: str) -> int:
1299 "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", 1335 "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",
1300 "cs_lds_b64_cmpst", "cs_lds_xchg64_ext", "cs_lds_atomics_ext", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec", 1336 "cs_lds_b64_cmpst", "cs_lds_xchg64_ext", "cs_lds_atomics_ext", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec",
1301 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 1337 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
1302 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_w32_andn2_exec", 1338 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_dpp_cmp", "cs_w32_andn2_exec",
1303 "cs_w32_exec_computed") and not emulated and not partial 1339 "cs_w32_exec_computed") and not emulated and not partial
1304 if partial and not emulated: 1340 if partial and not emulated:
1305 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") 1341 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64")
@@ -1313,7 +1349,7 @@ def run_suite(a, work: str) -> int:
1313 continue 1349 continue
1314 if rc == 0: 1350 if rc == 0:
1315 skip = wave32_lane_skip(msg) 1351 skip = wave32_lane_skip(msg)
1316 if skip is None and name in WAVE32_PIN_DUMPS: 1352 if rc == 0 and skip is None and name in WAVE32_PIN_DUMPS:
1317 # the device may not be able to run the wave size this fixture was written for (a 64-only device 1353 # the device may not be able to run the wave size this fixture was written for (a 64-only device
1318 # can't pin 32, so cs_barrier_loop's words mean nothing); check.py skips it too 1354 # can't pin 32, so cs_barrier_loop's words mean nothing); check.py skips it too
1319 skip = subgroup_pin_skip(msg, cs_env) 1355 skip = subgroup_pin_skip(msg, cs_env)