fuel-dispatch 0.20.0

Dispatch infrastructure for fuel: KernelBindingTable, per-backend registration wrappers, CompiledNode + compile_node, ExecutionPlan + compile_plan + resolve_kernel, FusedKernelRegistry, PipelinedExecutor. The layer that takes a graph and runs it against registered backends. Extracted from fuel-memory 2026-05-31.
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
// SPDX-License-Identifier: MIT OR Apache-2.0
//! The built-in Vulkan backend's FKC `link_registry` (kernel-seam-interop §3.5,
//! §4.3; FKC §12.6). The GPU analogue of [`crate::fkc::CpuLinkRegistry`]: maps
//! each Vulkan kernel contract's `entry_point` symbol to the production dispatch
//! wrapper — the real, non-stub resolution the importer uses so an imported
//! contract binds the **actual** kernel (no raw pointers in the serialized
//! contract, FKC P9).
//!
//! For the built-in Vulkan backend the wrappers live in
//! [`crate::vulkan_dispatch`] (the dispatch layer that adapts the Slang/SPIR-V
//! byte-kernels to [`KernelRef`]) and this table co-locates with them in
//! fuel-dispatch. An *external* provider instead exports its own link registry
//! across the FFI; this is Fuel's internal Vulkan-provider analogue.
//!
//! Everything here is gated behind the `vulkan` cargo feature — the DEFAULT
//! build never compiles this module.

use crate::fkc::lower::LinkRegistry;
use crate::kernel::KernelRef;

/// One `(contract entry_point symbol, production wrapper)` pair. The symbol
/// matches the contract's `entry_point: "fuel_vulkan_backend::fkc::<name>"`.
/// Unlike the CPU `ep!` macro (which builds `<op>_<dt>` from two literals),
/// Vulkan cast sections name their symbol in full (`cast_<src>_to_<dst>`), so
/// this macro takes the bare symbol name + the fully-qualified wrapper path.
macro_rules! vk_ep {
    ($sym:literal, $wrapper:path $(,)?) => {
        (
            concat!("fuel_vulkan_backend::fkc::", $sym),
            $wrapper as KernelRef,
        )
    };
}

/// The Vulkan cast (dtype-conversion) family's `symbol → production wrapper`
/// map — the FULL family: 12 (SRC, DST) pairs resolving to 3 production
/// wrappers. Contract: `docs/kernel-contracts/vulkan/cast.fkc.md`. Each per-pair
/// section (`## cast_f32_to_f16`, …) declares a SPECIFIC single-dtype `src`
/// input + a `fixed(DST)` output, so none of them dtype-fan — the importer
/// resolves that symbol AS-IS and keys `[SRC, DST]` (input dtype + the output's
/// fixed dtype), byte-for-byte the deleted hand-written
/// `table.register_with_precision(OpKind::Cast, &[src, dst], …)` regs. The
/// `OpParams::Cast` variant is a unit marker (the target dtype rides on the
/// output Storage), so it never enters the key.
///
/// Several sections share ONE wrapper (as the deleted hand-written regs did):
/// - `cast::cast_f32_half` — the pair-packed half casts `f32↔f16` / `f32↔bf16`.
/// - `cast::cast_f32_f64` — the one-per-element wide casts `f32↔f64`.
/// - `cast_f8e4m3::cast_f8e4m3` — the six byte-packed `F8E4M3↔{f32,f16,bf16}`
///   casts (all non-F8 sides routed via F32 internally).
///
/// This contract has NO `##` chassis umbrella section, so there is no
/// `registrable: false` describe-only entry to omit.
pub static VULKAN_CAST_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // Pair-packed half casts (f32↔f16, f32↔bf16) → cast_f32_half.
    vk_ep!(
        "cast_f32_to_f16",
        crate::vulkan_dispatch::cast::cast_f32_half
    ),
    vk_ep!(
        "cast_f16_to_f32",
        crate::vulkan_dispatch::cast::cast_f32_half
    ),
    vk_ep!(
        "cast_f32_to_bf16",
        crate::vulkan_dispatch::cast::cast_f32_half
    ),
    vk_ep!(
        "cast_bf16_to_f32",
        crate::vulkan_dispatch::cast::cast_f32_half
    ),
    // One-per-element wide casts (f32↔f64) → cast_f32_f64.
    vk_ep!(
        "cast_f32_to_f64",
        crate::vulkan_dispatch::cast::cast_f32_f64
    ),
    vk_ep!(
        "cast_f64_to_f32",
        crate::vulkan_dispatch::cast::cast_f32_f64
    ),
    // Byte-packed F8E4M3 casts (F8E4M3 ↔ {f32, f16, bf16}) → cast_f8e4m3.
    vk_ep!(
        "cast_f32_to_f8e4m3",
        crate::vulkan_dispatch::cast_f8e4m3::cast_f8e4m3
    ),
    vk_ep!(
        "cast_f8e4m3_to_f32",
        crate::vulkan_dispatch::cast_f8e4m3::cast_f8e4m3
    ),
    vk_ep!(
        "cast_f16_to_f8e4m3",
        crate::vulkan_dispatch::cast_f8e4m3::cast_f8e4m3
    ),
    vk_ep!(
        "cast_f8e4m3_to_f16",
        crate::vulkan_dispatch::cast_f8e4m3::cast_f8e4m3
    ),
    vk_ep!(
        "cast_bf16_to_f8e4m3",
        crate::vulkan_dispatch::cast_f8e4m3::cast_f8e4m3
    ),
    vk_ep!(
        "cast_f8e4m3_to_bf16",
        crate::vulkan_dispatch::cast_f8e4m3::cast_f8e4m3
    ),
];

