Documentation
¶
Index ¶
- Constants
- func ActiveRev() uint64
- func CaptureEnabled() bool
- func ClearActive()
- func EnableCapture()
- func Register(api *echo.Echo)
- func SetActive(c *Collector)
- type Collector
- func (c *Collector) DebugPrint(u ui.UI)
- func (c *Collector) Export() TraceData
- func (c *Collector) Freeze()
- func (c *Collector) Frozen() bool
- func (c *Collector) NewInput(label string, shape []int) ValueID
- func (c *Collector) Pop()
- func (c *Collector) Push(name string)
- func (c *Collector) RecordOp(kind, label, path string, inputs []ValueID, ...) ValueID
- func (c *Collector) SetGroupLabel(group string)
- func (c *Collector) SetName(name string)
- type DAG
- type DAGEdge
- type DAGNode
- type Op
- type TraceData
- type ValueID
Constants ¶
const TraceVersion = 1
TraceVersion is the canonical trace JSON schema version.
Variables ¶
This section is empty.
Functions ¶
func CaptureEnabled ¶
func CaptureEnabled() bool
CaptureEnabled reports whether graph capture was requested.
func ClearActive ¶
func ClearActive()
ClearActive removes the published graph and notifies graph UI clients.
func EnableCapture ¶
func EnableCapture()
EnableCapture allows model code to record graph traces (e.g. from --graph).
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector stores a stable graph and emits op events from real compute passes.
func NewCollector ¶
func NewCollector() *Collector
func (*Collector) DebugPrint ¶
DebugPrint writes trace JSON and derived DAG JSON to u.
func (*Collector) RecordOp ¶
func (c *Collector) RecordOp(kind, label, path string, inputs []ValueID, inShape, outShape, weightShape []int) ValueID
RecordOp records one forward op and returns its output value id.
func (*Collector) SetGroupLabel ¶
SetGroupLabel sets the grouped block base label (e.g. "transformer block").
type DAG ¶
type DAG struct {
Name string `json:"name,omitempty"`
GroupLabel string `json:"group_label,omitempty"`
Nodes []DAGNode `json:"nodes"`
Edges []DAGEdge `json:"edges"`
}
DAG is a derived view of TraceData for visualization.
type DAGNode ¶
type DAGNode struct {
ID string `json:"id"`
Kind string `json:"kind"`
Label string `json:"label,omitempty"`
Path string `json:"path,omitempty"`
Scope string `json:"scope,omitempty"`
Shape []int `json:"shape,omitempty"`
WeightShape []int `json:"weight_shape,omitempty"`
}
DAGNode is one vertex in the derived dataflow graph.
type Op ¶
type Op struct {
ID string `json:"id"`
Kind string `json:"kind"`
Label string `json:"label,omitempty"`
Path string `json:"path,omitempty"` // layout hint: attn, ffn, residual
Scope string `json:"scope,omitempty"`
Inputs []ValueID `json:"inputs,omitempty"`
Output ValueID `json:"output,omitempty"`
InShape []int `json:"in_shape,omitempty"`
OutShape []int `json:"out_shape,omitempty"`
WeightShape []int `json:"weight_shape,omitempty"`
}
Op is one step in the execution trace (input, linear, add, ...).