upleb.uk

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

summaryrefslogtreecommitdiff
path: root/scripts/bench_wave64.py
diff options
context:
space:
mode:
authorVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 21:13:08 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 21:13:08 +0100
commitb84de36e6380b1623fd47aa295a36f463b73f6a5 (patch)
tree69be53a97e21a009cc9d341cd1a16963200c051a /scripts/bench_wave64.py
parentf847748cc76bd3777f9c070c4034eb2fc1c04e64 (diff)
fix(tools): count partitioned wave64 benchmark segments
Large translated shaders dispatch through inner switches, so their segment diagnostics were missing from benchmark output.
Diffstat (limited to 'scripts/bench_wave64.py')
-rw-r--r--scripts/bench_wave64.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/bench_wave64.py b/scripts/bench_wave64.py
index 3d77bc2bc..433eea00f 100644
--- a/scripts/bench_wave64.py
+++ b/scripts/bench_wave64.py
@@ -36,13 +36,14 @@ def build(work, name, emulate, llvm_mc):
36 return os.path.join(out, "spirv", name + ".spv") 36 return os.path.join(out, "spirv", name + ".spv")
37 37
38 38
39def segments(spv): 39def segments(spv: str) -> tuple[int, int] | None:
40 """(segments, continuation segments) of an emulated module: the cases of the scheduler's OpSwitch.""" 40 """Count scheduler cases and continuations, including inner switches in a partitioned dispatch."""
41 text = open(spv[:-4] + ".spvasm", encoding="utf-8").read() 41 with open(spv[:-4] + ".spvasm", encoding="utf-8") as source:
42 m = re.search(r"OpSwitch %pcv %sw_default ([^\n]+)", text) 42 text = source.read()
43 if not m: 43 tables = re.findall(r"^[ \t]*OpSwitch %pcv %(?:sw_default|swm\d+) ([^\n]+)", text, re.MULTILINE)
44 if not tables:
44 return None 45 return None
45 cases = [int(x) for x in re.findall(r"(\d+) %blk\d+", m.group(1))] 46 cases = sorted(int(case) for table in tables for case in re.findall(r"(\d+) %blk\d+", table))
46 blocks = next((i for i, c in enumerate(cases) if c != i), len(cases)) # blocks 0..n-1, then "done" = n, then segments 47 blocks = next((i for i, c in enumerate(cases) if c != i), len(cases)) # blocks 0..n-1, then "done" = n, then segments
47 return len(cases), len(cases) - blocks 48 return len(cases), len(cases) - blocks
48 49