bring viz to core (#6970)

* move viz to core

* pathfix

* move test_viz to core

* cleanup test_viz diff

* use contextvars
This commit is contained in:
qazal
2024-10-10 16:56:26 +03:00
committed by GitHub
parent fad575ec76
commit 3481468702
6 changed files with 2 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ import itertools
from tinygrad import Tensor, dtypes
from tinygrad.helpers import Context, getenv
from tinygrad.engine.realize import lower_schedule
from viz.serve import GraphRewriteMetadata, get_metadata, _uop_to_json
from tinygrad.viz.serve import GraphRewriteMetadata, get_metadata, _uop_to_json
from tinygrad.ops import TRACK_MATCH_STATS, TrackedPatternMatcher, UPat, UOps, UOp, graph_rewrite, contexts, track_rewrites
def group_rewrites(kernels:List[GraphRewriteMetadata]): return {k:list(v) for k,v in itertools.groupby(kernels, lambda x:x.loc)}

View File

@@ -638,7 +638,7 @@ if TRACK_MATCH_STATS:
pickle.dump(contexts, f)
if getenv("VIZ"):
os.environ["VIZ"] = "0"
os.execv(sys.executable, [sys.executable] + [os.path.join(os.path.dirname(__file__), "..", "viz", "serve.py")])
os.execv(sys.executable, [sys.executable] + [os.path.join(os.path.dirname(__file__), ".", "viz", "serve.py")])
if getenv("PRINT_MATCH_STATS", 1):
ret = [0,0,0.0,0.0]
for k,v in sorted(list(match_stats.items()), key=lambda x: x[1][2]):

View File

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 750 B