diff --git a/skainet-compile/skainet-compile-dag/src/commonMain/kotlin/sk/ainet/lang/graph/exec/GraphExecutionContext.kt b/skainet-compile/skainet-compile-dag/src/commonMain/kotlin/sk/ainet/lang/graph/exec/GraphExecutionContext.kt index c52a076b..e20ee89c 100644 --- a/skainet-compile/skainet-compile-dag/src/commonMain/kotlin/sk/ainet/lang/graph/exec/GraphExecutionContext.kt +++ b/skainet-compile/skainet-compile-dag/src/commonMain/kotlin/sk/ainet/lang/graph/exec/GraphExecutionContext.kt @@ -28,9 +28,10 @@ public interface GraphExecutionContext : ExecutionContext, TrainingExecutionCont public val tapeStack: TapeStack /** - * Whether operations should be recorded + * Whether operations should be recorded. Overrides [ExecutionContext.isRecording] so modules + * can route eager-vs-trace without depending on the graph module. */ - public val isRecording: Boolean get() = currentTape?.isRecording == true + override val isRecording: Boolean get() = currentTape?.isRecording == true /** diff --git a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ExecutionContext.kt b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ExecutionContext.kt index acca44e6..042cf722 100644 --- a/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ExecutionContext.kt +++ b/skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/context/ExecutionContext.kt @@ -23,6 +23,15 @@ public interface ExecutionContext { public val phase: Phase public val inTraining: Boolean get() = phase == Phase.TRAIN + /** + * Whether this context is currently *recording* a trace/graph (vs. plain eager execution). + * Defaults to `false` (eager); the graph/tape context overrides it. Modules with an eager + * fast-path that bypasses `ops.*` (e.g. RoPE's raw-array interleaved rotation) can check this + * to emit a graph-traceable `ctx.ops.*` path instead when recording, so they export to + * StableHLO while keeping the fast path for eager inference. + */ + public val isRecording: Boolean get() = false + public val tensorDataFactory: TensorDataFactory /**