diff --git a/test/amd/test_sqttmap.py b/test/amd/test_sqttmap.py index 869befa2b7..311cfc4582 100644 --- a/test/amd/test_sqttmap.py +++ b/test/amd/test_sqttmap.py @@ -2,7 +2,7 @@ import unittest, pickle from typing import Iterator from pathlib import Path -from tinygrad.helpers import DEBUG, getenv, temp, ansistrip +from tinygrad.helpers import DEBUG, getenv, temp, ansistrip, Context from tinygrad.renderer.amd.sqtt import print_packets, map_insts from tinygrad.runtime.autogen.amd.rdna3.ins import s_endpgm from tinygrad.viz.serve import sqtt_timeline @@ -120,6 +120,9 @@ class TestSQTTMapBase(unittest.TestCase): for r in lines[2:]: parts = r.split() self.assertTrue(parts[0].isdigit(), f"expected clock timestamp, got {parts[0]}") + with Context(DEBUG=2): + kernels = run_cli("--profile", "--profile-path", str(pkl_path), "-s", "AMD").split("\n") + self.assertEqual(len(kernels), len(self.examples[pkl_path.stem][1])) class TestSQTTMapRDNA3(TestSQTTMapBase): target = "gfx1100" diff --git a/tinygrad/viz/cli.py b/tinygrad/viz/cli.py index e678349e98..1c4312284a 100755 --- a/tinygrad/viz/cli.py +++ b/tinygrad/viz/cli.py @@ -139,7 +139,7 @@ def main(args) -> None: # ** Profiler printer else: - timelines = [(n,l) for n,l in profile["layout"].items() if l.get("event_type") == 0] + timelines = [(n,l) for n,l in profile["layout"].items() if isinstance(l, dict) and l.get("event_type") == 0] def produce_top_kernels() -> Iterator[dict]: tagged = ((n,e) for n,l in timelines for e in l["events"]) if args.src == "ALL" else ((args.src,e) for e in unwrap(data)["events"]) agg:dict[tuple[str,str], tuple[float, int, int|None]] = {} # map (device, kernel name) to (total time, count and ref)