/// The Vulkan elementwise family's `symbol → production wrapper` map — the
/// FULL family: 94 (op, dtype) keys resolving to the per-(op, dtype) wrappers in
/// [`crate::vulkan_dispatch`]. Contract:
/// `docs/kernel-contracts/vulkan/elementwise.fkc.md`, re-authored per-op (the
/// CPU inplace precedent). The strided unary / affine sections declare a BASE
/// `entry_point` (`…::<op>` / `…::affine`) + `dtypes: [F32, F16, F64]`, so the
/// importer fans them into `<base>_{f32,f16,f64}` — the symbols below. The
/// binary sections fan `[F32, F16, F64, BF16]` (all four strided, incl. the
/// lane-masked `binary_bf16`). The bf16-unary / `affine_bf16` / `clamp` / `powi`
/// sections are single-dtype (resolved AS-IS on their full `<op>_<dt>` symbol).
///
/// Caps ride through the import truthfully (§6): the strided sections' layout
/// (`strided: accepted, broadcast_stride0: accepted`) projects
/// `strided_input=true` (byte-for-byte the deleted
/// `register_with_caps_and_precision(strided)` regs); the bf16-unary /
/// `affine_bf16` sections' `contiguous: required` layout projects
/// `strided_input=false` (the deleted plain `register_with_precision` regs).
pub static VULKAN_ELEMENTWISE_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // ----- Unary: 16 ops, strided f32/f16/f64 fan + contiguous bf16 (64 symbols). -----
    vk_ep!("neg_f32", crate::vulkan_dispatch::unary::neg_f32),
    vk_ep!("neg_f16", crate::vulkan_dispatch::unary_f16::neg_f16),
    vk_ep!("neg_f64", crate::vulkan_dispatch::unary_f64::neg_f64),
    vk_ep!("neg_bf16", crate::vulkan_dispatch::unary_bf16::neg_bf16),
    vk_ep!("sqr_f32", crate::vulkan_dispatch::unary::sqr_f32),
    vk_ep!("sqr_f16", crate::vulkan_dispatch::unary_f16::sqr_f16),
    vk_ep!("sqr_f64", crate::vulkan_dispatch::unary_f64::sqr_f64),
    vk_ep!("sqr_bf16", crate::vulkan_dispatch::unary_bf16::sqr_bf16),
    vk_ep!("sqrt_f32", crate::vulkan_dispatch::unary::sqrt_f32),
    vk_ep!("sqrt_f16", crate::vulkan_dispatch::unary_f16::sqrt_f16),
    vk_ep!("sqrt_f64", crate::vulkan_dispatch::unary_f64::sqrt_f64),
    vk_ep!("sqrt_bf16", crate::vulkan_dispatch::unary_bf16::sqrt_bf16),
    vk_ep!("exp_f32", crate::vulkan_dispatch::unary::exp_f32),
    vk_ep!("exp_f16", crate::vulkan_dispatch::unary_f16::exp_f16),
    vk_ep!("exp_f64", crate::vulkan_dispatch::unary_f64::exp_f64),
    vk_ep!("exp_bf16", crate::vulkan_dispatch::unary_bf16::exp_bf16),
    vk_ep!("log_f32", crate::vulkan_dispatch::unary::log_f32),
    vk_ep!("log_f16", crate::vulkan_dispatch::unary_f16::log_f16),
    vk_ep!("log_f64", crate::vulkan_dispatch::unary_f64::log_f64),
    vk_ep!("log_bf16", crate::vulkan_dispatch::unary_bf16::log_bf16),
    vk_ep!("sin_f32", crate::vulkan_dispatch::unary::sin_f32),
    vk_ep!("sin_f16", crate::vulkan_dispatch::unary_f16::sin_f16),
    vk_ep!("sin_f64", crate::vulkan_dispatch::unary_f64::sin_f64),
    vk_ep!("sin_bf16", crate::vulkan_dispatch::unary_bf16::sin_bf16),
    vk_ep!("cos_f32", crate::vulkan_dispatch::unary::cos_f32),
    vk_ep!("cos_f16", crate::vulkan_dispatch::unary_f16::cos_f16),
    vk_ep!("cos_f64", crate::vulkan_dispatch::unary_f64::cos_f64),
    vk_ep!("cos_bf16", crate::vulkan_dispatch::unary_bf16::cos_bf16),
    vk_ep!("tanh_f32", crate::vulkan_dispatch::unary::tanh_f32),
    vk_ep!("tanh_f16", crate::vulkan_dispatch::unary_f16::tanh_f16),
    vk_ep!("tanh_f64", crate::vulkan_dispatch::unary_f64::tanh_f64),
    vk_ep!("tanh_bf16", crate::vulkan_dispatch::unary_bf16::tanh_bf16),
    vk_ep!("sigmoid_f32", crate::vulkan_dispatch::unary::sigmoid_f32),
    vk_ep!(
        "sigmoid_f16",
        crate::vulkan_dispatch::unary_f16::sigmoid_f16
    ),
    vk_ep!(
        "sigmoid_f64",
        crate::vulkan_dispatch::unary_f64::sigmoid_f64
    ),
    vk_ep!(
        "sigmoid_bf16",
        crate::vulkan_dispatch::unary_bf16::sigmoid_bf16
    ),
    vk_ep!("silu_f32", crate::vulkan_dispatch::unary::silu_f32),
    vk_ep!("silu_f16", crate::vulkan_dispatch::unary_f16::silu_f16),
    vk_ep!("silu_f64", crate::vulkan_dispatch::unary_f64::silu_f64),
    vk_ep!("silu_bf16", crate::vulkan_dispatch::unary_bf16::silu_bf16),
    vk_ep!("gelu_f32", crate::vulkan_dispatch::unary::gelu_f32),
    vk_ep!("gelu_f16", crate::vulkan_dispatch::unary_f16::gelu_f16),
    vk_ep!("gelu_f64", crate::vulkan_dispatch::unary_f64::gelu_f64),
    vk_ep!("gelu_bf16", crate::vulkan_dispatch::unary_bf16::gelu_bf16),
    vk_ep!("relu_f32", crate::vulkan_dispatch::unary::relu_f32),
    vk_ep!("relu_f16", crate::vulkan_dispatch::unary_f16::relu_f16),
    vk_ep!("relu_f64", crate::vulkan_dispatch::unary_f64::relu_f64),
    vk_ep!("relu_bf16", crate::vulkan_dispatch::unary_bf16::relu_bf16),
    vk_ep!("step_f32", crate::vulkan_dispatch::unary::step_f32),
    vk_ep!("step_f16", crate::vulkan_dispatch::unary_f16::step_f16),
    vk_ep!("step_f64", crate::vulkan_dispatch::unary_f64::step_f64),
    vk_ep!("step_bf16", crate::vulkan_dispatch::unary_bf16::step_bf16),
    vk_ep!("abs_f32", crate::vulkan_dispatch::unary::abs_f32),
    vk_ep!("abs_f16", crate::vulkan_dispatch::unary_f16::abs_f16),
    vk_ep!("abs_f64", crate::vulkan_dispatch::unary_f64::abs_f64),
    vk_ep!("abs_bf16", crate::vulkan_dispatch::unary_bf16::abs_bf16),
    vk_ep!("sign_f32", crate::vulkan_dispatch::unary::sign_f32),
    vk_ep!("sign_f16", crate::vulkan_dispatch::unary_f16::sign_f16),
    vk_ep!("sign_f64", crate::vulkan_dispatch::unary_f64::sign_f64),
    vk_ep!("sign_bf16", crate::vulkan_dispatch::unary_bf16::sign_bf16),
    vk_ep!("recip_f32", crate::vulkan_dispatch::unary::recip_f32),
    vk_ep!("recip_f16", crate::vulkan_dispatch::unary_f16::recip_f16),
    vk_ep!("recip_f64", crate::vulkan_dispatch::unary_f64::recip_f64),
    vk_ep!("recip_bf16", crate::vulkan_dispatch::unary_bf16::recip_bf16),
    // ----- Binary: 6 ops, strided f32/f16/f64/bf16 fan (24 symbols). -----
    vk_ep!("add_f32", crate::vulkan_dispatch::binary::add_f32),
    vk_ep!("add_f16", crate::vulkan_dispatch::binary_f16::add_f16),
    vk_ep!("add_f64", crate::vulkan_dispatch::binary_f64::add_f64),
    vk_ep!("add_bf16", crate::vulkan_dispatch::binary_bf16::add_bf16),
    vk_ep!("sub_f32", crate::vulkan_dispatch::binary::sub_f32),
    vk_ep!("sub_f16", crate::vulkan_dispatch::binary_f16::sub_f16),
    vk_ep!("sub_f64", crate::vulkan_dispatch::binary_f64::sub_f64),
    vk_ep!("sub_bf16", crate::vulkan_dispatch::binary_bf16::sub_bf16),
    vk_ep!("mul_f32", crate::vulkan_dispatch::binary::mul_f32),
    vk_ep!("mul_f16", crate::vulkan_dispatch::binary_f16::mul_f16),
    vk_ep!("mul_f64", crate::vulkan_dispatch::binary_f64::mul_f64),
    vk_ep!("mul_bf16", crate::vulkan_dispatch::binary_bf16::mul_bf16),
    vk_ep!("div_f32", crate::vulkan_dispatch::binary::div_f32),
    vk_ep!("div_f16", crate::vulkan_dispatch::binary_f16::div_f16),
    vk_ep!("div_f64", crate::vulkan_dispatch::binary_f64::div_f64),
    vk_ep!("div_bf16", crate::vulkan_dispatch::binary_bf16::div_bf16),
    vk_ep!("maximum_f32", crate::vulkan_dispatch::binary::maximum_f32),
    vk_ep!(
        "maximum_f16",
        crate::vulkan_dispatch::binary_f16::maximum_f16
    ),
    vk_ep!(
        "maximum_f64",
        crate::vulkan_dispatch::binary_f64::maximum_f64
    ),
    vk_ep!(
        "maximum_bf16",
        crate::vulkan_dispatch::binary_bf16::maximum_bf16
    ),
    vk_ep!("minimum_f32", crate::vulkan_dispatch::binary::minimum_f32),
    vk_ep!(
        "minimum_f16",
        crate::vulkan_dispatch::binary_f16::minimum_f16
    ),
    vk_ep!(
        "minimum_f64",
        crate::vulkan_dispatch::binary_f64::minimum_f64
    ),
    vk_ep!(
        "minimum_bf16",
        crate::vulkan_dispatch::binary_bf16::minimum_bf16
    ),
    // ----- Affine: strided f32/f16/f64 fan + contiguous bf16 (all in the `affine` module). -----
    vk_ep!("affine_f32", crate::vulkan_dispatch::affine::affine_f32),
    vk_ep!("affine_f16", crate::vulkan_dispatch::affine::affine_f16),
    vk_ep!("affine_f64", crate::vulkan_dispatch::affine::affine_f64),
    vk_ep!("affine_bf16", crate::vulkan_dispatch::affine::affine_bf16),
    // ----- Clamp / PowI: single-dtype f32. -----
    vk_ep!("clamp_f32", crate::vulkan_dispatch::clamp::clamp_f32),
    vk_ep!("powi_f32", crate::vulkan_dispatch::powi::powi_f32),
];

