fuel-dispatch 0.24.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.
Documentation
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
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
---
fkc_version: 1
provider:
  name: fuel-vulkan-kernels
  backend: Vulkan                                       # maps to BackendId::Vulkan
  kernel_source: "vulkan-slang"                         # the BindingEntry.kernel_source tag
  link_registry: fuel_vulkan_backend::fkc::ENTRY_POINTS # §12.6 symbol→KernelRef map
  revision_base: "git:f41137b4"                         # provider build id, folded into kernel_revision_hash
---

# fuel-vulkan-kernels — padding kernel contracts


Vulkan/Slang padding kernels from `fuel-kernels-source/kernels/pad_*.slang` (AOT-compiled to SPIR-V
in `fuel-vulkan-kernels/spv/`, registered in the `EMBEDDED` table), with Rust dispatch wrappers in
`fuel-vulkan-backend/src/lib.rs`. The family covers the three forward pad modes (Constant / Reflect /
Replicate), the matching backwards (Constant, plus the atomic-accumulate Reflect / Replicate), and
`masked_fill`.

Two distinct kernel shapes live here, faithful to the as-built split:

- **Byte-width-keyed, dtype-agnostic data movers** — `pad_const_b{1,2,4,8}`, `pad_reflect_b{1,2,4,8}`,
  `pad_replicate_b{1,2,4,8}`, `pad_backward_const_b{1,2,4,8}`, `masked_fill_b{1,2,4,8}`. Each variant
  is keyed by element **byte width** (b1=1B u8/i8; b2=2B f16/bf16/i16/u16; b4=4B f32/i32/u32; b8=8B
  f64/i64), reads/writes raw words (u32-addressed), does **no arithmetic**, and is therefore
  **bit-exact for any dtype of that width**. One contract per variant; each lists the dtypes that
  share its element size.
- **Dtype-specific atomic-accumulate backwards** — `pad_backward_reflect_{f32,f64,f16,bf16}` and
  `pad_backward_replicate_{f32,f64,f16,bf16}`. Reflect/Replicate forward map **multiple output
  positions onto one input slot**, so the backward must *sum* gradients into each `grad_in` slot. The
  Vulkan kernels do this with a per-element atomic compare-and-swap (CAS) read-modify-write: f32 via
  uint CAS, f64 via u64 CAS (needs `shaderInt64` + 64-bit atomics + f64), f16/bf16 via sub-word CAS
  (math at f32). `grad_in` **must be zero-filled by the wrapper before dispatch** (the kernel only
  accumulates), and because the CAS accumulation order is scheduler-dependent, FP addition is **not
  associative**, so these are `determinism: nondeterministic` with an audited `none(reason)`
  precision (no silent unaudited nondeterminism).

Every input here is **contiguous, offset 0** — none of these kernels consults a `Layout` or walks a
signed stride. Shape/stride semantics arrive as an explicit `shape_buf` storage buffer
(`[in_shape, out_shape, left_pad]` for the pad kernels; `[src_shape, out_shape]` is not used here),
so `awkward_layout_strategy: requires_contiguous` throughout — the pipelined executor's
auto-Contiguize pass (itself an FKC kernel, §4.3) realizes any strided/broadcast/offset producer into
a dense buffer before these kernels run, and the planner sums that Contiguize's cost. Rank ≤ 8 for
all multi-dim pad/backward kernels (the `shape_buf` is sized for it). Output is **always contiguous**.

Cost on every kernel is `provenance: judge_measured` — the Judge bootstraps it (FKC stays agnostic to
how, §4.4). A `bytes_moved` bandwidth formula hint is given where genuinely derivable (these are pure
byte movers / accumulators, bandwidth-bound over element counts); `overhead_ns` (Vulkan command-buffer
submit/dispatch latency) is left `~` for the Judge to measure, and no FLOPs/latency numbers are
fabricated. Symbol convention: `n_out` = product of output elements; `n_in` = product of input
elements; `dtype_bytes` = the variant's element byte width (1/2/4/8).

---

## pad_const_b1  (constant-fill pad — 1-byte elements)


One-line: constant-fill pad for 1-byte (u8/i8) elements; writes one fill word into pad slots, copies the input region into the interior.

Constant-fill pad (`OpKind::Pad`, Constant mode) for 1-byte elements. One thread per output element:
the thread decomposes its linear output index into rank-N coordinates against `out_shape`
(from `shape_buf`), subtracts the per-axis `left_pad`, and if the resulting coordinate lies inside
`in_shape` for every axis it copies that input element's byte; otherwise it stores the `fill_value`
bit pattern (passed as a u32, low 8 bits used for the 1-byte element). Rank ≤ 8. Numerics: none — a
byte copy / constant store, so it is bit-exact for any 1-byte dtype (the fill value's bits are
supplied pre-encoded by the wrapper). Perf: bandwidth-bound, one linear pass over the output
(`n_out` writes, with the interior also reading `n_in` input bytes). Limitations: src/out
**contiguous, offset 0** only; `out_shape[i]` must equal `in_shape[i] + left_pad[i] + right_pad[i]`
per axis (the dispatch wrapper guarantees this); no symbolic-extent awareness (reads full concrete
shapes from `shape_buf`).

```fkc
kernel: pad_const_b1
op_kind: Pad                        # Constant mode (byte-width-keyed variant, 1B)
blurb: "Constant-fill pad for 1-byte (u8/i8) elements; writes one fill word into pad slots, copies the input region into the interior."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_const_b1"   # wrapper pad_const_bytes lib.rs:7116; kernel pad_const_b4.slang:25 (b1 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [U8, I8]                       # 1-byte elements (byte-width-keyed, dtype-agnostic)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad                    # OpParams::Pad (primitive namespace)
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      fill_value: { kind: u32, note: "fill element bit pattern (low 8 bits for a 1-byte element)" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad] (rank entries each)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)         # byte width preserved; dtype = input dtype
      shape_rule: from_params(out_shape)      # per-axis in_shape[i] + left_pad[i] + right_pad[i]
      layout_guarantee: contiguous            # fresh dense row-major; executor pre-allocates
      aliasing: none                          # full overwrite (every output slot written)

caps:
  awkward_layout_strategy: requires_contiguous   # ← planner inserts Op::Contiguize (itself an FKC kernel) + sums its cost
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32                 # u32-word addressed (1-byte elements packed in words)

cost:
  provenance: judge_measured                  # Judge bootstraps; bandwidth-bound byte mover
  class: cheap_elementwise
  flops: "0"                                  # pure copy / constant store, no arithmetic
  bytes_moved: "(n_out + n_in) * dtype_bytes" # write every output; read the input interior
  overhead_ns: ~                              # judge_measured (Vulkan dispatch submit)
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true           # byte copy / constant store: bit-exact for any dtype, any hardware
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure byte copy (input region) + constant store (pad slots); no arithmetic, bit-exact for every 1-byte dtype."

determinism: bitwise                          # exact byte shuffle/store, hardware-independent
```

