Files
tinygrad/viz/spec.py
qazal 5517a07a09 viz late to_program and benchmarks [pr] (#6851)
* viz late to_program [pr]

* benchmark resnet

* delete all of checkStatus

* revert that

* fixup

* get from kernel
2024-10-03 18:29:04 +08:00

27 lines
949 B
Python

from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple
@dataclass(frozen=True)
class GraphRewriteMetadata:
"""Specifies metadata about a single call to graph_rewrite"""
loc: Tuple[str, int]
"""File_path, Lineno"""
code_line: str
"""The Python line calling graph_rewrite"""
kernel_name: Optional[str]
"""The kernel calling graph_rewrite"""
upats: List[Tuple[Tuple[str, int], str]]
"""List of all the applied UPats"""
@dataclass(frozen=True)
class GraphRewriteDetails(GraphRewriteMetadata):
"""Full details about a single call to graph_rewrite"""
graphs: List[Dict[int, Tuple[str, str, List[int], str, str]]]
"""Sink at every step of graph_rewrite"""
diffs: List[List[str]]
""".diff style before and after of the rewritten UOp child"""
changed_nodes: List[List[int]]
"""Nodes that changed at every step of graph_rewrite"""
kernel_code: Optional[str]
"""The program after all rewrites"""