pub struct GraphExecutor { /* private fields */ }Expand description
Batched Metal dispatch — encodes multiple ops into a single CommandEncoder.
Create one per model (or per forward-pass loop). Call begin
at the start of each forward pass to get a GraphSession that holds the
shared encoder.
Implementations§
Source§impl GraphExecutor
impl GraphExecutor
Sourcepub fn begin(&self) -> Result<GraphSession<'_>>
pub fn begin(&self) -> Result<GraphSession<'_>>
Begin a new forward pass (direct-dispatch mode).
Returns a GraphSession that holds a fresh CommandEncoder. All ops
encoded through the session share this single encoder. Call
GraphSession::finish to commit and wait.
Sourcepub fn begin_recorded(&self) -> Result<GraphSession<'_>>
pub fn begin_recorded(&self) -> Result<GraphSession<'_>>
Begin a new forward pass in capture (record) mode.
All op calls are recorded into a ComputeGraph instead of being
dispatched to Metal. When GraphSession::finish is called, the
recorded graph is replayed into a fresh encoder via
ComputeGraph::encode_sequential().
The API is identical to begin() — callers do not need to change
any op call code. The only behavioral difference: GPU work happens
at finish() time rather than at each op call.