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
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Baracuda dispatch-telemetry / miss-reporting **emission** layer.
//!
//! This is the emission half of the Fuel↔Baracuda boundary (the tensor-
//! description half is FDX; the kernel-advertisement half is FKC). It does NOT
//! retain timings — the Judge already retains per-`(op, dtype, size_class,
//! backend, kernel_source)` latencies including losers. This module turns that
//! retained data, plus the planner's own contract-matching outcome, into a
//! `DispatchRecord` / `MissRecord` JSONL feed for Baracuda's AOT kernel-
//! specialization matrix.
//!
//! Design: `docs/session-prompts/baracuda-telemetry-plan.md`. Behind the
//! `telemetry` cargo feature; default builds are untouched, and **no record is
//! ever written unless emission is explicitly enabled** (the opt-in flag, a
//! later step). The JSONL *sink* (file writer + on-disk path, [`judge_sink`])
//! moved here from `fuel-core` (fuel-core dissolution, plan item 8) once its
//! two preconditions — the `ProfileJudgeOracle` adapter and the report's
//! cache-dir path — moved out of `fuel-core::judge` ahead of it
//! ([`crate::ranker::profile_oracle`], [`crate::judge_report_path`]). This
//! crate now owns the record types, the key derivation, AND the sink.
// ⚠️ TWO GATES, DELIBERATELY DIFFERENT SCOPES. Do not unify them.
//
// COMPILE-VISIBILITY (here) -> `baracuda-types`
// RUNTIME-SELECTION -> `cuda`: [`judge_sink::TelemetryInstall::new`]
// picks `BaracudaStructureKeyProvider` vs
// `NullStructureKeyProvider` as a cfg-selected
// struct field on THIS crate's `cuda` flag.
// (Moved in from `fuel-core/src/telemetry.rs`,
// fuel-core dissolution plan item 8 — selection
// lived in a different crate from this gate
// when this comment was first written; it now
// lives in the same crate, same reasoning.)
//
// The provider is pure host code — a keying function over operand descriptors
// in `baracuda-kernels-types`, no FFI and no device — so `baracuda-types` is
// exactly what it needs to COMPILE. It was gated on `cuda`, which additionally
// pulls `fuel-cuda-backend` and therefore the kernel forge, so this file could
// only be type-checked at the cost of a full forge build (measured 1h51m cold,
// ~14s narrowed). That is why an `E0004` here survived an entire dtype sweep:
// no gate anyone runs could afford to compile it. (GAP-173.)
//
// Narrowing the COMPILE gate must not widen SELECTION: a CPU-only build that
// started emitting real baracuda structure keys for an arch it is not running
// would be a WRONG signal, and this module's posture is that no signal beats a
// wrong one. That separation is structural rather than careful — selection is
// gated on `cuda` here specifically so widening the COMPILE gate above cannot
// reach it. The `pub use` below stays on `cuda` for the same reason.
pub use BaracudaStructureKeyProvider;
pub use ;
pub use TelemetryHooks;
pub use ImplId;
pub use ;
pub use ;
pub use ;
pub use TelemetrySink;
pub use ;