fn
compile_trace
→CompiledExecutable*CompiledExecutable * compile_trace(const TraceGraph & graph, const int & external_feeds, int * error_msg)Lower graph into an MPSGraph executable.
Parameters
graphconst TraceGraph&The trace IR returned by
Tracer::graph().external_feedsconst std::unordered_map<TensorId, TensorImplPtr>&The trace's external feeds (model parameters + user inputs), mapped by the
TensorId minted during Tracer::on_op_io. Each entry becomes one MPSGraph placeholder, and the corresponding TensorImplPtr carries the runtime data that will be bound to that placeholder.error_msgstd::string*= NoneIf non-null, populated with a human-readable reason whenever the build aborts (unsupported op, mixed-device trace, dtype mismatch, …).
Returns
CompiledExecutable*Heap-allocated executable handle on success, or nullptr on any abort condition (caller falls back to eager dispatch). Caller owns the returned pointer.
Notes
Phase 1.2 step 1 supports only Linear forward in the emitter
registry; everything else returns nullptr cleanly. The op gap
protocol (per-op spike → expand coverage incrementally) is the
canonical way new families come online.