upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/test_run_gpu_tests_python_assembler.py
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-24 22:35:34 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-24 22:35:34 -0500
commit6ed716a99a7416f1e8a60c2e38e128876ab752ec (patch)
tree3c35526aa8b96594252c82c278ab19b9aa3a98ba /tests/test_run_gpu_tests_python_assembler.py
parent028a414fade7058a96e5933d1325f374a0026588 (diff)
parentbfef489cb6307fa4e1dc6ed2c40bfc0ce120d066 (diff)
Merge main into RT-QUEUE-SIGNAL (#430)
Everything below this rung (#414, #416, #427) and the rung's own routing are in main already, through #984 and #939, in main's form; what is left of #430 is its test of queue slot 17, ported onto main's layout detection. Conflicts, all resolved to main's form: - runtime/shims/d3d12_xs_device.cpp: main's queue slot 16/17 rule (a fence there is the newer layout's Signal/Wait, for any caller) replaces the rung's caller-gated rule; main's PresentX routing (slot 30, or 32 once the newer layout is detected, LEONIDA_XS_PRESENT_X_SLOT) and lazily built presenter replace the fixed slot 32 of #414; main's list proxy already translates the CPU handles of console list slots 50 to 54 (#416) and drops unordered access from a depth-stencil texture at slot 76 (#427). - runtime/shims/d3d12_xs_device.h, runtime/shims/xbox_present.cpp, runtime/shims/xbox_present.h, runtime/src/frame_pacer.h: main's shared FrameTokenSource (Logan's piece of #414, as #984 carried it). - runtime/shims/d3d12_xs_desc_clean.h, runtime/test/device_proxy_test.cpp: main's without_depth_stencil_uav and its slot 25/76 test (#427). - runtime/test/xs_proxy_mock_test.cpp: main's file, which already has check_list_cpu_handles (#416's cases and more); the rung's slot 16/17 case is ported to main's form at the end of check_xbox_queue_slots: slot 16 and 17 with a fence reach PC Signal and Wait with the real fence, not the PC getters, and the fence proxy's vtable pointer is unchanged. The rung's host-caller and no-fence expectations are dropped: under main's rule a fence at 16 proves the newer layout, after which those calls answer S_OK. Auto-merged, then set to main's content: - runtime/test/queue_proxy_test.cpp: #414's call of queue slot 32 as an overridden slot; on main slot 32 is routed only on the newer layout and the sweep of the console tail already calls it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_run_gpu_tests_python_assembler.py')
-rw-r--r--tests/test_run_gpu_tests_python_assembler.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test_run_gpu_tests_python_assembler.py b/tests/test_run_gpu_tests_python_assembler.py
index 31a99aa90..d817f4ec0 100644
--- a/tests/test_run_gpu_tests_python_assembler.py
+++ b/tests/test_run_gpu_tests_python_assembler.py
@@ -4,6 +4,7 @@ import json
4import os 4import os
5from pathlib import Path 5from pathlib import Path
6import struct 6import struct
7import subprocess
7import sys 8import sys
8import tempfile 9import tempfile
9from types import SimpleNamespace 10from types import SimpleNamespace
@@ -41,6 +42,44 @@ class PythonAssemblerTests(unittest.TestCase):
41 self.assertGreaterEqual(len(data), 20) 42 self.assertGreaterEqual(len(data), 20)
42 self.assertEqual(struct.unpack("<I", data[:4])[0], 0x07230203) 43 self.assertEqual(struct.unpack("<I", data[:4])[0], 0x07230203)
43 44
45 def test_spirv_as_missing_on_path_is_a_readable_runtime_error(self) -> None:
46 # An empty PATH: spirv-as cannot be found, and the caller must get the RuntimeError it handles for a failed
47 # assembly, not a raw FileNotFoundError traceback (RUN-GPU-SPIRVAS-MISSING).
48 with tempfile.TemporaryDirectory() as tmp, patch.dict(os.environ, {"PATH": ""}):
49 with self.assertRaises(RuntimeError) as ctx:
50 run_gpu_tests.spirv_as("OpCapability Shader\n", str(Path(tmp) / "out.spv"), assembler="spirv-as")
51 self.assertIn("spirv-as not found on PATH", str(ctx.exception))
52 self.assertNotIsInstance(ctx.exception, FileNotFoundError)
53 self.assertIsNone(ctx.exception.__cause__)
54 self.assertTrue(ctx.exception.__suppress_context__)
55
56 def test_spirv_as_other_oserror_is_a_readable_runtime_error(self) -> None:
57 with tempfile.TemporaryDirectory() as tmp, \
58 patch.object(run_gpu_tests.subprocess, "run",
59 side_effect=PermissionError(13, "Permission denied")):
60 with self.assertRaises(RuntimeError) as ctx:
61 run_gpu_tests.spirv_as("", str(Path(tmp) / "out.spv"), assembler="spirv-as")
62 self.assertIn("spirv-as could not be started: Permission denied", str(ctx.exception))
63
64 def test_spirv_as_present_and_succeeding_runs_spirv_as(self) -> None:
65 # Stubbed success: spirv-as is invoked with the same arguments and a zero exit code is not an error.
66 done = subprocess.CompletedProcess(args=[], returncode=0, stdout="", stderr="")
67 with tempfile.TemporaryDirectory() as tmp, \
68 patch.object(run_gpu_tests.subprocess, "run", return_value=done) as run:
69 run_gpu_tests.spirv_as("asm", str(Path(tmp) / "out.spv"), assembler="spirv-as")
70 run.assert_called_once()
71 self.assertEqual(run.call_args.args[0],
72 ["spirv-as", "--target-env", "vulkan1.2", "-o", str(Path(tmp) / "out.spv"), "-"])
73 self.assertEqual(run.call_args.kwargs["input"], "asm")
74
75 def test_spirv_as_nonzero_exit_reports_stderr(self) -> None:
76 bad = subprocess.CompletedProcess(args=[], returncode=1, stdout="", stderr="error: bad opcode")
77 with tempfile.TemporaryDirectory() as tmp, \
78 patch.object(run_gpu_tests.subprocess, "run", return_value=bad):
79 with self.assertRaises(RuntimeError) as ctx:
80 run_gpu_tests.spirv_as("", str(Path(tmp) / "out.spv"), assembler="spirv-as")
81 self.assertIn("error: bad opcode", str(ctx.exception))
82
44 def test_rdna2spirv_assemble_spirv_no_validate_skips_spirv_val(self) -> None: 83 def test_rdna2spirv_assemble_spirv_no_validate_skips_spirv_val(self) -> None:
45 with tempfile.TemporaryDirectory() as tmp: 84 with tempfile.TemporaryDirectory() as tmp:
46 spvasm = Path(tmp) / "fs_passthru.spvasm" 85 spvasm = Path(tmp) / "fs_passthru.spvasm"