Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tests/test_chain_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,21 @@ def test_descriptor_table_lines(self):
self.assertEqual(block(chain_check.check(work, log, probe=False), "runtime")["descriptor_table"],
expected)

def test_only_compiles_count_as_slow_builds(self):
work = make_work(os.path.join(self.root, "w"))
name = "[rt] d3d12: compute pipeline library/aaaa took 4.2 s to "
cases = (("build (100 B SPIR-V)", 1),
("obtain from a compile (100 B SPIR-V; hit 0, seeded 0, written 1)", 1),
("obtain from the shared cache (100 B SPIR-V; hit 1, seeded 0, written 0)", 0),
("obtain from its journal file (100 B SPIR-V; hit 1, seeded 1, written 0)", 0))
for line, expected in cases:
with self.subTest(line=line):
base = runtime_log(os.path.join(self.root, "b.log"))
log = runtime_log(os.path.join(self.root, "t.log"), extra=(name + line,))
slow = [block(chain_check.check(work, x, probe=False), "runtime")["slow_compute_builds"]
for x in (base, log)]
self.assertEqual(slow[1] - slow[0], expected)

def test_runtime_sources_still_print_what_the_regexes_read(self):
# Every runtime line the report counts, pinned to the source that prints it: a reworded message would make
# its count fall to 0 and the runtime block pass in silence.
Expand All @@ -291,7 +306,8 @@ def test_runtime_sources_still_print_what_the_regexes_read(self):
"%zu fspx_gfx, %zu bvh, %zu exe) from %s",
"[rt] d3d12: no translated compute shader for %s sha256",
"[rt] d3d12: compute pipeline %s (%zu B SPIR-V, %s) build starts at t=",
"[rt] d3d12: compute pipeline %s took %.1f s to build",
"[rt] d3d12: compute pipeline %s took %.1f s to obtain from %s (%zu B SPIR-V; hit %d,",
'out.journal_hit ? "its journal file" : out.from_shared ? "the shared cache" : "a compile"',
"[rt] d3d12: descriptor table: %s (all %zu modules)",
"[rt] d3d12: descriptor table: %zu tagged / %zu plain modules; using %s",
"[rt] d3d12: descriptor table: %s (LEONIDA_DESCRIPTOR_TABLE; %zu tagged / %zu plain modules)"],
Expand Down
3 changes: 2 additions & 1 deletion tools/chain_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
SLOT_FAIL = re.compile(r"\[rt\] d3d12_xs: slot (\d+) call \d+ failed with (0x[0-9a-fA-F]{8})")
NO_COMPUTE = re.compile(r"\[rt\] d3d12: no translated compute shader for ")
BUILD_START = re.compile(r"\[rt\] d3d12: compute pipeline \S+ \(\d+ B SPIR-V, [^)]*\) build starts")
BUILD_SLOW = re.compile(r"\[rt\] d3d12: compute pipeline \S+ took [0-9.]+ s to build")
# "to build" is the line of older logs. The line now names where the pipeline came from, and only a compile is a build.
BUILD_SLOW = re.compile(r"\[rt\] d3d12: compute pipeline \S+ took [0-9.]+ s to (?:build|obtain from a compile) ")
TRACE = re.compile(r"\[d3d12-trace\] #\d+ (.+) (failed|unsupported|refused|partial)\s*$")
GATE = re.compile(r"\[rt\] submit-lock: thread \d+ is waiting at the compile gate")
STALL = re.compile(r"\[rt\] device-fault: submitted dispatch ") # also printed for a plain stall
Expand Down