mirror of https://github.com/commaai/tinygrad.git
update debug prints
This commit is contained in:
parent
c0a033f01d
commit
09bdd55acc
|
@ -166,13 +166,13 @@ def db_connection():
|
|||
if _db_connection is None:
|
||||
os.makedirs(CACHEDB.rsplit("/", 1)[0], exist_ok=True)
|
||||
_db_connection = sqlite3.connect(CACHEDB)
|
||||
if DEBUG >= 5: _db_connection.set_trace_callback(print)
|
||||
if DEBUG >= 7: _db_connection.set_trace_callback(print)
|
||||
if diskcache_get("meta", "version") != VERSION:
|
||||
print("cache is out of date, clearing it")
|
||||
del _db_connection
|
||||
os.unlink(CACHEDB)
|
||||
_db_connection = sqlite3.connect(CACHEDB)
|
||||
if DEBUG >= 5: _db_connection.set_trace_callback(print)
|
||||
if DEBUG >= 7: _db_connection.set_trace_callback(print)
|
||||
diskcache_put("meta", "version", VERSION)
|
||||
return _db_connection
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ class Interpreted:
|
|||
|
||||
ret = _interpret_ast(ast)
|
||||
src = '\n'.join(['def run(inputs):'] + lines + [f" return {gstr(self.from_underlying, 'from_underlying')}({ret})" if self.from_underlying else f" return {ret}"])
|
||||
if DEBUG >= 4: print(functools.reduce(lambda x,y: (x.replace(y[0], str(y[1])) if y[0][0:2] == "m0" else x), tglob.items(), src))
|
||||
if DEBUG >= 4 and self != InterpretedFlopCounter: print(functools.reduce(lambda x,y: (x.replace(y[0], str(y[1])) if y[0][0:2] == "m0" else x), tglob.items(), src))
|
||||
exec(compile(src, "<ast>", "exec"), tglob) # pylint: disable=exec-used
|
||||
return tglob['run']
|
||||
|
||||
|
|
Loading…
Reference in New Issue