MCPcopy Create free account
hub / github.com/tile-ai/tilelang / PostProcCounter

Class PostProcCounter

testing/python/cache/test_tilelang_kernel_cache.py:57–75  ·  view source on GitHub ↗

Track postproc callback invocations with a simple counter.

Source from the content-addressed store, hash-verified

55
56
57class PostProcCounter:
58 """Track postproc callback invocations with a simple counter."""
59
60 def __init__(self):
61 self.count = 0
62 self.marker = None
63
64 def register_callback(self, backend: str):
65 """Register postproc callback for the given backend."""
66 comment_prefix = "#" if backend == "cutedsl" else "//"
67 global_func = "tilelang_callback_cutedsl_postproc" if backend == "cutedsl" else "tilelang_callback_cuda_postproc"
68
69 def callback(code, _):
70 self.count += 1
71 self.marker = f"{comment_prefix} CACHE_TEST_MARKER_{self.count}"
72 return self.marker + "\n" + code
73
74 tvm_ffi.register_global_func(global_func, f=callback, override=True)
75 return callback
76
77
78@pytest.fixture(scope="module", autouse=True)

Calls

no outgoing calls

Tested by 3

Used in the wild real call sites across dependent graphs

searching dependent graphs…