/// The Vulkan matmul family's `symbol → production wrapper` map — the FULL
/// family: 6 per-combo `(MatMul, [lhs,rhs,out])` wrapper bindings. Contract:
/// `docs/kernel-contracts/vulkan/matmul.fkc.md`, re-authored per-combo (the cast
/// family's per-pair precedent). Each section declares a single dtype per operand
/// + a `fixed(OUT)` / `passthrough(lhs)` output, so none of them dtype-fan — the
///
/// importer keys `[lhs, rhs, out]` (inputs-then-output), byte-for-byte the deleted
/// hand-written `table.register_with_precision(OpKind::MatMul, &[lhs, rhs, out], …)`
/// regs.
///
/// Each symbol is one production wrapper that route-picks its internal Slang
/// kernels (matvec / reg-tile / tiled for f32; matvec_bf16_b / matmul_tiled_bf16_b
/// / matmul_coop* + matmul_small_* fallbacks for the mixed combos) at dispatch
/// time — the route-pick is NOT a table binding, so there is exactly one
/// `KernelRef` per key (no duplicate-at-key which `finalize` would reject). Caps
/// ride through contiguous-only (`awkward_layout_strategy: requires_contiguous`
/// ⇒ `strided_input == false`), byte-for-byte the deleted `register_with_precision`
/// regs (the coop / vec4 loads require canonical row-major; a strided operand is
/// auto-Contiguized first).
pub static VULKAN_MATMUL_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // f32 GEMM/GEMV wrapper (matvec / reg-tile / tiled route-pick).
    vk_ep!("matmul_f32", crate::vulkan_dispatch::matmul::matmul_f32),
    // Mixed-precision f32 × bf16 → f32 (matvec_bf16_b / matmul_tiled_bf16_b / coop).
    vk_ep!(
        "matmul_f32_bf16_b",
        crate::vulkan_dispatch::matmul::matmul_f32_bf16_b
    ),
    // Cooperative-matrix bf16 × bf16 → f32 (coop + matmul_small_bf16_bf16_f32).
    vk_ep!(
        "matmul_bf16_bf16_f32",
        crate::vulkan_dispatch::matmul::matmul_bf16_bf16_f32
    ),
    // Cooperative-matrix bf16 × bf16 → bf16, downcast store (coop + small).
    vk_ep!(
        "matmul_bf16_bf16_bf16",
        crate::vulkan_dispatch::matmul::matmul_bf16_bf16_bf16
    ),
    // Cooperative-matrix f16 × f16 → f16, downcast store (coop + small).
    vk_ep!(
        "matmul_f16_f16_f16",
        crate::vulkan_dispatch::matmul::matmul_f16_f16_f16
    ),
    // Cooperative-matrix f16 × f16 → f32 (coop + matmul_small_f16_f16_f32).
    vk_ep!(
        "matmul_f16_f16_f32",
        crate::vulkan_dispatch::matmul::matmul_f16_f16_f32
    ),
];

/// The Vulkan conv2d family's `symbol → production wrapper` map — the FULL
/// family: 3 per-(op, dtype) `(Conv2D, [x, weight, out])` wrapper bindings.
/// Contract: `docs/kernel-contracts/vulkan/conv.fkc.md`, re-authored per-(op,
/// dtype) (the matmul family's per-combo precedent). Each section declares a
/// single dtype per operand + a `passthrough(x)` output, so none of them
/// dtype-fan — the importer keys `[x, weight, out]` (inputs-then-output),
/// byte-for-byte the deleted hand-written
/// `table.register_with_precision(OpKind::Conv2D, &[T, T, T], …)` regs.
///
/// Each symbol is one production wrapper (`conv2d::conv2d_f32/bf16/f16`) that
/// runs the WHOLE conv internally (`VulkanBackend::conv2d_*_bytes`: NCHW im2col
/// → GEMM, the coop tensor-core GEMM for bf16/f16) — the two-stage pipeline is
/// NOT a table binding, so there is exactly one `KernelRef` per key. NO bias key
/// is mapped: the wrappers bail on a 3-input (bias) call, so the contract
/// declares no optional bias operand and each section keys only `[x, weight,
/// out]` (unlike the CPU conv family's optional-bias dual key). Caps ride
/// through contiguous-only (`requires_contiguous` ⇒ `strided_input == false`) —
/// conv2d_im2col reads canonical row-major NCHW, so a strided operand is
/// auto-Contiguized first.
pub static VULKAN_CONV_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // f32 conv (im2col + f32 GEMM route-pick).
    vk_ep!("conv2d_f32", crate::vulkan_dispatch::conv2d::conv2d_f32),
    // bf16 conv (im2col_bf16 + cooperative-matrix bf16 GEMM).
    vk_ep!("conv2d_bf16", crate::vulkan_dispatch::conv2d::conv2d_bf16),
    // f16 conv (im2col + cooperative-matrix f16 GEMM).
    vk_ep!("conv2d_f16", crate::vulkan_dispatch::conv2d::conv2d_f16),
];

