TraceToGraphBuilder
Shared builder to convert OpTrace streams into a ComputeGraph. Used by both GraphSink (online) and DefaultExecutionTape.toComputeGraph() (offline).
Deterministic ID policy (FR7):
Node IDs: sequential per builder instance using insertion order, formatted as: "n
_ " Example: n0_Add, n1_Relu. This ensures stability for a given trace ordering. Edge IDs: derived from endpoints and port indices, formatted as: "e_
__ " Example: e_n0_Add_0__n1_Relu_0. This is deterministic given the node IDs and wiring.
By default this builder does NOT synthesize explicit "input" placeholder nodes for tensors without a known producer. Call finalize after adding all traces to synthesize "input" and "weight" constant nodes for unresolved external inputs. This is required for StableHLO compilation where every operand must be wired through graph edges.