Expand description
Runtime-fused-op arm emission — the gated Op::Branch that makes an adopted
(JIT-synthesized / imported) fused op reachable, mirroring crate::decode_flash.
Same constitutional posture as the flash arm: the optimizer emits/prunes arms;
backends never decide. Arm 0 is the region’s existing primitive subgraph
(the decompose / correctness oracle the graph already holds); arm 1 is the
synthesized Op::Fused(runtime_id, Runtime) kernel, offered only when a
kernel is bound for the target backend (fused_kernel_available_in) and pinned
to that backend. finalize_branches guarantees the merge reads arm 0, so a
finalized-but-unpicked graph — and every backend with no synthesized arm —
realizes on the primitive route, byte-identical. The route picker chooses arm 1
when it wins; the kernel resolves from the FusedOpId-keyed runtime sidecar.
Unlike the flash arm (emitted at graph-build by the decode builder), a runtime
fused op is synthesized after load, so this arm is emitted during
(re-)optimization — a pathfinder scans the base map for regions matching an
adopted op and calls this per match. This module is the emitter; the pathfinder
that finds matches + splices reconverge points registers it into optimize_graph.
Structs§
- Runtime
Fused Spec - A matched runtime-fused region the optimizer offers as an arm candidate. Arm 0
(
primitive_sink, the region’s existing output) is already in the graph; this describes how to build arm 1 (the fused kernel) and where to splice the branch.
Functions§
- offer_
runtime_ fused_ arm - Offer a runtime-fused
Op::Brancharm for an adopted op, gated on kernel availability. ReturnsOk(Some(branch))when the arm is emitted,Ok(None)when the gate declines (no kernel forbackend→ no arm; the region stays on arm 0’s primitives). Never a realize-time decision — the capability gate and the backend pin happen here, in the optimizer.