1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// SPDX-License-Identifier: MIT OR Apache-2.0
//! # fuel-dispatch
//!
//! Dispatch infrastructure for fuel — extracted from fuel-storage
//! 2026-05-31 per the picker-work phasing
//! ([docs/session-prompts/dispatch-move-to-fuel-core.md](
//! ../../docs/session-prompts/dispatch-move-to-fuel-core.md)).
//!
//! ## What lives here
//!
//! - **`KernelBindingTable` + registration wrappers** — backends
//! register their per-`(op, dtypes, BackendId)` kernels into a
//! process-wide table. The picker / optimizer queries this table
//! to enumerate candidate alternatives at each graph decision point.
//! - **`CompiledNode` + `compile_node`** — the dispatch-time
//! `(KernelRef, KernelCaps, OpParams)` resolution result that the
//! executor invokes.
//! - **`ExecutionPlan` + `compile_plan` + `PlanOptions`** — Phase
//! 1.5 reshape of the plan-time picker around per-decision-point
//! `AlternativeSet`s. Replaced the pre-1.5 `NodeKernelBinding`/
//! `TolerancePolicy`/`resolve_kernel` triple (which had zero
//! executor consumers; the verified-empty consumer list let the
//! rewrite ship without breakage).
//! - **`FusedKernelRegistry`** + `PrecisionGuarantee` +
//! `KernelRevisionHash` — fused-op dispatch substrate.
//! - **`PipelinedExecutor`** — the production executor that walks a
//! graph, calls `compile_node` per kernel-bearing node, and runs
//! the resolved `KernelRef` against the input/output Storage Arcs.
//! - **Cost functions** — Layer-1 static cost estimates per op
//! family; the optimizer composes these along candidate routes.
//! - **Cast fusion rule** — cast-elision graph rewrite (lives near
//! dispatch because it inspects binding-table coverage).
//!
//! ## What's NOT here
//!
//! - `BackendStorage` enum + `Storage` wrapper — stays in `fuel-storage`
//! until retired via Phase 0.2c (move to `fuel-core-types`).
//! - `SystemTopology` + `Judge` + `ProbeReport` — stays in `fuel-core`
//! today; Phase 1's optimizer ranker will decide whether to relocate.
//! - Backend-specific kernels themselves — those live in their backend
//! crates (fuel-cpu-backend, fuel-cuda-backend, fuel-vulkan-backend).
//! This crate hosts the dispatch *wrappers* that bridge erased
//! `Storage` ↔ typed backend storage.
// GAP-229: `clippy::identity_op` fires 128x across fuel-core+fuel-dispatch and is a
// defect in 0 of 128 — it measures a house idiom, not debt, so it is allowed at the
// crate root (a MEASURED claim: "identity ops in THIS crate are intentional"; a firing
// in a third crate is a deliberate TRIPWIRE — it reds the gate so someone looks and rules).
// Two intentional classes:
// * DOC-INDEX: an explicit `0 *`/`1 *` NAMES an index (`idx[i*nb + 0]`, `got[1*head_dim + j]`);
// the `0 *` partner is separately load-bearing (CLAUDE.md: never delete it), so its `1 *`
// sibling must survive too — auto-fixing it would strand a bare unexplained `0 *`.
// * DOC-SHAPE: an explicit unit/batch dim in a shape product (`1 * C * H * W`) mirrors
// `Shape::from_dims(&[1, C, H, W])`.
// RESIDUAL, named not gated: this ALSO hides FLOAT identity ops, where `x + 0.0` normalizes
// -0.0 -> +0.0 — a real hazard whose population is ZERO today (measured). A float identity op
// landing later is silently admitted; re-measure at the next rust-toolchain.toml pin bump
// (owner-tracked, docs/gaps.md GAP-229) and drop this allow if precision is no longer 0/N.
// GAP-242. `fuel_memory::BackendStorage` gates EVERY non-CPU variant behind a
// feature -- `Cuda` on `cuda`, `Vulkan` on `vulkan`, `Metal` on `metal` plus an
// Apple target -- so with all backend features OFF the enum has exactly ONE
// variant and every `if let BackendStorage::Cpu(..)` in this crate is
// irrefutable BY CONSTRUCTION rather than by mistake.
//
// MEASURED at head 2026-08-27, `cargo clippy -p fuel-dispatch --all-targets`:
// 109 sites, ALL of them `BackendStorage::Cpu`
// 103 pipelined.rs · 2 compiled.rs · 2 kernel.rs · 1 residency.rs
// 1 dispatch.rs -- every one in `src/`, so this crate attribute
// reaches all of them
// 0 sites under `--features vulkan --all-targets`
// The class is ABSENT when any backend feature is on, not merely quieter, and
// the site count is re-derivable from those two commands.
//
// NOT REWRITTEN, deliberately. There is no correctness gain, and the enum's
// arity is `cfg`-controlled: an edit that is correct for the configuration it
// was compiled in can break a different feature set. `--fix` on this lint
// rewrites control flow, which is exactly that hazard.
//
// NOT `#[expect]`, and the reason is specific to this lint rather than
// inherited: an expectation must be fulfilled in EVERY compilation, and this
// class does not fire at all under any backend feature (measured: 0). A crate
// `#[expect(irrefutable_let_patterns)]` would therefore be UNFULFILLED on every
// build that enables `vulkan` or `cuda` -- including CI's `--workspace` job,
// which enables `fuel-dispatch/vulkan`. It would trade 109 warnings in one
// configuration for 1 in all the others.
//
// This allow is honest only because CI now runs a DEFAULT-FEATURES
// `clippy -p fuel-dispatch --all-targets` leg. Without that leg it would
// silence a lint no gate was running; with it, it is a documented exception
// inside a gate that is watching. Those are different artifacts wearing the
// same syntax.
//
// `unreachable_patterns` rides along for the SAME reason and is the stronger
// case of the two. `pipelined.rs:8969` is a `match` on `BackendStorage` with a
// `Cpu(c) => ..` arm and a `_ => panic!("expected CPU output")` catch-all; with
// the enum single-variant the `_` is unreachable. But that arm is REQUIRED the
// moment any backend feature is on -- "fixing" the lint means deleting it,
// which breaks the `vulkan` build outright. Measured: 1 site at default
// features, 0 under `--features vulkan --all-targets`.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use PipelinedExecutor;
pub use ;
pub use ;
pub use ;