Skip to main content

Module scan

Module scan 

Source
Expand description

unroll_scan: materialize a bounded crate::Op::Scan into real primitive nodes on demand. Used as (a) the FKC/Spec-B numeric oracle and (b) the fallback lowering for a backend without a scan kernel. NOT registered as anyone’s .decompose — Op::Scan is a bare primitive that stays terminal in the base map.

Structs§

ScanLayout
The parsed input layout of an Op::Scan node — the fields the early-exit step driver needs, extracted from the trailing-input encoding.
ScanStep
One materialized scan step: the post-step carry, the emitted y, and the (optional) realized stop predicate node for this step.

Functions§

build_scan_step
Materialize one step of a scan at step index t with the given carry NodeId. Slices each xs[i] at [t, t+1) (squeezed), clones body_new_carry / body_y / pred_exit with a single shared substitution map so that a pred_exit referencing body_new_carry resolves to this step’s new carry (no double-clone). Returns the post-step carry, y, and the optional stop predicate node.
parse_scan_layout
Parse an Op::Scan node’s trailing-input layout. Mirrors the parse in unroll_scan, including the early_exit-aware trailing count, but yields a struct the step driver can drive one step at a time. Returns a typed Err for a non-Op::Scan node or a malformed (too-short) input layout.
unroll_scan
Unroll steps iterations of the Op::Scan at scan_id into primitives.