Skip to main content

Module scope_synth

Module scope_synth 

Source
Expand description

Scope-construction substrate for nmbrs-runtime.

Module name disambiguates from the pre-existing crate::synthesis (which handles fiber/op synthesis). Here we handle scope synthesis — turning workload-shape intent (a comprehension, a do-loop, a phase, an op template) into a child polydat::kernel::PolydatKernel.

This module hosts the walking + Surface #7 helpers + scope- builder functions that drive polydat::kernel::subcontext::SubcontextBuilder to materialize new scope kernels. See polydat/docs/design/comprehension_cutover_contact_surfaces.md for the architectural framing.

§What’s here

  • helpers — Surface #7: pure utilities for turning typed values, workload-param strings, and PortType variants into Polydat source literals / extern type names. Also the placeholder scanner used by every scope-builder walk.

§What’s planned (PR 9c-1b in progress)

  • cascade — the shared cascade-extern walker that the four sister scope builders (build_phase_scope_kernel, build_do_loop_scope_kernel, build_op_template_scope_kernel, and the forthcoming build_for_each_scope_kernel) will consume in lieu of each reinventing the same walk.
  • for_each — the comprehension-specific iter-var emission + shared cascade walker invocation that replaces polydat::iteration::comprehension::synthesize_for_each_scope.

§What lives in scope.rs for now

build_phase_scope_kernel, build_do_loop_scope_kernel, build_op_template_scope_kernel. These will migrate into this module (and refactor onto the shared cascade walker) as part of the same push.

Re-exports§

pub use cascade::CascadeInputs;
pub use cascade::CascadeOutputs;
pub use cascade::cascade_parent_into_source;
pub use cascade_emit::emit_workload_param_chain_aware;
pub use for_each::build_for_each_scope_kernel;
pub use helpers::collect_leaf_placeholders;
pub use helpers::format_value_as_final_literal;
pub use helpers::format_value_as_polydat_literal;
pub use helpers::format_workload_param_as_polydat_literal;
pub use helpers::port_type_to_extern_name;
pub use helpers::scan_one;
pub use helpers::value_to_param_string;
pub use helpers::workload_param_type_name;

Modules§

cascade
Shared cascade walker — the single implementation of “given a parent kernel, decide what cascade-extern and inline-const lines to emit for a child scope’s Polydat source.”
cascade_emit
Cascade-extern emission helpers — building blocks the scope builders use to push individual lines of Polydat source into a string that’s later folded into a polydat::kernel::subcontext::PolydatMatter and handed to the builder.
for_each
build_for_each_scope_kernel — synthesize the kernel for a for-each scope.
helpers
Surface #7 helpers — pure utilities for translating between typed runtime values and Polydat source-text form.