/// The Vulkan **select** family's `symbol → production wrapper` map — the FULL
/// family: 16 (op, dtype) keys across IndexSelect (4), Gather (6), MaskedFill
/// (6). Contract: `docs/kernel-contracts/vulkan/select.fkc.md`, authored per-op
/// (the conv/matmul per-combo precedent, with dtype fan-out §3.4). Each section
/// declares a BASE `entry_point` fanned over its dtype list, so the importer
/// resolves `<base>_<suffix>` and keys `[data, index, out]` (data dtype + fixed
/// index dtype + passthrough(data) output), byte-for-byte the deleted hand-written
/// `register_with_precision(OpKind::{IndexSelect,Gather,MaskedFill}, …)` regs.
///
/// IndexSelect fans to FOUR distinct per-dtype wrappers
/// (`indexing::index_select_{f32,f16,bf16,f64}`). Gather + MaskedFill each dispatch
/// through ONE dtype-agnostic wrapper (`gather::gather`, `masked_fill::masked_fill`)
/// that picks its element byte-width from the output dtype — so every fanned dtype
/// symbol maps to the SAME `KernelRef` (a synthetic-base umbrella, the pad_cpu
/// precedent; distinct dtype keys ⇒ legal sibling registrations of one wrapper).
/// Caps ride through contiguous-only (`requires_contiguous` ⇒ `strided_input ==
/// false`) — byte-level data movers read/write own-shape flat buffers; a strided
/// operand is auto-Contiguized first.
pub static VULKAN_SELECT_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // IndexSelect: 4 distinct per-dtype wrappers.
    vk_ep!(
        "index_select_f32",
        crate::vulkan_dispatch::indexing::index_select_f32
    ),
    vk_ep!(
        "index_select_f16",
        crate::vulkan_dispatch::indexing::index_select_f16
    ),
    vk_ep!(
        "index_select_bf16",
        crate::vulkan_dispatch::indexing::index_select_bf16
    ),
    vk_ep!(
        "index_select_f64",
        crate::vulkan_dispatch::indexing::index_select_f64
    ),
    // Gather: 6 dtype symbols → the ONE dtype-agnostic gather wrapper.
    vk_ep!("gather_f32", crate::vulkan_dispatch::gather::gather),
    vk_ep!("gather_f16", crate::vulkan_dispatch::gather::gather),
    vk_ep!("gather_bf16", crate::vulkan_dispatch::gather::gather),
    vk_ep!("gather_f64", crate::vulkan_dispatch::gather::gather),
    vk_ep!("gather_u8", crate::vulkan_dispatch::gather::gather),
    vk_ep!("gather_u32", crate::vulkan_dispatch::gather::gather),
    // MaskedFill: 6 dtype symbols → the ONE dtype-agnostic masked_fill wrapper.
    vk_ep!(
        "masked_fill_f32",
        crate::vulkan_dispatch::masked_fill::masked_fill
    ),
    vk_ep!(
        "masked_fill_f16",
        crate::vulkan_dispatch::masked_fill::masked_fill
    ),
    vk_ep!(
        "masked_fill_bf16",
        crate::vulkan_dispatch::masked_fill::masked_fill
    ),
    vk_ep!(
        "masked_fill_f64",
        crate::vulkan_dispatch::masked_fill::masked_fill
    ),
    vk_ep!(
        "masked_fill_u8",
        crate::vulkan_dispatch::masked_fill::masked_fill
    ),
    vk_ep!(
        "masked_fill_u32",
        crate::vulkan_dispatch::masked_fill::masked_fill
    ),
];

/// The Vulkan **scatter** family's `symbol → production wrapper` map — the FULL
/// family: 8 (op, dtype) keys across IndexAdd (4) + ScatterAdd (4). Contract:
/// `docs/kernel-contracts/vulkan/scatter.fkc.md`, authored per-op with dtype
/// fan-out (§3.4). Each section declares a BASE `entry_point` fanned over
/// `[F32, F64, BF16, F16]` (the `base` + `src` operands SHARE that list ⇒ they
/// fan together), so the importer resolves `<base>_<suffix>` and keys the 4-slot
/// `[base, U32, src, out]` (`passthrough(base)` output), byte-for-byte the deleted
/// hand-written `register_with_precision(OpKind::{IndexAdd,ScatterAdd}, …)` regs.
///
/// Each fanned symbol resolves to its distinct per-dtype wrapper
/// (`index_add::index_add_*`, `scatter_add::scatter_add_*`). Caps ride through
/// contiguous-only (`requires_contiguous` ⇒ `strided_input == false`); precision is
/// the contract's audited nondeterministic `none(reason)` seed (bounded-CAS atomic
/// accumulate, scheduler-dependent order).
pub static VULKAN_SCATTER_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // IndexAdd: 4 distinct per-dtype wrappers.
    vk_ep!(
        "index_add_f32",
        crate::vulkan_dispatch::index_add::index_add_f32
    ),
    vk_ep!(
        "index_add_f64",
        crate::vulkan_dispatch::index_add::index_add_f64
    ),
    vk_ep!(
        "index_add_bf16",
        crate::vulkan_dispatch::index_add::index_add_bf16
    ),
    vk_ep!(
        "index_add_f16",
        crate::vulkan_dispatch::index_add::index_add_f16
    ),
    // ScatterAdd: 4 distinct per-dtype wrappers.
    vk_ep!(
        "scatter_add_f32",
        crate::vulkan_dispatch::scatter_add::scatter_add_f32
    ),
    vk_ep!(
        "scatter_add_f64",
        crate::vulkan_dispatch::scatter_add::scatter_add_f64
    ),
    vk_ep!(
        "scatter_add_bf16",
        crate::vulkan_dispatch::scatter_add::scatter_add_bf16
    ),
    vk_ep!(
        "scatter_add_f16",
        crate::vulkan_dispatch::scatter_add::scatter_add_f16
    ),
];

