pub fn build_op_template_scope_kernel(
op: &ParsedOp,
parent_manifest: &[ManifestEntry],
parent_kernel: &ScopeKernel,
workload_params: &HashMap<String, String>,
polydat_lib_paths: Vec<PathBuf>,
workload_dir: Option<&Path>,
strict: bool,
kernel_opt: KernelOptLevel,
context: &str,
) -> Result<ScopeKernel, String>Expand description
SRD-13d Phase 9 — synthesize a per-op-template kernel for a materialised op-template scope.
Mirrors build_do_loop_scope_kernel but uses the op’s
bindings: block (which already carries metric := injections
per SRD-40b §1) as the body. The resulting kernel:
- Emits an
extern <name>: <type>for every parent-visible name the op explicitly references — and only those, so the op-template kernel stays narrow. - Validates each reference against the SRD-13c cross-scope
visibility contract:
Input,SharedOutput, orConstantOutputare accepted;DynamicOutputerrors at workload-init time with a clear message pointing at thesharedmodifier path. - Emits the op’s own bindings.
- Builds the scope under the parent kernel and propagates
inherited inputs. The scope keeps its module, from which each
fiber instantiates its per-op kernel with the module’s
result:write-throughs (crate::fiber_engine).