mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-02-10 14:45:35 -05:00
* viz late to_program [pr] * benchmark resnet * delete all of checkStatus * revert that * fixup * get from kernel
27 lines
949 B
Python
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"""
|