/// The Vulkan **movement** family's `symbol → production wrapper` map — the FULL
/// family: 8 (op, dtype) keys across Concat (4) + CumSum (4). Contract:
/// `docs/kernel-contracts/vulkan/movement.fkc.md`, authored per-op with dtype
/// fan-out (§3.4). Each section declares a BASE `entry_point` fanned over its dtype
/// list, resolving `<base>_<suffix>` to each distinct per-dtype wrapper and keying
/// `[T, T]` (`passthrough(input)` output), byte-for-byte the deleted hand-written
/// `register_with_caps_and_precision(OpKind::{Concat,CumSum}, …, strided, …)` regs.
///
/// Both are STRIDE-AWARE (`strided: accepted` ⇒ `strided_input == true`) — the
/// caps-through-import proof for this family. Concat precision is byte-exact
/// (bitwise); CumSum takes the conservative UNAUDITED author seed (the elementwise
/// pointwise precedent).
pub static VULKAN_MOVEMENT_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // Concat: 4 distinct per-dtype wrappers.
    vk_ep!("concat_f32", crate::vulkan_dispatch::concat::concat_f32),
    vk_ep!("concat_f16", crate::vulkan_dispatch::concat::concat_f16),
    vk_ep!("concat_bf16", crate::vulkan_dispatch::concat::concat_bf16),
    vk_ep!("concat_f64", crate::vulkan_dispatch::concat::concat_f64),
    // CumSum: 4 distinct per-dtype wrappers.
    vk_ep!("cumsum_f32", crate::vulkan_dispatch::cumsum::cumsum_f32),
    vk_ep!("cumsum_f64", crate::vulkan_dispatch::cumsum::cumsum_f64),
    vk_ep!("cumsum_f16", crate::vulkan_dispatch::cumsum::cumsum_f16),
    vk_ep!("cumsum_bf16", crate::vulkan_dispatch::cumsum::cumsum_bf16),
];

/// The Vulkan **shape** family's `symbol → production wrapper` map — the FULL
/// family: 28 (op, dtype) keys across Triu (7) + Tril (7) + Flip (7) + Roll (7)
/// over `[F32, F16, BF16, F64, I32, U32, I64]`. Contract:
/// `docs/kernel-contracts/vulkan/shape.fkc.md`, authored per-op with dtype fan-out
/// (§3.4). Each op is ONE dtype-agnostic wrapper (`triangular::triu` /
/// `triangular::tril` / `flip::flip` / `roll::roll`) that picks its byte-width from
/// the dtype — so every fanned `<base>_<suffix>` symbol maps to the SAME `KernelRef`
/// (a synthetic-base umbrella, the pad_cpu precedent). Distinct dtype keys ⇒ legal
/// sibling registrations of one wrapper, byte-for-byte the deleted hand-written
/// regs.
///
/// Caps split by op: Triu/Tril `requires_contiguous` (`strided_input == false`),
/// Flip/Roll `strided: accepted` (`strided_input == true`) — the caps-through-import
/// proof. All are byte-exact (bitwise, `max_ulp: 0`).
pub static VULKAN_SHAPE_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // Triu: 7 dtype symbols → the ONE dtype-agnostic triu wrapper.
    vk_ep!("triu_f32", crate::vulkan_dispatch::triangular::triu),
    vk_ep!("triu_f16", crate::vulkan_dispatch::triangular::triu),
    vk_ep!("triu_bf16", crate::vulkan_dispatch::triangular::triu),
    vk_ep!("triu_f64", crate::vulkan_dispatch::triangular::triu),
    vk_ep!("triu_i32", crate::vulkan_dispatch::triangular::triu),
    vk_ep!("triu_u32", crate::vulkan_dispatch::triangular::triu),
    vk_ep!("triu_i64", crate::vulkan_dispatch::triangular::triu),
    // Tril: 7 dtype symbols → the ONE dtype-agnostic tril wrapper.
    vk_ep!("tril_f32", crate::vulkan_dispatch::triangular::tril),
    vk_ep!("tril_f16", crate::vulkan_dispatch::triangular::tril),
    vk_ep!("tril_bf16", crate::vulkan_dispatch::triangular::tril),
    vk_ep!("tril_f64", crate::vulkan_dispatch::triangular::tril),
    vk_ep!("tril_i32", crate::vulkan_dispatch::triangular::tril),
    vk_ep!("tril_u32", crate::vulkan_dispatch::triangular::tril),
    vk_ep!("tril_i64", crate::vulkan_dispatch::triangular::tril),
    // Flip: 7 dtype symbols → the ONE dtype-agnostic flip wrapper (stride-aware).
    vk_ep!("flip_f32", crate::vulkan_dispatch::flip::flip),
    vk_ep!("flip_f16", crate::vulkan_dispatch::flip::flip),
    vk_ep!("flip_bf16", crate::vulkan_dispatch::flip::flip),
    vk_ep!("flip_f64", crate::vulkan_dispatch::flip::flip),
    vk_ep!("flip_i32", crate::vulkan_dispatch::flip::flip),
    vk_ep!("flip_u32", crate::vulkan_dispatch::flip::flip),
    vk_ep!("flip_i64", crate::vulkan_dispatch::flip::flip),
    // Roll: 7 dtype symbols → the ONE dtype-agnostic roll wrapper (stride-aware).
    vk_ep!("roll_f32", crate::vulkan_dispatch::roll::roll),
    vk_ep!("roll_f16", crate::vulkan_dispatch::roll::roll),
    vk_ep!("roll_bf16", crate::vulkan_dispatch::roll::roll),
    vk_ep!("roll_f64", crate::vulkan_dispatch::roll::roll),
    vk_ep!("roll_i32", crate::vulkan_dispatch::roll::roll),
    vk_ep!("roll_u32", crate::vulkan_dispatch::roll::roll),
    vk_ep!("roll_i64", crate::vulkan_dispatch::roll::roll),
];

/// The Vulkan **pad-copy** family's `symbol → production wrapper` map — the FULL
/// family: 21 (op, dtype) keys across Pad (6) + PadBackward (6) + Copy (9).
/// Contract: `docs/kernel-contracts/vulkan/pad-copy.fkc.md`, authored per-op with
/// dtype fan-out (§3.4). Each op is ONE dtype-agnostic wrapper (`pad::pad_const` /
/// `pad::pad_backward` / `copy_to_cpu_vulkan`) that picks its byte-width from the
/// dtype — so every fanned `<base>_<suffix>` symbol maps to the SAME `KernelRef`
/// (a synthetic-base umbrella, the pad_cpu precedent). Distinct dtype keys ⇒ legal
/// sibling registrations of one wrapper, byte-for-byte the deleted hand-written
/// regs. Caps ride through contiguous-only (`requires_contiguous` ⇒
/// `strided_input == false`); precision byte-exact (bitwise, `max_ulp: 0`).
pub static VULKAN_PAD_COPY_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // Pad: 6 dtype symbols → the ONE dtype-agnostic pad_const wrapper.
    vk_ep!("pad_f32", crate::vulkan_dispatch::pad::pad_const),
    vk_ep!("pad_f16", crate::vulkan_dispatch::pad::pad_const),
    vk_ep!("pad_bf16", crate::vulkan_dispatch::pad::pad_const),
    vk_ep!("pad_f64", crate::vulkan_dispatch::pad::pad_const),
    vk_ep!("pad_u8", crate::vulkan_dispatch::pad::pad_const),
    vk_ep!("pad_u32", crate::vulkan_dispatch::pad::pad_const),
    // PadBackward: 6 dtype symbols → the ONE dtype-agnostic pad_backward wrapper.
    vk_ep!(
        "pad_backward_f32",
        crate::vulkan_dispatch::pad::pad_backward
    ),
    vk_ep!(
        "pad_backward_f16",
        crate::vulkan_dispatch::pad::pad_backward
    ),
    vk_ep!(
        "pad_backward_bf16",
        crate::vulkan_dispatch::pad::pad_backward
    ),
    vk_ep!(
        "pad_backward_f64",
        crate::vulkan_dispatch::pad::pad_backward
    ),
    vk_ep!("pad_backward_u8", crate::vulkan_dispatch::pad::pad_backward),
    vk_ep!(
        "pad_backward_u32",
        crate::vulkan_dispatch::pad::pad_backward
    ),
    // Copy: 9 dtype symbols → the ONE dtype-agnostic D2H copy wrapper.
    vk_ep!("copy_f32", crate::vulkan_dispatch::copy_to_cpu_vulkan),
    vk_ep!("copy_f16", crate::vulkan_dispatch::copy_to_cpu_vulkan),
    vk_ep!("copy_bf16", crate::vulkan_dispatch::copy_to_cpu_vulkan),
    vk_ep!("copy_f64", crate::vulkan_dispatch::copy_to_cpu_vulkan),
    vk_ep!("copy_u32", crate::vulkan_dispatch::copy_to_cpu_vulkan),
    vk_ep!("copy_u8", crate::vulkan_dispatch::copy_to_cpu_vulkan),
    vk_ep!("copy_i16", crate::vulkan_dispatch::copy_to_cpu_vulkan),
    vk_ep!("copy_i32", crate::vulkan_dispatch::copy_to_cpu_vulkan),
    vk_ep!("copy_i64", crate::vulkan_dispatch::copy_to_cpu_vulkan),
];

