upleb.uk

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

summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/audit_shader4_regs.py2
-rw-r--r--scripts/run_gpu_tests.py30
-rw-r--r--scripts/run_wine_tests.py2
3 files changed, 25 insertions, 9 deletions
diff --git a/scripts/audit_shader4_regs.py b/scripts/audit_shader4_regs.py
index ac22c856c..6a6c449de 100644
--- a/scripts/audit_shader4_regs.py
+++ b/scripts/audit_shader4_regs.py
@@ -371,7 +371,7 @@ def main(argv=None):
371 if a.json_out: 371 if a.json_out:
372 try: 372 try:
373 os.makedirs(os.path.dirname(os.path.abspath(a.json_out)), exist_ok=True) 373 os.makedirs(os.path.dirname(os.path.abspath(a.json_out)), exist_ok=True)
374 with open(a.json_out, "w", encoding="utf-8") as f: 374 with open(a.json_out, "w", encoding="utf-8", newline="\n") as f:
375 json.dump(rep, f, indent=2) 375 json.dump(rep, f, indent=2)
376 f.write("\n") 376 f.write("\n")
377 except OSError as e: 377 except OSError as e:
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 9361c1011..6fbbcdbc7 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -25,7 +25,7 @@ sys.path.insert(0, os.path.join(ROOT, "tools"))
25import mc_command # noqa: E402 25import mc_command # noqa: E402
26sys.path.insert(0, SHADER_DIR) 26sys.path.insert(0, SHADER_DIR)
27from build import CLIP_CASES, clip_container, shader_source 27from build import CLIP_CASES, clip_container, shader_source
28from check import Skip, clip_test, fmt_1010102_test, fmt_sint32_test, fmt_xy_xyz_test 28from check import Skip, clip_test, fmt_1010102_test, fmt_sint32_test, fmt_xy_xyz_test, tbuffer_store_test
29from compute_fixture import compute_header 29from compute_fixture import compute_header
30from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test) 30from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test)
31from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, 31from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES,
@@ -38,7 +38,7 @@ from check import gpu_test_timeout, timed_out # per-program time limit (LEONID
38from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS 38from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS
39from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip, 39from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip,
40 vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py 40 vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py
41from check import PIXEL_VERTEX, VINT_ENV, interp_f16_high_problem, ij_computed_problem # pixel producers and checks 41from check import PIXEL_VERTEX, VINT_ENV, interp_f16_high_problem, ij_computed_problem, mandelbrot_problem # pixel producers and checks
42from check import GET_LOD_TESTS, STORE_WORDS, get_lod_test, store_words_problem # TEST-184: image atomics and queries 42from check import GET_LOD_TESTS, STORE_WORDS, get_lod_test, store_words_problem # TEST-184: image atomics and queries
43from check import wide_pixel_skip # ps_w64x_readlane: judged only where the fragment stage was required 64-wide 43from check import wide_pixel_skip # ps_w64x_readlane: judged only where the fragment stage was required 64-wide
44 44
@@ -115,7 +115,7 @@ def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None:
115 continue 115 continue
116 if ln.startswith("\t"): 116 if ln.startswith("\t"):
117 lines.append(ln) 117 lines.append(ln)
118 with open(s_path, "w", encoding="utf-8") as f: 118 with open(s_path, "w", encoding="utf-8", newline="\n") as f:
119 f.write("\n".join(lines) + "\n") 119 f.write("\n".join(lines) + "\n")
120 120
121 121
@@ -548,7 +548,9 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool,
548OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test", 548OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test",
549 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test", 549 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test",
550 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test", 550 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test",
551 "ps_m3_post": "d3d12_m3_frame_test"} 551 "ps_m3_post": "d3d12_m3_frame_test",
552 "cs_m4_fill": "d3d12_m4_compute_test", "cs_m4_indirect": "d3d12_m4_compute_test",
553 "cs_buf_typed": "d3d12_buffer_uav_test", "cs_buf_counter": "d3d12_buffer_uav_test"}
552 554
553 555
554# Shaders a selected test draws with, built even when the filter leaves them out (#192). 556# Shaders a selected test draws with, built even when the filter leaves them out (#192).
@@ -845,6 +847,10 @@ def run_suite(a, work: str) -> int:
845 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) 847 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header)
846 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) 848 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env)
847 results.append((name, not problem, problem or "128/128 dumped words exact")) 849 results.append((name, not problem, problem or "128/128 dumped words exact"))
850 elif name == "cs_tbuffer_store":
851 # tbuffer_store_format_*: the instruction's format, words measured natively on a Radeon 680M (the .asm header)
852 problem = tbuffer_store_test(a.build, spirv_dir, cs_env)
853 results.append((name, not problem, problem or "128/128 dumped words exact"))
848 elif name == "cs_global_neg_offset": 854 elif name == "cs_global_neg_offset":
849 # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte 855 # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte
850 # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement. 856 # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement.
@@ -885,7 +891,7 @@ def run_suite(a, work: str) -> int:
885 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", 891 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load",
886 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", 892 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent",
887 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", 893 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end",
888 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64"): 894 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst"):
889 cs_dump_wants = { 895 cs_dump_wants = {
890 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000], 896 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000],
891 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone 897 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone
@@ -907,6 +913,9 @@ def run_suite(a, work: str) -> int:
907 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE], 913 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE],
908 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header) 914 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header)
909 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], 915 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234],
916 # ds_cmpst_b32 and the b64 2-address forms (cs_lds_b64_cmpst.asm header)
917 "cs_lds_b64_cmpst": [0x11110001, 0x22220002, 0x33330003, 0x44440004,
918 0xCCCC000C, 0x44440004, 0xBBBB000B, 0x3579BADC],
910 # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant 919 # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant
911 "cs_exec_const": [16, 8, 2, 16, 0, 16], 920 "cs_exec_const": [16, 8, 2, 16, 0, 16],
912 # constant lane masks: lane L takes bit L (cs_w32_mask_imm.asm / cs_w64_mask_imm.asm headers) 921 # constant lane masks: lane L takes bit L (cs_w32_mask_imm.asm / cs_w64_mask_imm.asm headers)
@@ -975,7 +984,8 @@ def run_suite(a, work: str) -> int:
975 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 984 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
976 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", 985 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
977 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", 986 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos",
978 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 987 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm",
988 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
979 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 989 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
980 if partial and not emulated: 990 if partial and not emulated:
981 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") 991 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64")
@@ -987,7 +997,8 @@ def run_suite(a, work: str) -> int:
987 ok, detail = None, str(skip) 997 ok, detail = None, str(skip)
988 else: 998 else:
989 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, 999 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated,
990 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16")) 1000 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16",
1001 "cs_lds_b64_cmpst"))
991 results.append((name, ok, detail)) 1002 results.append((name, ok, detail))
992 elif name == "cs_imgstore": 1003 elif name == "cs_imgstore":
993 rc, msg = run_cmd([vk_store, spv]) 1004 rc, msg = run_cmd([vk_store, spv])
@@ -1184,6 +1195,11 @@ def run_suite(a, work: str) -> int:
1184 with open(raw, "rb") as source: 1195 with open(raw, "rb") as source:
1185 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read()))) 1196 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read())))
1186 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6" 1197 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6"
1198 elif name == "ps_mandelbrot":
1199 with open(raw, "rb") as source:
1200 px = list(struct.iter_unpack("<4I", source.read()))
1201 problem = mandelbrot_problem(px)
1202 ok, detail = not problem, problem or f"{len(px)}/{len(px)} iteration counts match the float32 model"
1187 else: 1203 else:
1188 ok, detail = False, "no checker defined" 1204 ok, detail = False, "no checker defined"
1189 results.append((name, ok, detail)) 1205 results.append((name, ok, detail))
diff --git a/scripts/run_wine_tests.py b/scripts/run_wine_tests.py
index b55ea9b91..0a02525e5 100644
--- a/scripts/run_wine_tests.py
+++ b/scripts/run_wine_tests.py
@@ -251,7 +251,7 @@ def main() -> int:
251 if args.summary: 251 if args.summary:
252 try: 252 try:
253 _make_parent(args.summary) 253 _make_parent(args.summary)
254 with open(args.summary, "a", encoding="utf-8") as f: 254 with open(args.summary, "a", encoding="utf-8", newline="\n") as f:
255 f.write(f"### Windows tests under {args.label or 'Wine'}\n\n") 255 f.write(f"### Windows tests under {args.label or 'Wine'}\n\n")
256 f.write(f"{counts['pass']} passed, {counts['fail']} failed, {counts['skip']} skipped.\n\n") 256 f.write(f"{counts['pass']} passed, {counts['fail']} failed, {counts['skip']} skipped.\n\n")
257 f.write("| Test | Result | Required |\n|---|---|---|\n") 257 f.write("| Test | Result | Required |\n|---|---|---|\n")