ComputeGraphExecutor

Executes an optimized ComputeGraph by walking nodes in topological order and dispatching each operation through TensorOps.

For standard operations (matmul, add, relu, etc.), the executor delegates to the corresponding TensorOps method. For fused operations produced by optimization passes (e.g., fused_rms_norm, fused_swiglu_ffn, fused_qkv_proj), the executor looks up a registered FusedOpHandler or falls back to decomposing the fused op into its constituent operations.

Usage:

val executor = ComputeGraphExecutor(optimizedGraph, cpuOps)
val outputs = executor.execute(mapOf("input" to inputTensor))

Parameters

graph

The optimized compute graph to execute

ops

The tensor operations backend (CPU, Metal, CUDA)

Constructors

Link copied to clipboard
constructor(graph: ComputeGraph, ops: TensorOps)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun <T : DType, V> execute(inputs: Map<String, Tensor<T, V>>): Map<String, Tensor<T, V>>

Execute the graph with the given external inputs.