/// The Vulkan **write-slice** family's `symbol → production wrapper` map — the
/// FULL family: 18 (op, dtype) keys across WriteSlice (9) + WriteSliceRotating (9).
/// Contract: `docs/kernel-contracts/vulkan/write-slice.fkc.md`, authored per-op
/// with dtype fan-out (§3.4). BYTE-WIDTH-keyed: each op's 9 dtype symbols collapse
/// to FOUR wrappers by element size (`b1/b2/b4/b8`) — the cast family's "several
/// sections share one wrapper" precedent. The link registry maps each fanned
/// `<base>_<suffix>` symbol to the byte-width wrapper for that dtype's size, keying
/// `[T, T]` byte-for-byte the deleted hand-written
/// `register_with_precision(OpKind::{WriteSlice,WriteSliceRotating}, …)` regs. Caps
/// ride through contiguous-only (`requires_contiguous` ⇒ `strided_input == false`);
/// precision byte-exact (bitwise, `max_ulp: 0`).
pub static VULKAN_WRITE_SLICE_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // WriteSlice: 9 dtype symbols → 4 byte-width wrappers (b4/b2/b8/b1).
    vk_ep!(
        "write_slice_f32",
        crate::vulkan_dispatch::write_slice::write_slice_b4
    ),
    vk_ep!(
        "write_slice_i32",
        crate::vulkan_dispatch::write_slice::write_slice_b4
    ),
    vk_ep!(
        "write_slice_u32",
        crate::vulkan_dispatch::write_slice::write_slice_b4
    ),
    vk_ep!(
        "write_slice_f16",
        crate::vulkan_dispatch::write_slice::write_slice_b2
    ),
    vk_ep!(
        "write_slice_bf16",
        crate::vulkan_dispatch::write_slice::write_slice_b2
    ),
    vk_ep!(
        "write_slice_f64",
        crate::vulkan_dispatch::write_slice::write_slice_b8
    ),
    vk_ep!(
        "write_slice_i64",
        crate::vulkan_dispatch::write_slice::write_slice_b8
    ),
    vk_ep!(
        "write_slice_u8",
        crate::vulkan_dispatch::write_slice::write_slice_b1
    ),
    vk_ep!(
        "write_slice_i8",
        crate::vulkan_dispatch::write_slice::write_slice_b1
    ),
    // WriteSliceRotating: 9 dtype symbols → 4 byte-width rotating wrappers.
    vk_ep!(
        "write_slice_rotating_f32",
        crate::vulkan_dispatch::write_slice_rotating::write_slice_rotating_b4
    ),
    vk_ep!(
        "write_slice_rotating_i32",
        crate::vulkan_dispatch::write_slice_rotating::write_slice_rotating_b4
    ),
    vk_ep!(
        "write_slice_rotating_u32",
        crate::vulkan_dispatch::write_slice_rotating::write_slice_rotating_b4
    ),
    vk_ep!(
        "write_slice_rotating_f16",
        crate::vulkan_dispatch::write_slice_rotating::write_slice_rotating_b2
    ),
    vk_ep!(
        "write_slice_rotating_bf16",
        crate::vulkan_dispatch::write_slice_rotating::write_slice_rotating_b2
    ),
    vk_ep!(
        "write_slice_rotating_f64",
        crate::vulkan_dispatch::write_slice_rotating::write_slice_rotating_b8
    ),
    vk_ep!(
        "write_slice_rotating_i64",
        crate::vulkan_dispatch::write_slice_rotating::write_slice_rotating_b8
    ),
    vk_ep!(
        "write_slice_rotating_u8",
        crate::vulkan_dispatch::write_slice_rotating::write_slice_rotating_b1
    ),
    vk_ep!(
        "write_slice_rotating_i8",
        crate::vulkan_dispatch::write_slice_rotating::write_slice_rotating_b1
    ),
];

/// The Vulkan **rope** family's `symbol → production wrapper` map — the FULL
/// family: 4 (Rope, [x, cos, sin, out]) per-dtype bindings. Contract:
/// `docs/kernel-contracts/vulkan/rope.fkc.md`, authored with dtype fan-out (§3.4):
/// the single section declares a BASE `entry_point` fanned over `[F32, F16, F64,
/// BF16]` (the `x` + `cos` + `sin` operands SHARE that list ⇒ they fan together),
/// resolving `rope_<suffix>` to each distinct per-dtype wrapper and keying the
/// 4-slot `[x, cos, sin, out]` (`passthrough(x)` output), byte-for-byte the deleted
/// hand-written `register_with_caps_and_precision(OpKind::Rope, …, strided, …)`
/// regs. STRIDE-AWARE (`strided: accepted` ⇒ `strided_input == true`) — the
/// caps-through-import proof; precision is the conservative UNAUDITED author seed
/// (the elementwise pointwise precedent).
pub static VULKAN_ROPE_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    vk_ep!("rope_f32", crate::vulkan_dispatch::attention::rope_f32),
    vk_ep!("rope_f16", crate::vulkan_dispatch::attention::rope_f16),
    vk_ep!("rope_f64", crate::vulkan_dispatch::attention::rope_f64),
    vk_ep!("rope_bf16", crate::vulkan_dispatch::attention::rope_bf16),
];

