File size: 650 Bytes
309b968 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | """Invocation counters for the verified units.
Turn it on and every verified unit records how many times its neural forward
actually ran (and how many scalar ops it produced). This is the evidence that a
training/inference pass genuinely computed *through* the verified GUDA logic --
not around it.
"""
from collections import Counter
COUNTS = Counter()
_ENABLED = False
def enable():
global _ENABLED
_ENABLED = True
def disable():
global _ENABLED
_ENABLED = False
def reset():
COUNTS.clear()
def bump(key: str, n: int = 1):
if _ENABLED:
COUNTS[key] += int(n)
def report() -> dict:
return dict(COUNTS)
|