Track postproc callback invocations with a simple counter.
| 55 | |
| 56 | |
| 57 | class 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) |
no outgoing calls
searching dependent graphs…