/// The Vulkan **reduce** family's `symbol → production wrapper` map — the FULL
/// family: 24 (op, dtype) keys across SumReduce / MaxReduce / MinReduce /
/// MeanReduce (16, key `[T, T]`) + ArgMaxDim / ArgMinDim (8, key `[T, U32]`).
/// Contract: `docs/kernel-contracts/vulkan/reduce-prims.fkc.md`, authored per-op
/// with dtype fan-out (§3.4) — the production per-(op, dtype) binding model that
/// supersedes the aspirational `vulkan/reduce.fkc.md` op-id-selector corpus. Each
/// section fans a BASE `entry_point` over `[F32, F16, BF16, F64]` to the DISTINCT
/// per-dtype wrapper, byte-for-byte the deleted hand-written
/// `register_with_precision(OpKind::{SumReduce,…,ArgMinDim}, …)` regs. Caps ride
/// through contiguous-only (`requires_contiguous` ⇒ `strided_input == false`);
/// value reduces are audited nondeterministic none(reason), arg reduces bitwise
/// exact.
pub static VULKAN_REDUCE_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // Value reduces: 4 ops × 4 dtypes → 16 distinct wrappers.
    vk_ep!("reduce_sum_f32", crate::vulkan_dispatch::reduce::sum_f32),
    vk_ep!("reduce_sum_f16", crate::vulkan_dispatch::reduce::sum_f16),
    vk_ep!("reduce_sum_bf16", crate::vulkan_dispatch::reduce::sum_bf16),
    vk_ep!("reduce_sum_f64", crate::vulkan_dispatch::reduce::sum_f64),
    vk_ep!("reduce_max_f32", crate::vulkan_dispatch::reduce::max_f32),
    vk_ep!("reduce_max_f16", crate::vulkan_dispatch::reduce::max_f16),
    vk_ep!("reduce_max_bf16", crate::vulkan_dispatch::reduce::max_bf16),
    vk_ep!("reduce_max_f64", crate::vulkan_dispatch::reduce::max_f64),
    vk_ep!("reduce_min_f32", crate::vulkan_dispatch::reduce::min_f32),
    vk_ep!("reduce_min_f16", crate::vulkan_dispatch::reduce::min_f16),
    vk_ep!("reduce_min_bf16", crate::vulkan_dispatch::reduce::min_bf16),
    vk_ep!("reduce_min_f64", crate::vulkan_dispatch::reduce::min_f64),
    vk_ep!("reduce_mean_f32", crate::vulkan_dispatch::reduce::mean_f32),
    vk_ep!("reduce_mean_f16", crate::vulkan_dispatch::reduce::mean_f16),
    vk_ep!(
        "reduce_mean_bf16",
        crate::vulkan_dispatch::reduce::mean_bf16
    ),
    vk_ep!("reduce_mean_f64", crate::vulkan_dispatch::reduce::mean_f64),
    // Index reduces: 2 ops × 4 dtypes → 8 distinct wrappers.
    vk_ep!(
        "arg_max_f32",
        crate::vulkan_dispatch::arg_reduce::argmax_f32
    ),
    vk_ep!(
        "arg_max_f16",
        crate::vulkan_dispatch::arg_reduce::argmax_f16
    ),
    vk_ep!(
        "arg_max_bf16",
        crate::vulkan_dispatch::arg_reduce::argmax_bf16
    ),
    vk_ep!(
        "arg_max_f64",
        crate::vulkan_dispatch::arg_reduce::argmax_f64
    ),
    vk_ep!(
        "arg_min_f32",
        crate::vulkan_dispatch::arg_reduce::argmin_f32
    ),
    vk_ep!(
        "arg_min_f16",
        crate::vulkan_dispatch::arg_reduce::argmin_f16
    ),
    vk_ep!(
        "arg_min_bf16",
        crate::vulkan_dispatch::arg_reduce::argmin_bf16
    ),
    vk_ep!(
        "arg_min_f64",
        crate::vulkan_dispatch::arg_reduce::argmin_f64
    ),
];

/// The Vulkan **norm** family's `symbol → production wrapper` map — the FULL
/// family: 20 (op, dtype) keys across SoftmaxLastDim (4) + SoftmaxLastDimBackward
/// (4) + LayerNormLastDim (4) + LayerNormLastDimBackward (4) + RmsNormLastDim (4).
/// Contract: `docs/kernel-contracts/vulkan/norm.fkc.md`, authored per-op with dtype
/// fan-out (§3.4). Each section fans a BASE `entry_point` over `[F32, F16, BF16,
/// F64]` to the DISTINCT per-dtype wrapper (`softmax::*`, `norm::*`), keying forward
/// families `[T, T]` and backward families `[T, T, T]` (`[y,g,dx]` / `[x,g,dx]`,
/// both inputs sharing the fanned list), byte-for-byte the deleted hand-written
/// `register_with_precision(OpKind::{SoftmaxLastDim,…,RmsNormLastDim}, …)` regs.
/// Caps ride through contiguous-only (`requires_contiguous` ⇒ `strided_input ==
/// false`); precision is the audited nondeterministic none(reason) seed
/// (per-row subgroup-tree FADD order).
pub static VULKAN_NORM_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // Softmax forward + backward.
    vk_ep!(
        "softmax_last_dim_f32",
        crate::vulkan_dispatch::softmax::softmax_f32
    ),
    vk_ep!(
        "softmax_last_dim_f16",
        crate::vulkan_dispatch::softmax::softmax_f16
    ),
    vk_ep!(
        "softmax_last_dim_bf16",
        crate::vulkan_dispatch::softmax::softmax_bf16
    ),
    vk_ep!(
        "softmax_last_dim_f64",
        crate::vulkan_dispatch::softmax::softmax_f64
    ),
    vk_ep!(
        "softmax_last_dim_backward_f32",
        crate::vulkan_dispatch::softmax::softmax_last_dim_backward_f32
    ),
    vk_ep!(
        "softmax_last_dim_backward_f16",
        crate::vulkan_dispatch::softmax::softmax_last_dim_backward_f16
    ),
    vk_ep!(
        "softmax_last_dim_backward_bf16",
        crate::vulkan_dispatch::softmax::softmax_last_dim_backward_bf16
    ),
    vk_ep!(
        "softmax_last_dim_backward_f64",
        crate::vulkan_dispatch::softmax::softmax_last_dim_backward_f64
    ),
    // LayerNorm forward + backward.
    vk_ep!(
        "layer_norm_last_dim_f32",
        crate::vulkan_dispatch::norm::layer_norm_f32
    ),
    vk_ep!(
        "layer_norm_last_dim_f16",
        crate::vulkan_dispatch::norm::layer_norm_f16
    ),
    vk_ep!(
        "layer_norm_last_dim_bf16",
        crate::vulkan_dispatch::norm::layer_norm_bf16
    ),
    vk_ep!(
        "layer_norm_last_dim_f64",
        crate::vulkan_dispatch::norm::layer_norm_f64
    ),
    vk_ep!(
        "layer_norm_last_dim_backward_f32",
        crate::vulkan_dispatch::norm::layer_norm_backward_f32
    ),
    vk_ep!(
        "layer_norm_last_dim_backward_f16",
        crate::vulkan_dispatch::norm::layer_norm_backward_f16
    ),
    vk_ep!(
        "layer_norm_last_dim_backward_bf16",
        crate::vulkan_dispatch::norm::layer_norm_backward_bf16
    ),
    vk_ep!(
        "layer_norm_last_dim_backward_f64",
        crate::vulkan_dispatch::norm::layer_norm_backward_f64
    ),
    // RmsNorm forward.
    vk_ep!(
        "rms_norm_last_dim_f32",
        crate::vulkan_dispatch::norm::rms_f32
    ),
    vk_ep!(
        "rms_norm_last_dim_f16",
        crate::vulkan_dispatch::norm::rms_f16
    ),
    vk_ep!(
        "rms_norm_last_dim_bf16",
        crate::vulkan_dispatch::norm::rms_bf16
    ),
    vk_ep!(
        "rms_norm_last_dim_f64",
        crate::vulkan_dispatch::norm::rms_f64
    ),
];

