Expand description
Kernel-seam JIT — the Fuel-side projection + structural matcher
(kernel-seam-interop §5; fkc-fusion-patterns §3/§3a). The frozen grammar
types (OpTag, OpAttrs, PatternNode) live in
fuel_kernel_seam_types and are re-exported here; this module holds the
two parts that need the graph: the Op -> OpTag projection op_to_tag
and the structural matcher match_region (the declarative-fusion engine
behind PatternKind::Declarative).
One PatternNode serves the JIT region (Fuel -> synthesizer, “build a
kernel for this subgraph”), a contract’s pattern: re-fuse rule, and a
synthesized op’s decompose (the region re-emitted).
Structs§
- OpAttrs
- Non-tensor attributes a
PatternNode::Opcarries (fkc-fusion-patterns §3a.4; Baracuda reconcile §2). For scalar-param ops the value is not baked — it identifies the slot the emittedextract:path points at, and the matcher re-reads the live value from the matched graph node at match time. Carries the load-bearing attributes the general vocabulary needs.
Enums§
- OpTag
- The §4.1 graph-
Opvocabulary, functional ops only — the stable op identifier aPatternNodecarries. Excludes in-place variants (a region is the functional subgraph; in-place is a Fuel-side scheduling rewrite) and structural / bookkeeping ops (Const,Release,Alloc, views, …). TheOp -> OpTagprojection (op_to_tag) lives Fuel-side (it needs the graphOp); the inverse — which params an emitted op carries — ridesOpAttrs+ theextract:path. - Pattern
Node - A node of the §3 declarative subgraph grammar. One type, two directions: a
region (Fuel -> synthesizer) populates
Op { op, operands, attrs }+Bind; an emittedpattern:(synthesizer -> Fuel) additionally carries the consumer/extractrouting the matcher compiler reads.SeeThrough/Anyare matcher-only and never appear in a concrete region.
Functions§
- match_
region - Match a declarative region
PatternNodeagainst the graph rooted atroot(the subgraph sink, §3a.1). Returns the region’s external inputs inbind-index order on a match, orNone. This is the structural core of the declarative matcher (PatternKind::Declarative); the §5guard:/extract:layers and thesee_through-set wrappers compose on top. - match_
region_ extract match_regionplus theextract:layer (FKC §5.3): alongside the bound inputs, return the matched region’s live scalar values — one entry per scalar a slot pattern node left open (a scalar-carrying op whose patternattrs.scalarsis empty/wildcard), read from the matched graph node, in pattern pre-order (the canonical slot order the recipe’s re-emit and a synthesized kernel’s trailingp{i}launch args both use). A pattern node with baked scalars is a constant of the pattern (the attr guard enforced equality), not a slot, and extracts nothing. A slotless region extracts[].- op_
to_ tag - Project a graph
Opto its functionalOpTag. ReturnsNonefor in-place variants, structural/bookkeeping ops, andOp::Fused(a fused op isn’t a region node — its decomposition is). Same forOp::Scan/Op::ScanPlaceholder: a scan isn’t a region node either — its body (referenced viainputs, not aPatternNode) is what a region walk would see. ANoneop in a region is an honest “outside the vocabulary” miss, never a crash.