Operator Graph

Importable from syssim. The traced intermediate representation of a model step. Advanced — needed only when inspecting or building graphs directly.

class OperatorType

Enum of operator categories: GEMM, ATTN, MATH (compute); COLLECTIVE (communication); MEMORY; BARRIER, STREAM_SYNC (sync).

class TensorMeta(shape, dtype, device)

Frozen dataclass describing a tensor: shape (tuple), dtype (str), device (str).

to_dict()

Serialize to {"shape": [...], "dtype": ..., "device": ...}.

class OperatorNode(name, op_type, config=None, predecessors=None, stream_id=0, device_id=0, inputs=None, outputs=None, estimated_time_ms=0.0)

A single node in the graph. predecessors lists same-stream FIFO and cross-stream sync dependencies; inputs/outputs are lists of TensorMeta.

to_dict()

Serialize all fields to a dict.

class OperatorGraph(name='model')

DAG of OperatorNode with multi-stream critical-path analysis. Holds operators (dict by name) and streams (set of stream ids); len(graph) is the operator count.

add_operator(node)

Add an OperatorNode to the graph.

validate()

Validate the DAG: reference integrity and cycle detection (DFS coloring).

topological_sort()

Kahn’s algorithm; cached until the graph is modified.

to_json()

Serialize the graph to JSON.

to_dot()

Graphviz DOT representation, color-coded by op type.

summary()

Human-readable summary of op counts and total time.