/// The Vulkan **QMatMul** family's `symbol → production wrapper` map — the FULL
/// family: ONE `(QMatMul, [F32, U32, F32])` binding. Contract:
/// `docs/kernel-contracts/vulkan/qmatmul.fkc.md`, authored as a single primitive
/// `op_kind: QMatMul` section (the CPU quant-matmul primitive precedent + the
/// linear-quant U8→U32 logical-weight reconciliation). The section declares a
/// single dtype per operand (`activations` F32, `weight` U32) + a `fixed(F32)`
/// output, so it does NOT dtype-fan — the importer keys `[F32, U32, F32]`
/// (inputs-then-output), byte-for-byte the deleted hand-written
/// `table.register_with_precision(OpKind::QMatMul, &[F32, U32, F32], …)` reg.
///
/// The ONE `qmatmul_vk` wrapper route-picks its per-format Vulkan kernels
/// (`qmatvec_q4_0` / `matmul_q4_0_tiled` for Q4_0; dequant-then-`matmul_f32` for
/// Q4_K_M / Q8_0) at dispatch time by `OpParams::QMatMul.quant_type` — that
/// route-pick is NOT a table binding, so there is exactly one `KernelRef` at the
/// key. Caps ride through contiguous-only (`requires_contiguous` ⇒
/// `strided_input == false`): the GGML weight stream has a fixed per-block layout,
/// so a strided operand is auto-Contiguized first.
pub static VULKAN_QMATMUL_ENTRY_POINTS: &[(&str, KernelRef)] = &[vk_ep!(
    "qmatmul_vk",
    crate::vulkan_dispatch::qmatmul::qmatmul_vk
)];

/// The Vulkan **FlashAttention** family's `symbol → production wrapper` map —
/// the FULL family: 6 sections resolving to 6 distinct wrappers, keyed as 12
/// bindings (each section's `alibi_slopes` optional-last fan doubles it). The
/// forward `OpKind::FlashAttn` at THREE per-dtype wrappers
/// (`flash_attn::flash_attn_{f32,bf16,f16}`) + the three backward selectors
/// `OpKind::FlashAttnBackward{Q,K,V}` at f32-only wrappers
/// (`flash_attn::flash_attn_backward_{q,k,v}_f32`). Contract:
/// `docs/kernel-contracts/vulkan/attention.fkc.md`, authored per-(op, dtype)
/// (the conv2d + CPU-attention per-dtype-section precedent).
///
/// Because the forward wrappers are DISTINCT per dtype, each section is
/// SINGLE-dtype-per-operand and names its `entry_point` in FULL (no dtype-fan
/// suffix), so the importer resolves the symbol AS-IS — the cast-family
/// precedent. The importer keys `[q,k,v,(alibi,)out]` (forward) and
/// `[q,k,v,do,(alibi,)out]` (backward), byte-for-byte the deleted hand-written
/// `register_with_precision(OpKind::{FlashAttn,FlashAttnBackward{Q,K,V}}, …)`
/// regs. Caps ride through contiguous-only (`requires_contiguous` ⇒
/// `strided_input == false`); precision is the corrected audited-nondeterministic
/// `none(reason)` seed (single-pass shared-mem softmax reduction; the retired
/// `VULKAN_{FLOAT,HALF}_POINTWISE_PRECISION` consts over-claimed bit-stability).
pub static VULKAN_ATTENTION_ENTRY_POINTS: &[(&str, KernelRef)] = &[
    // Forward: 3 distinct per-dtype wrappers.
    vk_ep!(
        "flash_attn_f32",
        crate::vulkan_dispatch::flash_attn::flash_attn_f32
    ),
    vk_ep!(
        "flash_attn_bf16",
        crate::vulkan_dispatch::flash_attn::flash_attn_bf16
    ),
    vk_ep!(
        "flash_attn_f16",
        crate::vulkan_dispatch::flash_attn::flash_attn_f16
    ),
    // Backward Q/K/V: f32-only distinct per-selector wrappers.
    vk_ep!(
        "flash_attn_backward_q_f32",
        crate::vulkan_dispatch::flash_attn::flash_attn_backward_q_f32
    ),
    vk_ep!(
        "flash_attn_backward_k_f32",
        crate::vulkan_dispatch::flash_attn::flash_attn_backward_k_f32
    ),
    vk_ep!(
        "flash_attn_backward_v_f32",
        crate::vulkan_dispatch::flash_attn::flash_attn_backward_v_f32
    ),
];

/// The built-in Vulkan backend's [`LinkRegistry`] — resolves a contract's
/// `entry_point` symbols against [`VULKAN_CAST_ENTRY_POINTS`] +
/// [`VULKAN_ELEMENTWISE_ENTRY_POINTS`] + [`VULKAN_MATMUL_ENTRY_POINTS`] +
/// [`VULKAN_CONV_ENTRY_POINTS`] (and the future Vulkan families as they migrate
/// off their hand-written regs). Unresolved → `None`, which the importer turns
/// into a typed `UnknownEntryPoint` error (never a panic, never a fabricated
/// pointer).
pub struct VulkanLinkRegistry;

impl LinkRegistry for VulkanLinkRegistry {
    fn resolve_primitive(&self, symbol: &str) -> Option<KernelRef> {
        // Chain every migrated Vulkan family's table; each symbol is unique
        // across families (cast_*, per-op elementwise, matmul_*, conv2d_*), so
        // order is immaterial.
        VULKAN_CAST_ENTRY_POINTS
            .iter()
            .chain(VULKAN_ELEMENTWISE_ENTRY_POINTS.iter())
            .chain(VULKAN_MATMUL_ENTRY_POINTS.iter())
            .chain(VULKAN_CONV_ENTRY_POINTS.iter())
            .chain(VULKAN_SELECT_ENTRY_POINTS.iter())
            .chain(VULKAN_SCATTER_ENTRY_POINTS.iter())
            .chain(VULKAN_MOVEMENT_ENTRY_POINTS.iter())
            .chain(VULKAN_SHAPE_ENTRY_POINTS.iter())
            .chain(VULKAN_PAD_COPY_ENTRY_POINTS.iter())
            .chain(VULKAN_WRITE_SLICE_ENTRY_POINTS.iter())
            .chain(VULKAN_ROPE_ENTRY_POINTS.iter())
            .chain(VULKAN_REDUCE_ENTRY_POINTS.iter())
            .chain(VULKAN_NORM_ENTRY_POINTS.iter())
            .chain(VULKAN_QMATMUL_ENTRY_POINTS.iter())
            .chain(VULKAN_ATTENTION_ENTRY_POINTS.iter())
            .find(|(s, _)| *s == symbol)
            .map(|(_, k)| *k)
    }

    fn resolve_fused(&self, _symbol: &str) -> Option<KernelRef> {
        // No fused-op contracts in the Vulkan cast / elementwise corpus — every
        // section is a primitive `op_kind`.
        None
    }
}