## pad_const_b2  (constant-fill pad — 2-byte elements)


One-line: constant-fill pad for 2-byte (f16/bf16/i16/u16) elements; copies the input region, fills pad slots with one constant word.

Constant-fill pad (`OpKind::Pad`, Constant mode) for 2-byte elements. Identical algorithm to
`pad_const_b1` keyed to a 2-byte element: one thread per output element, decompose-against-`out_shape`,
shift by `left_pad`, copy-from-input-if-interior else store the `fill_value` low 16 bits. Rank ≤ 8.
Numerics: none — byte copy / constant store, bit-exact for any 2-byte dtype. Perf: bandwidth-bound,
one linear pass over the output. Limitations: src/out contiguous, offset 0; per-axis
`out_shape[i] == in_shape[i] + left_pad[i] + right_pad[i]`.

```fkc
kernel: pad_const_b2
op_kind: Pad                        # Constant mode (2B)
blurb: "Constant-fill pad for 2-byte (f16/bf16/i16/u16) elements; copies the input region, fills pad slots with one constant word."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_const_b2"   # wrapper pad_const_bytes lib.rs:7116; pad_const_b4.slang:25 (b2 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F16, BF16, I16]               # 2-byte elements share this byte-width variant (u16 carried as I16 slot; no U16 DType)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      fill_value: { kind: u32, note: "fill element bit pattern (low 16 bits for a 2-byte element)" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "(n_out + n_in) * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure byte copy + constant store; no arithmetic, bit-exact for every 2-byte dtype."

determinism: bitwise
```

## pad_const_b4  (constant-fill pad — 4-byte elements)


One-line: constant-fill pad for 4-byte (f32/i32/u32) elements; copies the input region, fills pad slots with one constant word.

Constant-fill pad (`OpKind::Pad`, Constant mode) for 4-byte elements — the canonical variant whose
Slang source (`pad_const_b4.slang:25`) backs the family. One thread per output element: decompose the
linear output index into rank-N coords against `out_shape` (from `shape_buf`), shift by `left_pad`,
and copy the corresponding input word if in-bounds for all axes else store `fill_value`. Rank ≤ 8.
Numerics: none — a 32-bit word copy / constant store, bit-exact for any 4-byte dtype. Perf:
bandwidth-bound, one linear pass over the output. Limitations: src/out contiguous, offset 0; per-axis
`out_shape[i] == in_shape[i] + left_pad[i] + right_pad[i]`.

```fkc
kernel: pad_const_b4
op_kind: Pad                        # Constant mode (4B canonical)
blurb: "Constant-fill pad for 4-byte (f32/i32/u32) elements; copies the input region, fills pad slots with one constant word."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_const_b4"   # wrapper pad_const_bytes lib.rs:7116; pad_const_b4.slang:25
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F32, I32, U32]                # 4-byte elements
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      fill_value: { kind: u32, note: "fill element bit pattern (full 32 bits for a 4-byte element)" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "(n_out + n_in) * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure 32-bit word copy + constant store; no arithmetic, bit-exact for every 4-byte dtype."

determinism: bitwise
```

## pad_const_b8  (constant-fill pad — 8-byte elements)


One-line: constant-fill pad for 8-byte (f64/i64) elements; copies the input region, fills pad slots with one constant value.

