Skip to main content

build_op_template_scope_kernel

Function build_op_template_scope_kernel 

Source
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:

  1. Emits an extern <name>: <type> for every parent-visible name the op explicitly references — and only those, so the op-template kernel stays narrow.
  2. Validates each reference against the SRD-13c cross-scope visibility contract: Input, SharedOutput, or ConstantOutput are accepted; DynamicOutput errors at workload-init time with a clear message pointing at the shared modifier path.
  3. Emits the op’s own bindings.
  4. 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).