upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/test_rdna2spirv_cli.py
diff options
context:
space:
mode:
authorThatters <69167449+Thatters@users.noreply.github.com>2026-11-22 15:06:34 -0500
committerThatters <69167449+Thatters@users.noreply.github.com>2026-11-22 15:06:34 -0500
commit48a4c4d130c003ab7c8ffd44ea3c91e5995a672c (patch)
tree473c1aeedeeaebb61cd87d07364a092d56a3d172 /tests/test_rdna2spirv_cli.py
parent5c6d00877ac17cb9710d1ee17f1aadde0185d8ef (diff)
rdna2spirv: decide barrier rounds from the depth-capped tree (SHADER-427 review)
needs_barrier_rounds() looked at the unbounded structured tree, while assemble() emits the dispatch loop once the tree nests deeper than MAX_STRUCTURED_DEPTH. A wave32 compute shader with a top-level s_barrier over the bound then got the dispatch loop without barrier rounds. Both now use capped_tree(). With the default bound (64) no corpus module is affected (the deepest is 29); it matters when --max-structured-depth is set below a shader's depth. The CLI test now pins the default to the literal 64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_rdna2spirv_cli.py')
-rw-r--r--tests/test_rdna2spirv_cli.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test_rdna2spirv_cli.py b/tests/test_rdna2spirv_cli.py
index e19a55d39..a40b4b76b 100644
--- a/tests/test_rdna2spirv_cli.py
+++ b/tests/test_rdna2spirv_cli.py
@@ -47,16 +47,17 @@ class ArgumentTypes(unittest.TestCase):
47 rdna2spirv._depth_arg(text) 47 rdna2spirv._depth_arg(text)
48 48
49 def test_max_structured_depth_sets_the_bound(self): 49 def test_max_structured_depth_sets_the_bound(self):
50 # SHADER-427: the option replaces MAX_STRUCTURED_DEPTH for the run; without it the default stays. 50 # SHADER-427: the option replaces MAX_STRUCTURED_DEPTH for the run; without it the default is 64, written out
51 # here rather than read from the module so that changing the default fails this test.
52 self.assertEqual(rdna2spirv.MAX_STRUCTURED_DEPTH, 64)
51 with tempfile.TemporaryDirectory() as tmp, \ 53 with tempfile.TemporaryDirectory() as tmp, \
52 mock.patch.object(rdna2spirv, "MAX_STRUCTURED_DEPTH", rdna2spirv.MAX_STRUCTURED_DEPTH): 54 mock.patch.object(rdna2spirv, "MAX_STRUCTURED_DEPTH", rdna2spirv.MAX_STRUCTURED_DEPTH):
53 default = rdna2spirv.MAX_STRUCTURED_DEPTH 55 for extra, expected in (([], 64), (["--max-structured-depth", "0"], 0),
54 for extra, expected in (([], default), (["--max-structured-depth", "0"], 0),
55 (["--max-structured-depth", "40"], 40)): 56 (["--max-structured-depth", "40"], 40)):
56 with self.subTest(extra=extra), \ 57 with self.subTest(extra=extra), \
57 mock.patch.object(sys, "argv", [TOOL, tmp, "--out", os.path.join(tmp, "o")] + extra), \ 58 mock.patch.object(sys, "argv", [TOOL, tmp, "--out", os.path.join(tmp, "o")] + extra), \
58 redirect_stdout(io.StringIO()): 59 redirect_stdout(io.StringIO()):
59 rdna2spirv.MAX_STRUCTURED_DEPTH = default 60 rdna2spirv.MAX_STRUCTURED_DEPTH = 64
60 rdna2spirv.main() 61 rdna2spirv.main()
61 self.assertEqual(rdna2spirv.MAX_STRUCTURED_DEPTH, expected) 62 self.assertEqual(rdna2spirv.MAX_STRUCTURED_DEPTH, expected)
62 63