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
// transcribe-flash-policy.h - shared flash-attention policy helpers.
//
// INTERNAL. C++17. Consumed only from other .cpp files inside src/.
// Not part of the public include/transcribe.h ABI.
//
// Flash-attention support in ggml is per-backend and per-head-dim.
// Each family picks its own defaults based on encoder/decoder head
// dimensions and which backend it was loaded on.
//
// The "which backend" half of that decision now lives in
// transcribe-backend.h as BackendKind — families check
// `plan.primary_kind == BackendKind::Metal` directly instead of
// calling a helper here.
//
// What stays in this header is the one cross-family concern that is
// not backend-classification: honoring the TRANSCRIBE_NO_FLASH /
// TRANSCRIBE_FORCE_FLASH environment overrides. These are a global
// "no flash anywhere" / "flash everywhere" debug lever, not a
// per-family policy knob.
//
// The default on/off decision itself is still per-family: it
// depends on the family's head dim (cohere encoder=160 unsupported
// on Metal, cohere decoder=128 supported; parakeet encoder=128
// supported). Extracting that decision here would paper over a real
// architectural difference.
namespace transcribe::flash // namespace transcribe::flash