Constant-fill pad (`OpKind::Pad`, Constant mode) for 8-byte elements. Same algorithm as the other
`pad_const_b*` variants keyed to an 8-byte element (handled as a 2-word / u32-pair move). One thread
per output element. Rank ≤ 8. Numerics: none — a byte copy / constant store, bit-exact for any 8-byte
dtype. Perf: bandwidth-bound, one linear pass over the output. Limitations: src/out contiguous,
offset 0; per-axis `out_shape[i] == in_shape[i] + left_pad[i] + right_pad[i]`. (The 64-bit
`fill_value` is supplied via the wrapper's parameter packing for the wide element.)

```fkc
kernel: pad_const_b8
op_kind: Pad                        # Constant mode (8B)
blurb: "Constant-fill pad for 8-byte (f64/i64) elements; copies the input region, fills pad slots with one constant value."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_const_b8"   # wrapper pad_const_bytes lib.rs:7116; pad_const_b4.slang:25 (b8 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F64, I64]                     # 8-byte elements
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      fill_value: { kind: u32, note: "fill element bit pattern (8-byte element packed as a u32 pair by the wrapper)" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32                 # 8-byte elements addressed as u32 word pairs

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "(n_out + n_in) * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure byte copy + constant store; no arithmetic, bit-exact for every 8-byte dtype."

determinism: bitwise
```

## pad_reflect_b1  (reflect pad — 1-byte elements)


One-line: reflect pad (edge not repeated) for 1-byte elements; maps each output element from its mirrored input position.

Reflect pad (`OpKind::Pad`, Reflect mode, PyTorch "reflect" — no-repeat) for 1-byte elements. One
thread per output element: per axis, for `i = out_coord - left_pad` and input dim `n`, the mirror map
is `i < 0 → -i`; `0 ≤ i < n → i`; `i ≥ n → 2*(n-1) - i` — the edge element is **not** repeated (a true
reflection about the boundary element). The thread reads the mapped input byte and stores it. Rank ≤ 8.
Numerics: none — byte copy via the reflect index map, bit-exact for any 1-byte dtype. Perf:
bandwidth-bound, one linear pass over the output (`n_out` mapped reads + writes).
**PRECONDITION (caller-enforced, load-bearing):** per-axis `left_pad ≤ in_dim-1` AND
`right_pad ≤ in_dim-1`, otherwise the reflection runs off the opposite side and produces out-of-range
indices; the dispatch wrapper validates this, the kernel does not re-check it. Limitations: src/out
contiguous, offset 0.

```fkc
kernel: pad_reflect_b1
op_kind: Pad                        # Reflect mode (1B)
blurb: "Reflect pad (edge not repeated) for 1-byte elements; maps each output element from its mirrored input position."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_reflect_b1"   # wrapper pad_reflect_bytes lib.rs:6835; pad_reflect_b4.slang:42 (b1 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [U8, I8]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]; per-axis left_pad<=in_dim-1 AND right_pad<=in_dim-1 (reflect validity)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_out * dtype_bytes"      # one mapped read + write per output element
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure byte copy via reflect index map; no arithmetic, bit-exact for every 1-byte dtype. Caller must keep left_pad/right_pad <= in_dim-1 per axis."

determinism: bitwise
```

## pad_reflect_b2  (reflect pad — 2-byte elements)


One-line: reflect pad (edge not repeated) for 2-byte elements; maps each output element from its mirrored input position.

Reflect pad for 2-byte elements — same mirror map as `pad_reflect_b1` keyed to a 2-byte element. One
thread per output element; reads the mapped input word, stores it. Rank ≤ 8. Numerics: none, bit-exact.
Perf: bandwidth-bound, one pass over the output. Same **PRECONDITION**: per-axis `left_pad ≤ in_dim-1`
AND `right_pad ≤ in_dim-1` (wrapper-validated). Contiguous, offset 0.

```fkc
kernel: pad_reflect_b2
op_kind: Pad                        # Reflect mode (2B)
blurb: "Reflect pad (edge not repeated) for 2-byte elements; maps each output element from its mirrored input position."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_reflect_b2"   # wrapper pad_reflect_bytes lib.rs:6835; pad_reflect_b4.slang:42 (b2 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F16, BF16, I16]               # 2-byte byte-width-keyed (u16 carried as I16 slot; no U16 DType)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]; reflect validity left_pad<=in_dim-1 AND right_pad<=in_dim-1" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure byte copy via reflect index map; no arithmetic, bit-exact for every 2-byte dtype. Caller must keep left_pad/right_pad <= in_dim-1 per axis."

determinism: bitwise
```

## pad_reflect_b4  (reflect pad — 4-byte elements)


One-line: reflect pad (edge not repeated) for 4-byte elements; maps each output element from its mirrored input position.

Reflect pad for 4-byte elements — the canonical variant whose Slang source (`pad_reflect_b4.slang:42`)
backs the family. One thread per output element; per-axis mirror map (`i<0→-i`, `0≤i<n→i`,
`i≥n→2*(n-1)-i`), reads the mapped input word, stores it. Rank ≤ 8. Numerics: none, bit-exact. Perf:
bandwidth-bound, one pass over the output. Same **PRECONDITION**: per-axis `left_pad ≤ in_dim-1` AND
`right_pad ≤ in_dim-1` (wrapper-validated). Contiguous, offset 0.

```fkc
kernel: pad_reflect_b4
op_kind: Pad                        # Reflect mode (4B canonical)
blurb: "Reflect pad (edge not repeated) for 4-byte elements; maps each output element from its mirrored input position."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_reflect_b4"   # wrapper pad_reflect_bytes lib.rs:6835; pad_reflect_b4.slang:42
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F32, I32, U32]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]; reflect validity left_pad<=in_dim-1 AND right_pad<=in_dim-1" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure 32-bit word copy via reflect index map; no arithmetic, bit-exact for every 4-byte dtype. Caller must keep left_pad/right_pad <= in_dim-1 per axis."

determinism: bitwise
```

## pad_reflect_b8  (reflect pad — 8-byte elements)


One-line: reflect pad (edge not repeated) for 8-byte elements; maps each output element from its mirrored input position.

Reflect pad for 8-byte elements — same mirror map keyed to an 8-byte element (u32-pair move). One
thread per output element. Rank ≤ 8. Numerics: none, bit-exact. Perf: bandwidth-bound, one pass over
the output. Same **PRECONDITION**: per-axis `left_pad ≤ in_dim-1` AND `right_pad ≤ in_dim-1`
(wrapper-validated). Contiguous, offset 0.

```fkc
kernel: pad_reflect_b8
op_kind: Pad                        # Reflect mode (8B)
blurb: "Reflect pad (edge not repeated) for 8-byte elements; maps each output element from its mirrored input position."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_reflect_b8"   # wrapper pad_reflect_bytes lib.rs:6835; pad_reflect_b4.slang:42 (b8 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F64, I64]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]; reflect validity left_pad<=in_dim-1 AND right_pad<=in_dim-1" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure byte copy via reflect index map; no arithmetic, bit-exact for every 8-byte dtype. Caller must keep left_pad/right_pad <= in_dim-1 per axis."

determinism: bitwise
```

## pad_replicate_b1  (replicate / edge-repeat pad — 1-byte elements)


One-line: replicate (edge-repeat) pad for 1-byte elements; out-of-range coords clamp to [0, in_dim-1].

Replicate / edge-repeat pad (`OpKind::Pad`, Replicate mode) for 1-byte elements. One thread per
output element: per axis, for `i = out_coord - left_pad`, the clamp map is `i < 0 → 0`;
`0 ≤ i < n → i`; `i ≥ n → n-1` — the boundary element is clamped/repeated outward. Reads the mapped
input byte and stores it. Rank ≤ 8. **No precondition on pad sizes** (clamping is well-defined for any
pad width — unlike Reflect). Numerics: none — byte copy via the clamp index map, bit-exact for any
1-byte dtype. Perf: bandwidth-bound, one linear pass over the output. Limitations: src/out contiguous,
offset 0. (Embedded SPIR-V only — `pad_replicate_b*.spv`; contract read from the Rust wrapper +
`EMBEDDED` doc comments.)

```fkc
kernel: pad_replicate_b1
op_kind: Pad                        # Replicate mode (1B)
blurb: "Replicate (edge-repeat) pad for 1-byte elements; out-of-range coords clamp to [0, in_dim-1]."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_replicate_b1"   # wrapper pad_replicate_bytes lib.rs:6710; SPIR-V pad_replicate_b4.spv (b1 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [U8, I8]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad] (no pad-size precondition for replicate)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure byte copy via replicate (edge-clamp) index map; no arithmetic, bit-exact for every 1-byte dtype."

determinism: bitwise
```

## pad_replicate_b2  (replicate / edge-repeat pad — 2-byte elements)


One-line: replicate (edge-repeat) pad for 2-byte elements; out-of-range coords clamp to [0, in_dim-1].

Replicate pad for 2-byte elements — same edge-clamp map as `pad_replicate_b1` keyed to a 2-byte
element. One thread per output element; reads the clamped input word, stores it. Rank ≤ 8. No
precondition on pad sizes. Numerics: none, bit-exact. Perf: bandwidth-bound, one pass over the output.
Contiguous, offset 0. (Embedded SPIR-V only.)

```fkc
kernel: pad_replicate_b2
op_kind: Pad                        # Replicate mode (2B)
blurb: "Replicate (edge-repeat) pad for 2-byte elements; out-of-range coords clamp to [0, in_dim-1]."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_replicate_b2"   # wrapper pad_replicate_bytes lib.rs:6710; SPIR-V pad_replicate_b4.spv (b2 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F16, BF16, I16]               # 2-byte byte-width-keyed (u16 carried as I16 slot; no U16 DType)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad] (no pad-size precondition)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure byte copy via replicate (edge-clamp) index map; no arithmetic, bit-exact for every 2-byte dtype."

determinism: bitwise
```

## pad_replicate_b4  (replicate / edge-repeat pad — 4-byte elements)


One-line: replicate (edge-repeat) pad for 4-byte elements; out-of-range coords clamp to [0, in_dim-1].

Replicate pad for 4-byte elements — the canonical variant. One thread per output element; per-axis
edge-clamp map (`i<0→0`, `0≤i<n→i`, `i≥n→n-1`), reads the clamped input word, stores it. Rank ≤ 8. No
precondition on pad sizes. Numerics: none, bit-exact. Perf: bandwidth-bound, one pass over the output.
Contiguous, offset 0. (Embedded SPIR-V only — `pad_replicate_b4.spv`.)

```fkc
kernel: pad_replicate_b4
op_kind: Pad                        # Replicate mode (4B canonical)
blurb: "Replicate (edge-repeat) pad for 4-byte elements; out-of-range coords clamp to [0, in_dim-1]."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_replicate_b4"   # wrapper pad_replicate_bytes lib.rs:6710; SPIR-V pad_replicate_b4.spv
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F32, I32, U32]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad] (no pad-size precondition)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure 32-bit word copy via replicate (edge-clamp) index map; no arithmetic, bit-exact for every 4-byte dtype."

determinism: bitwise
```

## pad_replicate_b8  (replicate / edge-repeat pad — 8-byte elements)


One-line: replicate (edge-repeat) pad for 8-byte elements; out-of-range coords clamp to [0, in_dim-1].

Replicate pad for 8-byte elements — same edge-clamp map keyed to an 8-byte element (u32-pair move).
One thread per output element. Rank ≤ 8. No precondition on pad sizes. Numerics: none, bit-exact.
Perf: bandwidth-bound, one pass over the output. Contiguous, offset 0. (Embedded SPIR-V only.)

```fkc
kernel: pad_replicate_b8
op_kind: Pad                        # Replicate mode (8B)
blurb: "Replicate (edge-repeat) pad for 8-byte elements; out-of-range coords clamp to [0, in_dim-1]."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_replicate_b8"   # wrapper pad_replicate_bytes lib.rs:6710; SPIR-V pad_replicate_b4.spv (b8 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F64, I64]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=out"
  op_params:
    variant: Pad
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad] (no pad-size precondition)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: from_params(out_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_out * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Pure byte copy via replicate (edge-clamp) index map; no arithmetic, bit-exact for every 8-byte dtype."

determinism: bitwise
```

## pad_backward_const_b1  (Constant-pad backward — 1-byte elements)


One-line: Constant-pad gradient for 1-byte elements; one thread per input element reads grad_out at in_coord+left_pad (no accumulation).

Backward of Constant pad (`OpKind::PadBackward`, Constant mode) for 1-byte elements. Because Constant
pad maps each input element to **exactly one** output position (the pad slots come from the constant,
not the input), the backward is a simple **gather, not an accumulate**: one thread per *input* element
reads `grad_out` at the shifted position `in_coord + left_pad` (computed per-axis from `shape_buf`) and
writes it straight to `grad_in`. No atomics, no reduction. Rank ≤ 8. Numerics: none — byte copy,
bit-exact for any 1-byte dtype. Perf: bandwidth-bound, one linear pass over the input (`n_in` mapped
reads + writes). Output behavior: `grad_in` is **fully written** (every input slot gets exactly one
gradient), so `aliasing: none`. Limitations: grad_out/grad_in contiguous, offset 0.

```fkc
kernel: pad_backward_const_b1
op_kind: PadBackward                # Constant-mode backward (1B, gather)
blurb: "Constant-pad gradient for 1-byte elements; one thread per input element reads grad_out at in_coord+left_pad (no accumulation)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_const_b1"   # wrapper pad_backward_const_bytes lib.rs:6594; pad_backward_const_b4.slang:28 (b1 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [U8, I8]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in"
  op_params:
    variant: PadBackward            # OpParams::PadBackward (primitive namespace)
    fields:
      n_in:       { kind: u32, constraint: "== product(in_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)       # byte width preserved
      shape_rule: from_params(in_shape)        # the (smaller) input shape
      layout_guarantee: contiguous
      aliasing: none                           # one gradient per input slot; full write, not RMW

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"                                  # pure gather copy, no arithmetic
  bytes_moved: "2 * n_in * dtype_bytes"       # one mapped read of grad_out + write of grad_in per input element
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true           # gather copy, no accumulation: bit-exact, any hardware
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Constant-pad backward is a 1:1 gather (no accumulation); pure byte copy, bit-exact for every 1-byte dtype."

determinism: bitwise
```

## pad_backward_const_b2  (Constant-pad backward — 2-byte elements)


One-line: Constant-pad gradient for 2-byte elements; one thread per input element gathers grad_out at in_coord+left_pad (no accumulation).

Backward of Constant pad for 2-byte elements — same 1:1 gather as `pad_backward_const_b1` keyed to a
2-byte element. One thread per input element reads `grad_out[in_coord + left_pad]`, writes `grad_in`.
No atomics. Rank ≤ 8. Numerics: none, bit-exact. Perf: bandwidth-bound, one pass over the input.
`grad_in` fully written; `aliasing: none`. Contiguous, offset 0.

```fkc
kernel: pad_backward_const_b2
op_kind: PadBackward                # Constant-mode backward (2B)
blurb: "Constant-pad gradient for 2-byte elements; one thread per input element gathers grad_out at in_coord+left_pad (no accumulation)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_const_b2"   # wrapper pad_backward_const_bytes lib.rs:6594; pad_backward_const_b4.slang:28 (b2 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [F16, BF16, I16]               # 2-byte byte-width-keyed (u16 carried as I16 slot; no U16 DType)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in"
  op_params:
    variant: PadBackward
    fields:
      n_in:       { kind: u32, constraint: "== product(in_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_in * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Constant-pad backward is a 1:1 gather (no accumulation); pure byte copy, bit-exact for every 2-byte dtype."

determinism: bitwise
```

## pad_backward_const_b4  (Constant-pad backward — 4-byte elements)


One-line: Constant-pad gradient for 4-byte elements; one thread per input element gathers grad_out at in_coord+left_pad (no accumulation).

Backward of Constant pad for 4-byte elements — the canonical variant whose Slang source
(`pad_backward_const_b4.slang:28`) backs the family. One thread per input element reads
`grad_out[in_coord + left_pad]` (per-axis shift from `shape_buf`), writes `grad_in`. No atomics
(Constant maps 1:1). Rank ≤ 8. Numerics: none, bit-exact. Perf: bandwidth-bound, one pass over the
input. `grad_in` fully written; `aliasing: none`. Contiguous, offset 0.

```fkc
kernel: pad_backward_const_b4
op_kind: PadBackward                # Constant-mode backward (4B canonical)
blurb: "Constant-pad gradient for 4-byte elements; one thread per input element gathers grad_out at in_coord+left_pad (no accumulation)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_const_b4"   # wrapper pad_backward_const_bytes lib.rs:6594; pad_backward_const_b4.slang:28
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [F32, I32, U32]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in"
  op_params:
    variant: PadBackward
    fields:
      n_in:       { kind: u32, constraint: "== product(in_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_in * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Constant-pad backward is a 1:1 gather (no accumulation); pure 32-bit word copy, bit-exact for every 4-byte dtype."

determinism: bitwise
```

## pad_backward_const_b8  (Constant-pad backward — 8-byte elements)


One-line: Constant-pad gradient for 8-byte elements; one thread per input element gathers grad_out at in_coord+left_pad (no accumulation).

Backward of Constant pad for 8-byte elements — same 1:1 gather keyed to an 8-byte element (u32-pair
move). One thread per input element. No atomics. Rank ≤ 8. Numerics: none, bit-exact. Perf:
bandwidth-bound, one pass over the input. `grad_in` fully written; `aliasing: none`. Contiguous,
offset 0.

```fkc
kernel: pad_backward_const_b8
op_kind: PadBackward                # Constant-mode backward (8B)
blurb: "Constant-pad gradient for 8-byte elements; one thread per input element gathers grad_out at in_coord+left_pad (no accumulation)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_const_b8"   # wrapper pad_backward_const_bytes lib.rs:6594; pad_backward_const_b4.slang:28 (b8 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [F64, I64]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in"
  op_params:
    variant: PadBackward
    fields:
      n_in:       { kind: u32, constraint: "== product(in_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "2 * n_in * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Constant-pad backward is a 1:1 gather (no accumulation); pure byte copy, bit-exact for every 8-byte dtype."

determinism: bitwise
```

## pad_backward_reflect_f32  (Reflect-pad backward — f32, atomic accumulate)


One-line: Reflect-pad gradient on f32; one thread per output element atomic-accumulates grad_out into the mirrored grad_in slot (uint CAS).

Backward of Reflect pad (`OpKind::PadBackward`, Reflect mode) on `f32`. Reflect forward maps multiple
output positions onto one input slot, so the backward **sums** gradients into each `grad_in` slot:
one thread per *output* element computes the mirrored input position (the same reflect map as the
forward — `i<0→-i`, `0≤i<n→i`, `i≥n→2*(n-1)-i` per axis from `shape_buf`) and atomically adds
`grad_out` into that `grad_in` slot via a **uint compare-and-swap** read-modify-write (bounded
1000-iteration CAS loop; under extreme contention a value may be dropped). `grad_in` **must be
zero-filled by the wrapper before dispatch** — the kernel only accumulates. Rank ≤ 8. Numerics: f32
add. Perf: bandwidth-bound over `n_out` reads + CAS RMWs into `n_in` slots. Output behavior: `grad_in`
is **read-modify-written / atomic-accumulated** (`aliasing: accumulate(grad_in)`). Determinism: the
CAS accumulation **order is scheduler-dependent** and f32 addition is not associative, so the kernel
is **nondeterministic** (audited, no static bound). Contiguous, offset 0.

```fkc
kernel: pad_backward_reflect_f32
op_kind: PadBackward                # Reflect-mode backward, f32 (atomic accumulate)
blurb: "Reflect-pad gradient on f32; one thread per output element atomic-accumulates grad_out into the mirrored grad_in slot (uint CAS)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_reflect_f32"   # wrapper pad_backward_atomic_bytes lib.rs:6462; pad_backward_reflect_f32.slang:51
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [F32]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in; element_count == n_out"
  op_params:
    variant: PadBackward            # OpParams::PadBackward (primitive namespace)
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)       # F32 in → F32 out
      shape_rule: from_params(in_shape)        # the (smaller) input shape
      layout_guarantee: contiguous
      aliasing: accumulate(grad_in)            # atomic RMW into a wrapper-zeroed grad_in buffer

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false                            # output buffer is a distinct, wrapper-zeroed accumulator
  alignment_bytes: 16
  access_granularity_bits: 32                 # f32 element granular (uint CAS)

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "n_out"                              # one f32 atomic add per output element
  bytes_moved: "n_out * dtype_bytes + 2 * n_out * dtype_bytes"   # read grad_out + CAS read-write of grad_in slot
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: false          # scheduler-dependent CAS accumulation order; f32 add non-associative
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true                               # audited none(reason): atomic FP accumulation order is nondeterministic
  notes: "Atomic uint-CAS accumulate (bounded 1000-iter loop); scheduler-dependent summation order, f32 non-associative, not bit-stable. grad_in must be zero-filled by the wrapper before dispatch."

determinism: nondeterministic                 # atomic FP accumulation; run-to-run variation possible
```

## pad_backward_reflect_f64  (Reflect-pad backward — f64, atomic accumulate)


One-line: Reflect-pad gradient on f64; one thread per output element atomic-accumulates grad_out into the mirrored grad_in slot (u64 CAS).

Backward of Reflect pad on `f64`. Identical structure to `pad_backward_reflect_f32` but the atomic is
a **u64 compare-and-swap** (requires `shaderInt64` + 64-bit atomics + f64 device support). One thread
per output element maps to the mirrored input slot and CAS-accumulates `grad_out` into `grad_in`
(bounded 1000-iter loop). `grad_in` **must be zero-filled by the wrapper before dispatch**. Rank ≤ 8.
Numerics: native f64 add. Perf: bandwidth-bound over `n_out` reads + CAS RMWs. Output: atomic
accumulate (`aliasing: accumulate(grad_in)`). Determinism: scheduler-dependent CAS order, f64 add
non-associative ⇒ **nondeterministic** (audited, no bound). Contiguous, offset 0.

```fkc
kernel: pad_backward_reflect_f64
op_kind: PadBackward                # Reflect-mode backward, f64 (atomic accumulate)
blurb: "Reflect-pad gradient on f64; one thread per output element atomic-accumulates grad_out into the mirrored grad_in slot (u64 CAS)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_reflect_f64"   # wrapper pad_backward_atomic_bytes lib.rs:6462; pad_backward_reflect_f32.slang:51 (f64 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [F64]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in; element_count == n_out"
  op_params:
    variant: PadBackward
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)       # F64 in → F64 out
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: accumulate(grad_in)

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 64                 # f64 element granular (u64 CAS; needs shaderInt64 + 64-bit atomics + f64)

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "n_out"
  bytes_moved: "n_out * dtype_bytes + 2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: false
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Atomic u64-CAS accumulate (bounded 1000-iter loop); scheduler-dependent summation order, f64 non-associative, not bit-stable. Needs shaderInt64+64-bit atomics+f64. grad_in must be zero-filled by the wrapper before dispatch."

determinism: nondeterministic
```

## pad_backward_reflect_f16  (Reflect-pad backward — f16, atomic accumulate)


One-line: Reflect-pad gradient on f16; one thread per output element atomic-accumulates grad_out into the mirrored grad_in slot (sub-word CAS, f32 math).

Backward of Reflect pad on `f16`. Same mirrored-slot accumulation as the f32/f64 variants, but the
atomic is a **sub-word compare-and-swap**: each thread reads the enclosing 32-bit word, widens the
target f16 lane to f32, adds the (f32-widened) `grad_out`, narrows back to f16, and CAS-writes the
updated word (bounded 1000-iter loop; sub-word so a half-word is updated without racing the other
lane). `grad_in` **must be zero-filled by the wrapper before dispatch**. Rank ≤ 8. Numerics: math at
f32, narrow to f16 on store. Perf: bandwidth-bound over `n_out` reads + CAS RMWs. Output: atomic
accumulate (`aliasing: accumulate(grad_in)`). Determinism: scheduler-dependent CAS order + non-assoc
f32 add ⇒ **nondeterministic** (audited, no bound). Contiguous, offset 0.

```fkc
kernel: pad_backward_reflect_f16
op_kind: PadBackward                # Reflect-mode backward, f16 (sub-word atomic accumulate)
blurb: "Reflect-pad gradient on f16; one thread per output element atomic-accumulates grad_out into the mirrored grad_in slot (sub-word CAS, f32 math)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_reflect_f16"   # wrapper pad_backward_atomic_bytes lib.rs:6462; pad_backward_reflect_f32.slang:51 (f16 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [F16]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in; element_count == n_out"
  op_params:
    variant: PadBackward
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)       # F16 in → F16 out
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: accumulate(grad_in)

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 16                 # f16 element granular (sub-word CAS on the enclosing u32)

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "n_out"                              # one f32-widened add per output element
  bytes_moved: "n_out * dtype_bytes + 2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: false
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Sub-word CAS accumulate, math at f32, narrow to f16 on store; scheduler-dependent order, non-associative, not bit-stable. grad_in must be zero-filled by the wrapper before dispatch."

determinism: nondeterministic
```

## pad_backward_reflect_bf16  (Reflect-pad backward — bf16, atomic accumulate)


One-line: Reflect-pad gradient on bf16; one thread per output element atomic-accumulates grad_out into the mirrored grad_in slot (sub-word CAS, f32 math).

Backward of Reflect pad on `bf16`. Identical to `pad_backward_reflect_f16` with the bf16 half type:
sub-word CAS, widen the bf16 lane to f32, add the f32-widened `grad_out`, narrow back to bf16, CAS the
enclosing word (bounded 1000-iter loop). `grad_in` **must be zero-filled by the wrapper before
dispatch**. Rank ≤ 8. Numerics: math at f32, narrow to bf16 on store. Perf: bandwidth-bound. Output:
atomic accumulate. Determinism: **nondeterministic** (scheduler-dependent CAS order; audited, no
bound). Contiguous, offset 0.

```fkc
kernel: pad_backward_reflect_bf16
op_kind: PadBackward                # Reflect-mode backward, bf16 (sub-word atomic accumulate)
blurb: "Reflect-pad gradient on bf16; one thread per output element atomic-accumulates grad_out into the mirrored grad_in slot (sub-word CAS, f32 math)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_reflect_bf16"   # wrapper pad_backward_atomic_bytes lib.rs:6462; pad_backward_reflect_f32.slang:51 (bf16 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [BF16]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in; element_count == n_out"
  op_params:
    variant: PadBackward
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)       # BF16 in → BF16 out
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: accumulate(grad_in)

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 16                 # bf16 element granular (sub-word CAS)

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "n_out"
  bytes_moved: "n_out * dtype_bytes + 2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: false
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Sub-word CAS accumulate, math at f32, narrow to bf16 on store; scheduler-dependent order, non-associative, not bit-stable. grad_in must be zero-filled by the wrapper before dispatch."

determinism: nondeterministic
```

## pad_backward_replicate_f32  (Replicate-pad backward — f32, atomic accumulate)


One-line: Replicate-pad gradient on f32; one thread per output element atomic-accumulates grad_out into the edge-clamped grad_in slot (uint CAS).

Backward of Replicate pad (`OpKind::PadBackward`, Replicate mode) on `f32`. Replicate forward folds
many output positions onto the boundary input slots (every clamped coordinate maps to an edge
element), so the backward **sums** gradients: one thread per output element computes the edge-clamp
input position (the same replicate map — `i<0→0`, `0≤i<n→i`, `i≥n→n-1` per axis from `shape_buf`) and
atomically adds `grad_out` into that `grad_in` slot via a **uint compare-and-swap** RMW (bounded
1000-iter loop). `grad_in` **must be zero-filled by the wrapper before dispatch**. Rank ≤ 8.
Numerics: f32 add. Perf: bandwidth-bound over `n_out` reads + CAS RMWs. Output: atomic accumulate
(`aliasing: accumulate(grad_in)`). Determinism: scheduler-dependent CAS order, f32 non-associative ⇒
**nondeterministic** (audited, no bound). Contiguous, offset 0.

```fkc
kernel: pad_backward_replicate_f32
op_kind: PadBackward                # Replicate-mode backward, f32 (atomic accumulate)
blurb: "Replicate-pad gradient on f32; one thread per output element atomic-accumulates grad_out into the edge-clamped grad_in slot (uint CAS)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_replicate_f32"   # wrapper pad_backward_atomic_bytes lib.rs:6462; pad_backward_replicate_f32.slang (with reflect at :51)
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [F32]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in; element_count == n_out"
  op_params:
    variant: PadBackward
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)       # F32 in → F32 out
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: accumulate(grad_in)

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32                 # f32 element granular (uint CAS)

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "n_out"
  bytes_moved: "n_out * dtype_bytes + 2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: false
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Atomic uint-CAS accumulate (bounded 1000-iter loop); scheduler-dependent order, f32 non-associative, not bit-stable. grad_in must be zero-filled by the wrapper before dispatch."

determinism: nondeterministic
```

## pad_backward_replicate_f64  (Replicate-pad backward — f64, atomic accumulate)


One-line: Replicate-pad gradient on f64; one thread per output element atomic-accumulates grad_out into the edge-clamped grad_in slot (u64 CAS).

Backward of Replicate pad on `f64`. Same edge-clamp folding as the f32 variant but with a **u64
compare-and-swap** (requires `shaderInt64` + 64-bit atomics + f64). One thread per output element maps
to the edge-clamped input slot and CAS-accumulates `grad_out` into `grad_in` (bounded 1000-iter loop).
`grad_in` **must be zero-filled by the wrapper before dispatch**. Rank ≤ 8. Numerics: native f64 add.
Perf: bandwidth-bound. Output: atomic accumulate. Determinism: scheduler-dependent CAS order, f64
non-associative ⇒ **nondeterministic** (audited, no bound). Contiguous, offset 0.

```fkc
kernel: pad_backward_replicate_f64
op_kind: PadBackward                # Replicate-mode backward, f64 (atomic accumulate)
blurb: "Replicate-pad gradient on f64; one thread per output element atomic-accumulates grad_out into the edge-clamped grad_in slot (u64 CAS)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_replicate_f64"   # wrapper pad_backward_atomic_bytes lib.rs:6462; pad_backward_replicate_f64.slang
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [F64]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in; element_count == n_out"
  op_params:
    variant: PadBackward
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)       # F64 in → F64 out
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: accumulate(grad_in)

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 64                 # f64 element granular (u64 CAS; needs shaderInt64 + 64-bit atomics + f64)

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "n_out"
  bytes_moved: "n_out * dtype_bytes + 2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: false
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Atomic u64-CAS accumulate (bounded 1000-iter loop); scheduler-dependent order, f64 non-associative, not bit-stable. Needs shaderInt64+64-bit atomics+f64. grad_in must be zero-filled by the wrapper before dispatch."

determinism: nondeterministic
```

## pad_backward_replicate_f16  (Replicate-pad backward — f16, atomic accumulate)


One-line: Replicate-pad gradient on f16; one thread per output element atomic-accumulates grad_out into the edge-clamped grad_in slot (sub-word CAS, f32 math).

Backward of Replicate pad on `f16`. Same edge-clamp folding as the f32/f64 variants, with a **sub-word
compare-and-swap**: read the enclosing 32-bit word, widen the target f16 lane to f32, add the
f32-widened `grad_out`, narrow to f16, CAS the word (bounded 1000-iter loop; sub-word lane update).
`grad_in` **must be zero-filled by the wrapper before dispatch**. Rank ≤ 8. Numerics: math at f32,
narrow to f16 on store. Perf: bandwidth-bound. Output: atomic accumulate. Determinism:
**nondeterministic** (scheduler-dependent order; audited, no bound). Contiguous, offset 0.

```fkc
kernel: pad_backward_replicate_f16
op_kind: PadBackward                # Replicate-mode backward, f16 (sub-word atomic accumulate)
blurb: "Replicate-pad gradient on f16; one thread per output element atomic-accumulates grad_out into the edge-clamped grad_in slot (sub-word CAS, f32 math)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_replicate_f16"   # wrapper pad_backward_atomic_bytes lib.rs:6462; pad_backward_replicate_f16.slang
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [F16]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in; element_count == n_out"
  op_params:
    variant: PadBackward
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)       # F16 in → F16 out
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: accumulate(grad_in)

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 16                 # f16 element granular (sub-word CAS)

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "n_out"
  bytes_moved: "n_out * dtype_bytes + 2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: false
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Sub-word CAS accumulate, math at f32, narrow to f16 on store; scheduler-dependent order, non-associative, not bit-stable. grad_in must be zero-filled by the wrapper before dispatch."

determinism: nondeterministic
```

## pad_backward_replicate_bf16  (Replicate-pad backward — bf16, atomic accumulate)


One-line: Replicate-pad gradient on bf16; one thread per output element atomic-accumulates grad_out into the edge-clamped grad_in slot (sub-word CAS, f32 math).

Backward of Replicate pad on `bf16`. Identical to `pad_backward_replicate_f16` with the bf16 half
type: sub-word CAS, widen the bf16 lane to f32, add the f32-widened `grad_out`, narrow to bf16, CAS the
enclosing word (bounded 1000-iter loop). `grad_in` **must be zero-filled by the wrapper before
dispatch**. Rank ≤ 8. Numerics: math at f32, narrow to bf16 on store. Perf: bandwidth-bound. Output:
atomic accumulate. Determinism: **nondeterministic** (scheduler-dependent order; audited, no bound).
Contiguous, offset 0.

```fkc
kernel: pad_backward_replicate_bf16
op_kind: PadBackward                # Replicate-mode backward, bf16 (sub-word atomic accumulate)
blurb: "Replicate-pad gradient on bf16; one thread per output element atomic-accumulates grad_out into the edge-clamped grad_in slot (sub-word CAS, f32 math)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::pad_backward_replicate_bf16"   # wrapper pad_backward_atomic_bytes lib.rs:6462; pad_backward_replicate_bf16.slang
kernel_revision_hash: auto

accept:
  inputs:
    - name: grad_out
      dtypes: [BF16]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: "1..=8"
      shape_constraint: "same_rank=grad_in; element_count == n_out"
  op_params:
    variant: PadBackward
    fields:
      n_out:      { kind: u32, constraint: "== product(out_shape)" }
      rank:       { kind: u32, constraint: "<= 8" }
      shape_buf:  { kind: "buffer<u32>", note: "[in_shape, out_shape, left_pad]" }

return:
  outputs:
    - name: grad_in
      dtype_rule: passthrough(grad_out)       # BF16 in → BF16 out
      shape_rule: from_params(in_shape)
      layout_guarantee: contiguous
      aliasing: accumulate(grad_in)

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 16                 # bf16 element granular (sub-word CAS)

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "n_out"
  bytes_moved: "n_out * dtype_bytes + 2 * n_out * dtype_bytes"
  overhead_ns: ~
  memory: { device_bytes: "n_in * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: false
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Sub-word CAS accumulate, math at f32, narrow to bf16 on store; scheduler-dependent order, non-associative, not bit-stable. grad_in must be zero-filled by the wrapper before dispatch."

determinism: nondeterministic
```

## masked_fill_b1  (masked fill — 1-byte elements)


One-line: masked fill for 1-byte elements; out[i] = mask[i] != 0 ? fill : input[i] (mask is Bool).

Masked fill (`OpKind::MaskedFill`) for 1-byte elements: elementwise `out[i] = mask[i] != 0 ? fill :
input[i]`. One thread per element, fully 1:1 (no shape/stride decomposition — pure positional walk).
The **mask is always U8**, packed 4 bytes per u32 word; for the b1 variant the element and the mask
byte are read from packed words and the selected byte is stored. Numerics: none — a select between the
input byte and the `fill_value` bit pattern, bit-exact for any 1-byte dtype. Perf: bandwidth-bound,
one linear pass over the input (`n` reads of input + mask, `n` writes). Limitations: input + mask +
output all **contiguous, offset 0**, same element count; no broadcasting.

```fkc
kernel: masked_fill_b1
op_kind: MaskedFill                 # 1-byte element variant
blurb: "Masked fill for 1-byte elements; out[i] = mask[i] != 0 ? fill : input[i] (mask is Bool)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::masked_fill_b1"   # wrapper masked_fill_bytes lib.rs:6982; masked_fill_b4.slang:16 (b1 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [U8, I8]                       # 1-byte elements
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: any
      shape_constraint: "same_as=out; same_as=mask"
    - name: mask
      dtypes: [BOOL]                         # GAP-168(c): mask is ALWAYS Bool (nonzero = fill)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: any
      shape_constraint: "same_as=input"
  op_params:
    variant: MaskedFill             # OpParams::MaskedFill (primitive namespace)
    fields:
      n:          { kind: u32, constraint: "== product(input shape)" }
      fill_value: { kind: u32, note: "fill element bit pattern (low 8 bits for a 1-byte element)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)         # byte width preserved; dtype = input dtype
      shape_rule: same_as(input)              # elementwise, same shape
      layout_guarantee: contiguous
      aliasing: none                          # fresh output; full overwrite (every slot selected)

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32                 # u32-word addressed (packed bytes + mask)

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"                                  # pure select, no arithmetic
  bytes_moved: "(2 * n * dtype_bytes) + n"    # read input + write out (dtype_bytes each) + read mask (1 byte/elem, U8)
  overhead_ns: ~
  memory: { device_bytes: "n * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true           # byte select: bit-exact for any dtype, any hardware
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Elementwise select between input byte and pre-encoded fill bits; no arithmetic, bit-exact for every 1-byte dtype. Mask always U8."

determinism: bitwise                          # exact data-dependent select, hardware-independent
```

## masked_fill_b2  (masked fill — 2-byte elements)


One-line: masked fill for 2-byte elements; out[i] = mask[i] != 0 ? fill : input[i] (mask is Bool).

Masked fill for 2-byte elements — same elementwise select keyed to a 2-byte element. One thread per
element, 1:1; the mask is **always U8** (packed 4-per-u32), the element/mask are read from packed
words. Numerics: none — select between the input word and `fill_value` low 16 bits, bit-exact for any
2-byte dtype. Perf: bandwidth-bound, one pass. Limitations: input + mask + output contiguous, offset
0, same element count; no broadcasting.

```fkc
kernel: masked_fill_b2
op_kind: MaskedFill                 # 2-byte element variant
blurb: "Masked fill for 2-byte elements; out[i] = mask[i] != 0 ? fill : input[i] (mask is Bool)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::masked_fill_b2"   # wrapper masked_fill_bytes lib.rs:6982; masked_fill_b4.slang:16 (b2 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F16, BF16, I16]               # 2-byte byte-width-keyed (u16 carried as I16 slot; no U16 DType)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: any
      shape_constraint: "same_as=out; same_as=mask"
    - name: mask
      dtypes: [BOOL]                         # GAP-168(c): mask is ALWAYS Bool (nonzero = fill)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: any
      shape_constraint: "same_as=input"
  op_params:
    variant: MaskedFill
    fields:
      n:          { kind: u32, constraint: "== product(input shape)" }
      fill_value: { kind: u32, note: "fill element bit pattern (low 16 bits for a 2-byte element)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: same_as(input)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "(2 * n * dtype_bytes) + n"    # read input + write out + read mask (1 byte/elem, U8)
  overhead_ns: ~
  memory: { device_bytes: "n * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Elementwise select between input word and pre-encoded fill bits; no arithmetic, bit-exact for every 2-byte dtype. Mask always U8."

determinism: bitwise
```

## masked_fill_b4  (masked fill — 4-byte elements)


One-line: masked fill for 4-byte elements; out[i] = mask[i] != 0 ? fill : input[i] (mask is Bool).

Masked fill for 4-byte elements — the canonical variant whose Slang source (`masked_fill_b4.slang:16`)
backs the family. One thread per element, 1:1; reads `input[i]` and the mask word indexed `i>>2`
(masks packed 4-per-u32), selects `mask != 0 ? fill_value : input[i]`, stores it. Numerics: none —
32-bit word select, bit-exact for any 4-byte dtype. Perf: bandwidth-bound, one pass. Limitations:
input + mask + output contiguous, offset 0, same element count; no broadcasting.

```fkc
kernel: masked_fill_b4
op_kind: MaskedFill                 # 4-byte element variant (canonical)
blurb: "Masked fill for 4-byte elements; out[i] = mask[i] != 0 ? fill : input[i] (mask is Bool)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::masked_fill_b4"   # wrapper masked_fill_bytes lib.rs:6982; masked_fill_b4.slang:16
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F32, I32, U32]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: any
      shape_constraint: "same_as=out; same_as=mask"
    - name: mask
      dtypes: [BOOL]                         # GAP-168(c): mask is ALWAYS Bool (word indexed i>>2)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: any
      shape_constraint: "same_as=input"
  op_params:
    variant: MaskedFill
    fields:
      n:          { kind: u32, constraint: "== product(input shape)" }
      fill_value: { kind: u32, note: "fill element bit pattern (full 32 bits for a 4-byte element)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: same_as(input)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "(2 * n * dtype_bytes) + n"    # read input + write out + read mask (1 byte/elem, U8)
  overhead_ns: ~
  memory: { device_bytes: "n * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Elementwise 32-bit word select between input and pre-encoded fill bits; no arithmetic, bit-exact for every 4-byte dtype. Mask always U8 (word indexed i>>2)."

determinism: bitwise
```

## masked_fill_b8  (masked fill — 8-byte elements)


One-line: masked fill for 8-byte elements; out[i] = mask[i] != 0 ? fill : input[i] (mask is Bool).

Masked fill for 8-byte elements — same elementwise select keyed to an 8-byte element (handled as a
u32-pair move). One thread per element, 1:1; the mask is **always U8**. Numerics: none — select
between the input value and `fill_value`, bit-exact for any 8-byte dtype. Perf: bandwidth-bound, one
pass. Limitations: input + mask + output contiguous, offset 0, same element count; no broadcasting.

```fkc
kernel: masked_fill_b8
op_kind: MaskedFill                 # 8-byte element variant
blurb: "Masked fill for 8-byte elements; out[i] = mask[i] != 0 ? fill : input[i] (mask is Bool)."
backend: Vulkan
kernel_source: "vulkan-slang"
entry_point: "fuel_vulkan_backend::fkc::masked_fill_b8"   # wrapper masked_fill_bytes lib.rs:6982; masked_fill_b4.slang:16 (b8 variant)
kernel_revision_hash: auto

accept:
  inputs:
    - name: input
      dtypes: [F64, I64]
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: any
      shape_constraint: "same_as=out; same_as=mask"
    - name: mask
      dtypes: [BOOL]                         # GAP-168(c): mask is ALWAYS Bool (nonzero = fill)
      layout: { contiguous: required, strided: rejected, broadcast_stride0: rejected, start_offset: rejected, reverse_strides: rejected }
      rank: any
      shape_constraint: "same_as=input"
  op_params:
    variant: MaskedFill
    fields:
      n:          { kind: u32, constraint: "== product(input shape)" }
      fill_value: { kind: u32, note: "fill element bit pattern (8-byte element packed as a u32 pair by the wrapper)" }

return:
  outputs:
    - name: out
      dtype_rule: passthrough(input)
      shape_rule: same_as(input)
      layout_guarantee: contiguous
      aliasing: none

caps:
  awkward_layout_strategy: requires_contiguous
  fast_paths: []
  in_place: false
  alignment_bytes: 16
  access_granularity_bits: 32                 # 8-byte element addressed as a u32 word pair

cost:
  provenance: judge_measured
  class: cheap_elementwise
  flops: "0"
  bytes_moved: "(2 * n * dtype_bytes) + n"    # read input + write out + read mask (1 byte/elem, U8)
  overhead_ns: ~
  memory: { device_bytes: "n * dtype_bytes", host_bytes: 0, disk_bytes: 0 }

precision:
  bit_stable_on_same_hardware: true
  max_ulp: ~
  max_relative: ~
  max_absolute: ~
  audited: true
  notes: "Elementwise select between input value and pre-encoded fill bits; no arithmetic, bit-exact for every 8-byte dtype. Mask always U8."

determinism: bitwise
```