Skip to main content

Module runtime_fused_pathfinder

Module runtime_fused_pathfinder 

Source
Expand description

Runtime-fused-op arm pathfinder — the match-finder crate::runtime_fused_arm’s module doc names as its remaining half: “the pathfinder that finds matches + splices reconverge points registers it into optimize_graph.” This module is that pathfinder.

For every op adopted at runtime (JIT-synthesized or import-time), it scans the base map for subgraphs whose shape matches the op’s region (fuel_graph::jit::match_region) and offers each match as a gated Op::Branch via offer_runtime_fused_arm — arm 0 stays the region’s existing primitive subgraph (the correctness oracle), arm 1 is the synthesized kernel, offered only when fused_kernel_available_in gates it open (reading the OptimizationContext-threaded binding table, never re-acquiring the global lock). Same constitutional posture as crate::decode_flash: the optimizer emits/prunes arms, backends never decide, and a graph with no adopted runtime op (or no structural match) is left byte-identical.

v1 scope mirrors fuel_graph::runtime_fused’s own v1 note: every offered arm is pinned to BackendId::Cpu. A runtime op can be adopted for multiple backends (adopt_runtime_fused is called once per backend), so picking the right one — and potentially offering more than one fused arm per match — is a follow-up; see the module-level “unsure” note in the session report.

Structs§

RuntimeFusedArmPathfinder
The registered Pathfinder wrapper around emit_runtime_fused_arms. Ignores ctx’s ranked plan / dispatch order: a runtime-op region match is a purely structural question over the whole base map, independent of placement — the same reason crate::decode_flash’s arm is emitted by a dedicated call site rather than reading ctx.plan.

Functions§

emit_runtime_fused_arms
Scan graph for subgraphs matching an adopted runtime fused op’s region and offer each as a gated Op::Branch (see offer_runtime_fused_arm). Returns the number of arms emitted — 0 for a graph with no adopted runtime op, or none whose region structurally matches anywhere in it.