nbxtensor 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. nbxtensor/THIRD_PARTY_NOTICES.md +287 -0
  2. nbxtensor/__init__.py +17 -0
  3. nbxtensor/backend/__init__.py +1 -0
  4. nbxtensor/backend/capabilities.py +207 -0
  5. nbxtensor/backend/cpu/__init__.py +1 -0
  6. nbxtensor/backend/cpu/blas.py +102 -0
  7. nbxtensor/backend/cpu/pool.py +204 -0
  8. nbxtensor/backend/cpu_backend.py +162 -0
  9. nbxtensor/backend/device_facts.py +105 -0
  10. nbxtensor/backend/device_files.py +129 -0
  11. nbxtensor/backend/device_names.py +18 -0
  12. nbxtensor/backend/devices/amd/cdna.yml +228 -0
  13. nbxtensor/backend/devices/amd/cdna2.yml +228 -0
  14. nbxtensor/backend/devices/amd/cdna3.yml +227 -0
  15. nbxtensor/backend/devices/apple/apple_m1.yml +266 -0
  16. nbxtensor/backend/devices/apple/apple_m1_max.yml +266 -0
  17. nbxtensor/backend/devices/apple/apple_m1_pro.yml +266 -0
  18. nbxtensor/backend/devices/apple/apple_m1_ultra.yml +266 -0
  19. nbxtensor/backend/devices/apple/apple_m2.yml +266 -0
  20. nbxtensor/backend/devices/apple/apple_m2_max.yml +266 -0
  21. nbxtensor/backend/devices/apple/apple_m2_pro.yml +266 -0
  22. nbxtensor/backend/devices/apple/apple_m2_ultra.yml +266 -0
  23. nbxtensor/backend/devices/apple/apple_m3.yml +266 -0
  24. nbxtensor/backend/devices/apple/apple_m3_max.yml +266 -0
  25. nbxtensor/backend/devices/apple/apple_m3_pro.yml +266 -0
  26. nbxtensor/backend/devices/apple/apple_m3_ultra.yml +266 -0
  27. nbxtensor/backend/devices/apple/apple_m4.yml +266 -0
  28. nbxtensor/backend/devices/apple/apple_m4_max.yml +266 -0
  29. nbxtensor/backend/devices/apple/apple_m4_pro.yml +308 -0
  30. nbxtensor/backend/devices/apple/apple_m5.yml +269 -0
  31. nbxtensor/backend/devices/apple/apple_m5_max.yml +269 -0
  32. nbxtensor/backend/devices/apple/apple_m5_pro.yml +269 -0
  33. nbxtensor/backend/devices/apple/apple_m5_ultra.yml +269 -0
  34. nbxtensor/backend/devices/apple/apple_m6.yml +269 -0
  35. nbxtensor/backend/devices/apple/apple_silicon.yml +263 -0
  36. nbxtensor/backend/devices/nvidia/ampere.yml +214 -0
  37. nbxtensor/backend/devices/nvidia/hopper.yml +213 -0
  38. nbxtensor/backend/devices/nvidia/volta.yml +411 -0
  39. nbxtensor/backend/faults.py +151 -0
  40. nbxtensor/backend/host_memory.py +185 -0
  41. nbxtensor/backend/launcher.py +2350 -0
  42. nbxtensor/backend/launcher_contract.py +429 -0
  43. nbxtensor/backend/metal_backend.py +661 -0
  44. nbxtensor/backend/metal_device.py +1274 -0
  45. nbxtensor/backend/process_memory.py +73 -0
  46. nbxtensor/backend/replay_graph.py +322 -0
  47. nbxtensor/backend/runtime.py +409 -0
  48. nbxtensor/backend/triton_ext_driver.py +735 -0
  49. nbxtensor/dtype/__init__.py +1 -0
  50. nbxtensor/dtype/convert.py +107 -0
  51. nbxtensor/dtype/dtypes.yml +70 -0
  52. nbxtensor/dtype/itemsize.py +166 -0
  53. nbxtensor/dtype/nbx_dtype.py +72 -0
  54. nbxtensor/dtype/operands.py +158 -0
  55. nbxtensor/dtype/outputs.py +64 -0
  56. nbxtensor/dtype/policy.py +155 -0
  57. nbxtensor/dtype/policy.yml +51 -0
  58. nbxtensor/dtype/promotion.py +112 -0
  59. nbxtensor/host.py +55 -0
  60. nbxtensor/io/__init__.py +1 -0
  61. nbxtensor/io/read_rate.py +197 -0
  62. nbxtensor/io/safetensors.py +314 -0
  63. nbxtensor/memory/__init__.py +9 -0
  64. nbxtensor/memory/allocator.py +1988 -0
  65. nbxtensor/memory/arena.py +75 -0
  66. nbxtensor/memory/device_memory.py +150 -0
  67. nbxtensor/memory/device_transfer.py +154 -0
  68. nbxtensor/memory/layout.py +43 -0
  69. nbxtensor/memory/memory_pool.py +191 -0
  70. nbxtensor/memory/metal.py +96 -0
  71. nbxtensor/memory/oom_advice.py +91 -0
  72. nbxtensor/memory/pointer_tables.py +323 -0
  73. nbxtensor/memory/pool.py +507 -0
  74. nbxtensor/memory/shadow.py +43 -0
  75. nbxtensor/memory/slab.py +273 -0
  76. nbxtensor/memory/trace_replay.py +122 -0
  77. nbxtensor/memory/traces/sana-video-2b-720p.16g.2026-11-02.tsv +13610 -0
  78. nbxtensor/memory/vmm.py +118 -0
  79. nbxtensor/ops/__init__.py +1 -0
  80. nbxtensor/ops/_autotune_policy.py +90 -0
  81. nbxtensor/ops/_common.py +32 -0
  82. nbxtensor/ops/_configs.py +1041 -0
  83. nbxtensor/ops/_cost.py +231 -0
  84. nbxtensor/ops/abs.py +17 -0
  85. nbxtensor/ops/adaptive_avg_pool2d.py +161 -0
  86. nbxtensor/ops/add.py +96 -0
  87. nbxtensor/ops/addcdiv.py +29 -0
  88. nbxtensor/ops/addcmul.py +29 -0
  89. nbxtensor/ops/addmv_op.py +64 -0
  90. nbxtensor/ops/addr.py +68 -0
  91. nbxtensor/ops/all_reduce.py +83 -0
  92. nbxtensor/ops/amax.py +40 -0
  93. nbxtensor/ops/any_reduce.py +83 -0
  94. nbxtensor/ops/arange_op.py +27 -0
  95. nbxtensor/ops/argmax.py +107 -0
  96. nbxtensor/ops/argmin.py +93 -0
  97. nbxtensor/ops/atan2.py +71 -0
  98. nbxtensor/ops/attention_wrappers.py +1648 -0
  99. nbxtensor/ops/autotune_bucket.py +137 -0
  100. nbxtensor/ops/autotune_cache.py +430 -0
  101. nbxtensor/ops/autotune_certified.py +1262 -0
  102. nbxtensor/ops/autotune_refusals.py +380 -0
  103. nbxtensor/ops/autotune_settings.py +58 -0
  104. nbxtensor/ops/avg_pool2d.py +73 -0
  105. nbxtensor/ops/baddbmm_op.py +132 -0
  106. nbxtensor/ops/batch_norm.py +163 -0
  107. nbxtensor/ops/binary_strided.py +196 -0
  108. nbxtensor/ops/bitwise_and.py +26 -0
  109. nbxtensor/ops/bitwise_left_shift.py +47 -0
  110. nbxtensor/ops/bitwise_not.py +24 -0
  111. nbxtensor/ops/bitwise_or.py +26 -0
  112. nbxtensor/ops/bitwise_right_shift.py +47 -0
  113. nbxtensor/ops/bucketize.py +37 -0
  114. nbxtensor/ops/cat_op.py +87 -0
  115. nbxtensor/ops/celu.py +20 -0
  116. nbxtensor/ops/clamp.py +24 -0
  117. nbxtensor/ops/clamp_min.py +22 -0
  118. nbxtensor/ops/conv2d.py +265 -0
  119. nbxtensor/ops/conv2d_m8n8k4.py +165 -0
  120. nbxtensor/ops/conv_depthwise2d.py +154 -0
  121. nbxtensor/ops/conv_transpose2d.py +148 -0
  122. nbxtensor/ops/conv_wrappers.py +1482 -0
  123. nbxtensor/ops/copy.py +18 -0
  124. nbxtensor/ops/copy_op.py +39 -0
  125. nbxtensor/ops/cos.py +17 -0
  126. nbxtensor/ops/count_nonzero.py +64 -0
  127. nbxtensor/ops/cross_entropy.py +67 -0
  128. nbxtensor/ops/cummax.py +109 -0
  129. nbxtensor/ops/cummin.py +105 -0
  130. nbxtensor/ops/cumsum.py +244 -0
  131. nbxtensor/ops/decode_attn_vec.py +162 -0
  132. nbxtensor/ops/depthwise_conv2d.py +132 -0
  133. nbxtensor/ops/dequant_gemv.py +190 -0
  134. nbxtensor/ops/dft.py +67 -0
  135. nbxtensor/ops/dispatch.py +1228 -0
  136. nbxtensor/ops/div.py +75 -0
  137. nbxtensor/ops/dot_op.py +67 -0
  138. nbxtensor/ops/dropout.py +23 -0
  139. nbxtensor/ops/dtype_convert.py +42 -0
  140. nbxtensor/ops/elementwise_launch.py +81 -0
  141. nbxtensor/ops/elementwise_wrappers.py +2315 -0
  142. nbxtensor/ops/elu.py +20 -0
  143. nbxtensor/ops/embedding.py +69 -0
  144. nbxtensor/ops/eq.py +32 -0
  145. nbxtensor/ops/erf.py +18 -0
  146. nbxtensor/ops/exp.py +17 -0
  147. nbxtensor/ops/exp2.py +18 -0
  148. nbxtensor/ops/fft_op.py +125 -0
  149. nbxtensor/ops/fill_op.py +20 -0
  150. nbxtensor/ops/flash_attention.py +307 -0
  151. nbxtensor/ops/flash_attention_m8n8k4.py +384 -0
  152. nbxtensor/ops/flash_decode.py +78 -0
  153. nbxtensor/ops/flip_op.py +60 -0
  154. nbxtensor/ops/floor.py +90 -0
  155. nbxtensor/ops/full_op.py +24 -0
  156. nbxtensor/ops/fused_moe.py +417 -0
  157. nbxtensor/ops/fused_moe_m8n8k4.py +99 -0
  158. nbxtensor/ops/fused_upsample_conv.py +413 -0
  159. nbxtensor/ops/gather_op.py +52 -0
  160. nbxtensor/ops/ge.py +32 -0
  161. nbxtensor/ops/gelu.py +31 -0
  162. nbxtensor/ops/gemv_vec.py +80 -0
  163. nbxtensor/ops/glu.py +43 -0
  164. nbxtensor/ops/grid_sampler.py +145 -0
  165. nbxtensor/ops/group_norm_tiled.py +67 -0
  166. nbxtensor/ops/groupnorm.py +123 -0
  167. nbxtensor/ops/gt.py +32 -0
  168. nbxtensor/ops/hardsigmoid.py +18 -0
  169. nbxtensor/ops/hardswish.py +19 -0
  170. nbxtensor/ops/im2col.py +57 -0
  171. nbxtensor/ops/index_add.py +95 -0
  172. nbxtensor/ops/index_put_op.py +92 -0
  173. nbxtensor/ops/index_select.py +121 -0
  174. nbxtensor/ops/index_wrappers.py +770 -0
  175. nbxtensor/ops/isfinite.py +20 -0
  176. nbxtensor/ops/isinf.py +20 -0
  177. nbxtensor/ops/isnan.py +18 -0
  178. nbxtensor/ops/launch_keys.py +1054 -0
  179. nbxtensor/ops/launch_observer.py +54 -0
  180. nbxtensor/ops/layernorm.py +71 -0
  181. nbxtensor/ops/le.py +35 -0
  182. nbxtensor/ops/leaky_relu.py +19 -0
  183. nbxtensor/ops/lerp.py +76 -0
  184. nbxtensor/ops/linalg_wrappers.py +1370 -0
  185. nbxtensor/ops/linspace_op.py +47 -0
  186. nbxtensor/ops/log.py +17 -0
  187. nbxtensor/ops/log_sigmoid.py +23 -0
  188. nbxtensor/ops/logical_and.py +26 -0
  189. nbxtensor/ops/logical_not.py +24 -0
  190. nbxtensor/ops/logical_or.py +26 -0
  191. nbxtensor/ops/logical_xor.py +37 -0
  192. nbxtensor/ops/loss_wrappers.py +282 -0
  193. nbxtensor/ops/lt.py +32 -0
  194. nbxtensor/ops/masked_fill.py +21 -0
  195. nbxtensor/ops/matmul.py +377 -0
  196. nbxtensor/ops/matmul_m8n8k4.py +235 -0
  197. nbxtensor/ops/max_pool2d.py +74 -0
  198. nbxtensor/ops/max_pool3d.py +93 -0
  199. nbxtensor/ops/max_reduce.py +91 -0
  200. nbxtensor/ops/maximum.py +18 -0
  201. nbxtensor/ops/mean.py +40 -0
  202. nbxtensor/ops/min_reduce.py +91 -0
  203. nbxtensor/ops/minimum.py +18 -0
  204. nbxtensor/ops/mish.py +22 -0
  205. nbxtensor/ops/mma_m8n8k4.py +152 -0
  206. nbxtensor/ops/moe_align.py +195 -0
  207. nbxtensor/ops/moe_decode_vec.py +374 -0
  208. nbxtensor/ops/moe_device_residency.py +141 -0
  209. nbxtensor/ops/moe_wrappers.py +345 -0
  210. nbxtensor/ops/mse_loss.py +79 -0
  211. nbxtensor/ops/mul.py +51 -0
  212. nbxtensor/ops/nan_to_num.py +23 -0
  213. nbxtensor/ops/ne.py +32 -0
  214. nbxtensor/ops/neg.py +17 -0
  215. nbxtensor/ops/nllloss.py +124 -0
  216. nbxtensor/ops/nonzero.py +33 -0
  217. nbxtensor/ops/nonzero_op.py +62 -0
  218. nbxtensor/ops/norm_wrappers.py +579 -0
  219. nbxtensor/ops/ones_op.py +20 -0
  220. nbxtensor/ops/oracles/__init__.py +6 -0
  221. nbxtensor/ops/oracles/conv2d_fp64.py +450 -0
  222. nbxtensor/ops/pad_op.py +159 -0
  223. nbxtensor/ops/paged_decode_attn.py +215 -0
  224. nbxtensor/ops/pixel_shuffle.py +144 -0
  225. nbxtensor/ops/pixel_unshuffle.py +72 -0
  226. nbxtensor/ops/pow.py +137 -0
  227. nbxtensor/ops/prod.py +81 -0
  228. nbxtensor/ops/rand_op.py +52 -0
  229. nbxtensor/ops/random_wrappers.py +366 -0
  230. nbxtensor/ops/reciprocal.py +17 -0
  231. nbxtensor/ops/reduction_wrappers.py +845 -0
  232. nbxtensor/ops/relu.py +18 -0
  233. nbxtensor/ops/remainder.py +46 -0
  234. nbxtensor/ops/repeat_interleave.py +48 -0
  235. nbxtensor/ops/repeat_op.py +132 -0
  236. nbxtensor/ops/residual_chain.py +374 -0
  237. nbxtensor/ops/rmsnorm.py +68 -0
  238. nbxtensor/ops/rope.py +142 -0
  239. nbxtensor/ops/rsqrt.py +17 -0
  240. nbxtensor/ops/scaled_softmax.py +96 -0
  241. nbxtensor/ops/scatter_op.py +139 -0
  242. nbxtensor/ops/screen_oracle.py +479 -0
  243. nbxtensor/ops/selu.py +22 -0
  244. nbxtensor/ops/shape_wrappers.py +1032 -0
  245. nbxtensor/ops/sigmoid.py +19 -0
  246. nbxtensor/ops/silu.py +27 -0
  247. nbxtensor/ops/sin.py +17 -0
  248. nbxtensor/ops/softmax.py +169 -0
  249. nbxtensor/ops/softplus.py +27 -0
  250. nbxtensor/ops/sort_op.py +304 -0
  251. nbxtensor/ops/spectral_wrappers.py +481 -0
  252. nbxtensor/ops/sqrt.py +17 -0
  253. nbxtensor/ops/stack_op.py +84 -0
  254. nbxtensor/ops/std.py +113 -0
  255. nbxtensor/ops/strided_copy.py +200 -0
  256. nbxtensor/ops/sub.py +35 -0
  257. nbxtensor/ops/sum.py +40 -0
  258. nbxtensor/ops/tan.py +19 -0
  259. nbxtensor/ops/tanh.py +21 -0
  260. nbxtensor/ops/threshold.py +19 -0
  261. nbxtensor/ops/tiling.yml +91 -0
  262. nbxtensor/ops/tiling_policy.py +43 -0
  263. nbxtensor/ops/tiling_sizes.py +370 -0
  264. nbxtensor/ops/topk.py +267 -0
  265. nbxtensor/ops/trace_op.py +64 -0
  266. nbxtensor/ops/tril.py +64 -0
  267. nbxtensor/ops/triu.py +62 -0
  268. nbxtensor/ops/unfold_op.py +37 -0
  269. nbxtensor/ops/unique_op.py +97 -0
  270. nbxtensor/ops/upsample_bilinear2d.py +106 -0
  271. nbxtensor/ops/upsample_nearest2d.py +52 -0
  272. nbxtensor/ops/upsample_nearest3d.py +61 -0
  273. nbxtensor/ops/var.py +136 -0
  274. nbxtensor/ops/vector_norm.py +216 -0
  275. nbxtensor/ops/weight_norm.py +104 -0
  276. nbxtensor/ops/where.py +39 -0
  277. nbxtensor/ops/wrappers.py +825 -0
  278. nbxtensor/ops/zeros_op.py +20 -0
  279. nbxtensor/quant/__init__.py +1 -0
  280. nbxtensor/quant/quantized_tensor.py +187 -0
  281. nbxtensor/random/__init__.py +1 -0
  282. nbxtensor/random/mt_randn.py +154 -0
  283. nbxtensor/random/rng_pin.py +59 -0
  284. nbxtensor/random/rng_stream.py +118 -0
  285. nbxtensor/random/seeded_draw.py +223 -0
  286. nbxtensor/shape/__init__.py +157 -0
  287. nbxtensor/tensor.py +1867 -0
  288. nbxtensor-0.0.1.dist-info/METADATA +379 -0
  289. nbxtensor-0.0.1.dist-info/RECORD +291 -0
  290. nbxtensor-0.0.1.dist-info/WHEEL +4 -0
  291. nbxtensor-0.0.1.dist-info/licenses/LICENSE +189 -0
@@ -0,0 +1,213 @@
1
+ # The library's half of nvidia/hopper.yml: the keys nbxtensor reads (docs/nbxtensor/device_keys.txt),
2
+ # moved with their sources by tools/split_vendor_files.py. NeuroBrix's half stays in
3
+ # src/neurobrix/config/vendors/nvidia/hopper.yml; the engine reads the two merged.
4
+
5
+ architecture: hopper
6
+ compute_capability: "9.0"
7
+
8
+ block_sizes:
9
+ # Default block size for simple kernels
10
+ default: 1024
11
+
12
+ # Batched Matrix Multiply configuration
13
+ bmm:
14
+ block_m: 64
15
+ block_n: 128
16
+ block_k: 32
17
+ num_warps: 8
18
+
19
+ # Convolution configuration
20
+ conv2d:
21
+ block_h: 32
22
+ block_w: 32
23
+ num_warps: 8
24
+
25
+ # Generic reduction block size
26
+ reduction: 2048
27
+
28
+ # M=1 dequant-GEMV occupancy rule — see nvidia/volta.yml for the
29
+ # full rationale (pinned parity BLOCK_N under-fills small-N grids;
30
+ # the wrapper halves BLOCK_N until the grid reaches min_programs).
31
+ # 264 = 2 waves x 132 SMs (H100); validation_status: analytical.
32
+ # Key absent or 0 -> no adaptation.
33
+ dequant_gemv:
34
+ min_programs: 264
35
+
36
+ # Scaled Dot-Product Attention block size thresholds.
37
+ # Schema documented in volta.yml. Decode entries first.
38
+ # Hopper values not yet empirically calibrated; tile sizes scaled
39
+ # up for the larger SMEM budget (227 KB).
40
+ # num_warps: 8 on every row is the declared value, NOT measured here (no Hopper
41
+ # card); since 2026-10-08 the flash launch reads it, and a row without one is an error.
42
+ sdpa_thresholds:
43
+ # Decode path (seqlen_q ≤ 16)
44
+ - seqlen_q_le: 16
45
+ head_dim_ge: 256
46
+ block_m: 16
47
+ block_n: 64
48
+ num_warps: 8
49
+ - seqlen_q_le: 16
50
+ block_m: 16
51
+ block_n: 128
52
+ num_warps: 8
53
+ # Prefill path (seqlen_q > 16)
54
+ - head_dim_ge: 256
55
+ block_m: 32
56
+ block_n: 32
57
+ num_warps: 8
58
+ - head_dim_ge: 128
59
+ block_m: 64
60
+ block_n: 64
61
+ num_warps: 8
62
+ - head_dim_lt: 128
63
+ block_m: 128
64
+ block_n: 128
65
+ num_warps: 8
66
+
67
+ memory:
68
+ max_shared_memory_per_block: 232448 # 227 KB
69
+ max_registers_per_block: 65536
70
+ # NVIDIA CUDA C++ Programming Guide, Technical Specifications per Compute Capability: "Maximum number of 32-bit
71
+ # registers per thread: 255" (7.x, 8.x, 9.x). Bounds a program's elements per thread (the row programs' prune).
72
+ max_registers_per_thread: 255
73
+ warp_size: 32
74
+ # SDPA deterministic-routing budget (R10 schema parity with
75
+ # volta.yml). 0 = DISABLED BY DESIGN: the flash-attention Triton
76
+ # non-determinism is a Volta-SIMT issue; Hopper has 4th-gen
77
+ # async tensor-core MMA and the flash kernel is deterministic
78
+ # here. Routing to the slower _math_attention fallback would be a
79
+ # pure perf regression with zero determinism benefit. The key's
80
+ # VALUE, not its presence, is the gate. hand_curated_from_docs.
81
+ sdpa_math_max_scores_bytes: 0
82
+ # Row block (alignment and floor) of the chunked deterministic
83
+ # math prefill; the chunk-halving retry on a refused allocation
84
+ # never goes below it.
85
+ sdpa_math_min_chunk_rows: 128
86
+ # Allocator pool: bytes the free-list may keep PARKED per device as a
87
+ # fraction of that device's memory (2026-09-02, pool default-on gate).
88
+ # Beyond it the largest parked blocks go back to the driver, bounding
89
+ # the pool's contribution to the driver watermark (measured +3.4 GB on
90
+ # the xlong int4 row unbounded). 0 = unbounded.
91
+ alloc_pool_parked_cap_fraction: 0.50
92
+ precision:
93
+ # Attention operands that disagree in dtype (an fp16 GEMM stored fp32 feeding V) all take the
94
+ # narrowest of the three, the compiled engine's alignment: the half attention stays on the matrix
95
+ # unit (V100, 2026-10-08: 1.16 s/op aligned narrowest vs 22.0 s/op on the scalar flash aligned widest).
96
+ attention_operands: narrowest
97
+ # Whether each engine branch's OWN kernels compute float64 / complex128 elements, read with
98
+ # supports_fp64 (both must hold) -- a CAPABILITY: `compiled` is ATen's, which carries both wherever
99
+ # the device does; `triton` is the NeuroBrix Triton kernels' (cuda/hip lower double; Metal's
100
+ # lowering narrows it in silence, measured 2026-09-28 on the Sana 4K positional embedding). Read
101
+ # by the DtypeEngine (`config.device_supports_fp64`) and by the Triton wrappers' binding
102
+ # (`triton.dtype.triton_has_fp64` -> `nbx_tensor.set_backend_has_fp64`).
103
+ kernels_carry_fp64:
104
+ compiled: true
105
+ triton: true
106
+ # Software-pipelining budget — see volta.yml for the schema. Hopper
107
+ # (sm_90) has cp.async and TMA; the cap never binds.
108
+ pipelining:
109
+ max_num_stages: 8
110
+
111
+ # Autotune correctness screen. The engine runs every candidate config once and
112
+ # compares its result against a reference config's before timing any of them,
113
+ # because an autotuner that ranks on speed alone selects whichever WRONG
114
+ # kernel is fastest — a kernel that writes half its output does half the
115
+ # stores and wins. Measured on Apple 2026-09-07: fp16 mm [64,32]@[32,64] chose
116
+ # a config that left half the columns zero.
117
+ #
118
+ # These are the tolerances that separate "a different but valid summation
119
+ # order" from "a different answer". Two configs with different block sizes
120
+ # reduce in a different order, so their results differ in the last bits; a
121
+ # config that drops output differs by the scale of the output itself. The
122
+ # gap between those two is several orders of magnitude, and these sit in it.
123
+ #
124
+ # Relative to the reference's own magnitude: max|a - b| / max|b|. Integer
125
+ # and boolean results are compared BIT-IDENTICALLY and ignore this table —
126
+ # there is no valid reordering that changes an integer.
127
+ autotune_screen_rtol:
128
+ float16: 2.0e-2
129
+ bfloat16: 4.0e-2
130
+ float32: 1.0e-4
131
+ float64: 1.0e-8
132
+ int64: 0.0 # an integer result (the MoE alignment's routing tables) is met exactly
133
+
134
+ # Above this many bytes of buffer, the autotune correctness screen does not
135
+ # run. Screening copies every argument out and back once per candidate, so a
136
+ # very large tensor turns a tuning step into hundreds of megabytes of traffic
137
+ # — and on unified memory that pressure is the machine's, not a card's.
138
+ # MEASURED 2026-09-07: unbounded screening of a 151936-wide softmax perturbed
139
+ # six unrelated tests in the same process. A skipped screen is announced, not
140
+ # silent.
141
+ autotune_screen_max_bytes: 33554432
142
+
143
+ autotune:
144
+ buckets:
145
+ # elements — an element-wise launch's element count (`kernels/ops/elementwise_launch.py`), NEVER the `default`
146
+ # dimension ladder (`autotune_bucket.ladder_for` refuses it). NOT measured on this architecture (no such device on
147
+ # either machine): the four classes measured on V100-SXM2 2026-10-23 (nvidia/volta.yml, launch-bound under 65 536
148
+ # elements, bandwidth classes above) and confirmed on apple_m4_pro 2026-10-24 — the measurement on this
149
+ # architecture is owed (docs/reference/owed-proofs.md, "element-wise ladder per architecture").
150
+ elements:
151
+ - {up_to: 65536, step: 65536}
152
+ - {up_to: 1048576, step: 1048576}
153
+ - {up_to: 16777216, step: 16777216}
154
+ - {up_to: null, step: 68719476736}
155
+ default:
156
+ - {up_to: 64, step: 1}
157
+ - {up_to: 256, step: 16}
158
+ - {up_to: 1024, step: 32}
159
+ - {up_to: 8192, step: 128}
160
+ # Above 8 192 a QUARTER-OCTAVE, not a 512-step. The 512 tail was decided by a sweep
161
+ # that ran to about 4 096 and never met a request-scale dimension: a vocoder's batched
162
+ # GEMM keys on the WAVEFORM and reaches 1 963 520, which a 512-step cuts into some four
163
+ # thousand buckets — 1 400 of one model's 1 522 distinct M values sat above 8 192.
164
+ # Measured 2026-09-22 on both classes, two shapes (the vocoder's B=1,N=1,K=9 and a
165
+ # GEMM at N=K=512), each octave bucket carrying three or four measured values with its
166
+ # TOP as representative: 0.0 % median loss, 0.2 % max at ONE octave bucket. The rows
167
+ # below are finer than the octave that was measured, so they cost no more than it did.
168
+ # The first three octaves above the knee keep a NARROW step. Measured directly on the
169
+ # rows as shipped (the upscalers' N=360, K=180; three sizes inside each bucket with
170
+ # its TOP among them, 2026-09-22): a quarter-octave there cost 0.0 % median but
171
+ # **5.2 %** at the 10 240 bucket and 1.2 % at 16 384 — the loss lives just above the
172
+ # knee, where a quarter of an OCTAVE is still a quarter of the VALUE. Beyond 65 536
173
+ # the same sweep measured 0.0 % median and at most 0.6 %, so the quarter-octave stands.
174
+ # The convolution-width ladder below keeps its quarter-octave: its own sweep measured
175
+ # 0.0 % median AND max there, on both classes and two channel counts.
176
+ - {up_to: 16384, step: 512}
177
+ - {up_to: 32768, step: 1024}
178
+ - {up_to: 65536, step: 2048}
179
+ - {up_to: 131072, step: 16384}
180
+ - {up_to: 262144, step: 32768}
181
+ - {up_to: 524288, step: 65536}
182
+ - {up_to: 1048576, step: 131072}
183
+ - {up_to: 2097152, step: 262144}
184
+ - {up_to: null, step: 524288}
185
+ # The width of a ONE-ROW convolution (a 1-D convolution over a sequence: a vocoder's
186
+ # samples, a mel spectrogram's frames) is the request's length, unbounded by any
187
+ # resolution — chatterbox's vocoder reaches 444 721 samples for 18 s of speech. Above the
188
+ # GEMM ladder it steps by a quarter-octave (≤ 25 % of the value), so a census meets every
189
+ # class of a speech length in ~100 runs instead of ~1 000; the loss of that step is owed a
190
+ # measurement on both classes (bucket_loss.py) before the ladder is called final.
191
+ W:
192
+ - {up_to: 64, step: 1}
193
+ - {up_to: 256, step: 16}
194
+ - {up_to: 1024, step: 32}
195
+ - {up_to: 8192, step: 128}
196
+ - {up_to: 16384, step: 2048}
197
+ - {up_to: 32768, step: 4096}
198
+ - {up_to: 65536, step: 8192}
199
+ - {up_to: 131072, step: 16384}
200
+ - {up_to: 262144, step: 32768}
201
+ - {up_to: 524288, step: 65536}
202
+ - {up_to: null, step: 131072}
203
+
204
+ # The flash kernel at a power-of-two head dim >= 128 is NOT measured on this architecture: the zero-pad
205
+ # detour stays (launch_keys.flash_headdim_detour). Declared, never left absent: true only where the
206
+ # correctness oracle was run with the detour off on this arch and stack (Volta, Triton 3.8, 2026-10-03).
207
+ flash:
208
+ pow2_head_dim_correct: false
209
+
210
+ # Convolution weight storage order (launch_keys.conv_weight_layout): KCRS, the container's own,
211
+ # until this arch measures KRSC (the M4 Pro measured +46-63 % on its 3x3 keys, 2026-10-07).
212
+ conv:
213
+ weight_layout: KCRS
@@ -0,0 +1,411 @@
1
+ # The library's half of nvidia/volta.yml: the keys nbxtensor reads (docs/nbxtensor/device_keys.txt),
2
+ # moved with their sources by tools/split_vendor_files.py. NeuroBrix's half stays in
3
+ # src/neurobrix/config/vendors/nvidia/volta.yml; the engine reads the two merged.
4
+
5
+ architecture: volta
6
+ compute_capability: "7.0"
7
+
8
+ block_sizes:
9
+ # Default block size for simple kernels
10
+ default: 1024
11
+
12
+ # Batched Matrix Multiply configuration
13
+ bmm:
14
+ block_m: 64
15
+ block_n: 64
16
+ block_k: 32
17
+ num_warps: 4
18
+
19
+ # Convolution configuration
20
+ conv2d:
21
+ block_h: 16 # Tile height
22
+ block_w: 16 # Tile width
23
+ num_warps: 4
24
+
25
+ # Generic reduction block size
26
+ reduction: 1024
27
+
28
+ # M=1 dequant-GEMV occupancy rule (2026-08-25). The tier's pinned
29
+ # parity BLOCK_N (64) under-fills the device at small N — the MoE
30
+ # router mv (N=128) ran a 2-program grid on 80 SMs (~38 us/call for
31
+ # ~131 KB of weights, ~3.4 GB/s: latency-bound, not bandwidth). The
32
+ # wrapper halves BLOCK_N (pow2, floor 1) until the grid reaches
33
+ # min_programs; the parity oracle runs the SAME adapted config
34
+ # (fused == dequant->ref by construction at every BLOCK_N). Large-N
35
+ # calls (grid already >= min_programs) are untouched — zero drift on
36
+ # the proven big-mv path. 160 = 2 waves x 80 SMs (V100). Key absent
37
+ # or 0 -> no adaptation (prior behavior).
38
+ dequant_gemv:
39
+ min_programs: 160
40
+
41
+ # Scaled Dot-Product Attention block size thresholds.
42
+ #
43
+ # Schema: each entry is a (BLOCK_M, BLOCK_N) selection rule. Optional
44
+ # constraints — first entry whose constraints all match AND whose
45
+ # footprint fits the SMEM budget wins. Decode entries (seqlen_q ≤ 16)
46
+ # come first so they take precedence over prefill entries on the
47
+ # autoregressive hot path.
48
+ #
49
+ # Volta values are bit-perfect with the table that produced the
50
+ # regression-harness golden text on TinyLlama-1.1B / Qwen3-30B since
51
+ # Layer 5 (commit 06d26c2). Reordering or resizing any of these
52
+ # entries will drift the LLM logits → drift greedy argmax → break
53
+ # golden match. Keep the legacy values until a future calibration
54
+ # campaign re-validates.
55
+ # The flash kernel at a power-of-two head dim >= 128, MEASURED on this arch and stack: the zero-pad
56
+ # detour (launch_keys.flash_headdim_detour) was built for wrong answers at D 128/256 on an older Triton
57
+ # (headdim 128 -> 4.2e-01 against float64). On Triton 3.8 the 33-case attention correctness oracle
58
+ # (tests/unit/kernels/test_numeric_correctness_oracle.py) passes with NBX_D128_DETOUR=0 on a V100, and
59
+ # the chunked kernel at D 128 matches float64 as the detour does (1.46e-05) at 65 ms instead of 2 196
60
+ # (2026-10-03). Absent on an arch = the detour stays.
61
+ flash:
62
+ pow2_head_dim_correct: true
63
+
64
+ # The matrix unit this arch HAS and Triton 3.8 does not generate: below sm_80 `tl.dot` lowers to scalar FMA
65
+ # (triton-lang/triton#5066). Declared here, the kernels built for that unit run instead
66
+ # (kernels/ops/mma_m8n8k4.py; method in docs/reference/tensor-cores-through-linear-layouts.md):
67
+ # mma.sync.aligned.m8n8k4.row.col.f32.f16.f16.f32 (PTX ISA, sm_70; fragment from CUTLASS mma_traits_sm70.hpp).
68
+ # The flash tiles are MEASURED on V100-SXM2 at 1290 MHz, per head dim, the best of six (64|128 query rows x 32|64
69
+ # keys per step x 4|8 warps) at T 79 200 D 96, T 32 760 D 128, T 16 384 D 64 (2026-10-07, flash_tiles4): D 64 at
70
+ # 128 x 64 / 4 warps 45.7 TFLOP/s, D 96 at 128 x 32 / 4 warps 48.2, D 128 at 64 x 32 / 4 warps 42.9 — against
71
+ # 2.46 for the FMA flash at D 96 (tools/tensor_cores_m8n8k4/step3_scan1.txt).
72
+ # Absent on an arch = the unit is not declared and every kernel keeps tl.dot.
73
+ matrix_unit:
74
+ shape: m8n8k4
75
+ operand_dtype: float16
76
+ accumulator_dtype: float32
77
+ flash: # the first row whose head_dim_le holds; up to 256 (the O accumulator's registers), beyond tl.dot
78
+ - head_dim_le: 64
79
+ block_m: 128
80
+ block_n: 64
81
+ warps_m: 4
82
+ - head_dim_le: 96
83
+ block_m: 128
84
+ block_n: 32
85
+ warps_m: 4
86
+ - head_dim_le: 256
87
+ block_m: 64
88
+ block_n: 32
89
+ warps_m: 4
90
+ mm: # GEMM tiles, largest first: the first whose block fits inside the M x N output
91
+ - block_m: 128 # 2026-10-08, fp16 x fp16: 23-39 TFLOP/s mm, 13.1-13.7 conv 3x3, where 128x128 w2x2 gave 8-9
92
+ block_n: 64 # (two 128-register accumulators per thread: the tile sum and the RN one)
93
+ block_k: 32
94
+ warps_m: 4
95
+ warps_n: 1
96
+ group_m: 8
97
+ - block_m: 64
98
+ block_n: 64
99
+ block_k: 32
100
+ warps_m: 2
101
+ warps_n: 2
102
+ group_m: 8
103
+ fp32_split: # an fp32 operand as hi + lo fp16, three MMAs, fp32 accumulation (owner, 2026-10-07 S1 = B):
104
+ operands: [float32, bfloat16] # the vendor's fp32 arithmetic on the unit (triton/dtype.matrix_unit_representation)
105
+ mm: # three accumulators per thread: the tile is smaller than the native one
106
+ - block_m: 64
107
+ block_n: 64
108
+ block_k: 32
109
+ warps_m: 2
110
+ warps_n: 2
111
+ group_m: 8
112
+ conv: # an fp32 convolution's implicit GEMM through the split, per kernel window, where it was MEASURED
113
+ # faster than the FMA path (2026-11-03, V100-SXM2-32GB card 2, the census's fp32 conv2d classes, certified FMA
114
+ # baseline): 1x1 at 128x64x16 w4x1 x1.26-1.95 (384->1152 0.77 vs 1.50 ms, 256->256 at 12x160x160 5.17 vs 8.92 ms,
115
+ # 512->256 6.72 vs 10.29 ms), even at 192->384 (1.01); a 3x3 is SLOWER at every tile (best 128x64x32 w4x1:
116
+ # x0.90-0.99) and has no row — it keeps the FMA path. A row is taken only where its tile fills: M >= block_m and
117
+ # the output channels per group >= block_n (16 channels in a 64-column tile: x0.36).
118
+ - kernel: [1, 1]
119
+ block_m: 128
120
+ block_n: 64
121
+ block_k: 16
122
+ warps_m: 4
123
+ warps_n: 1
124
+ group_m: 8
125
+ flash: # an fp32 attention (Q, K, V, P as hi + lo); block_k: head-dim columns of S the unit sums
126
+ # before each round-to-nearest add (ops/flash_attention_m8n8k4.py, SPLIT). 2026-10-12, V100-SXM2-16GB, B1 H24 L79200
127
+ # D96 fp32: 128x32 w8 4.39 s (13.2 TFLOP/s) where 64x32 w4 gave 6.93, 64x64 w4 6.52, 128x32 w4 9.99; block_k 64
128
+ # 4.38 (noise), 16 4.96; the FMA flash took 22.1 s. Wider rows than below exceed the shared memory (refused at
129
+ # launch, measured per head dim). Rows past 96 timed 2026-10-12 on V100-SXM2-32GB (card 2), B1 H8 L16384, 5 iters,
130
+ # every tile that loads, error vs the FMA flash <= 1.3e-5 (splitfix/bench.json): D160 64x16 w4 0.231 s 5.9 TFLOP/s
131
+ # (64x32 w4 0.329, 32x16 w2 0.307, 32x32 w2 0.388; FMA 1.616 s: x7.0); D192 64x16 w4 0.375 s 4.4 TFLOP/s (32x16 w2
132
+ # 0.528, 32x32 w2 0.543; every 64x32 refused, shared memory beyond the opt-in; FMA 1.125 s: x3.0); D256 32x16 w2
133
+ # 1.523 s 1.4 TFLOP/s, the only tile that loads (FMA 1.699 s: x1.1 — the split's gain there is accuracy parity on
134
+ # the unit, not speed).
135
+ - head_dim_le: 96
136
+ block_m: 128
137
+ block_n: 32
138
+ warps_m: 8
139
+ block_k: 32
140
+ - head_dim_le: 160
141
+ block_m: 64
142
+ block_n: 16
143
+ warps_m: 4
144
+ block_k: 32
145
+ # No row past 160 (2026-10-30): the tiles the certifier proves per key (unit_flash_configs: 64 or 128 query rows,
146
+ # 32 or 64 keys a step) do not fit this card's 96 KB of shared memory at head dim 192 or 256 in the split — once
147
+ # COMPILED, the one tile the staged-bytes prune keeps asks 102 400 bytes at 192 and 135 168 at 256 against the
148
+ # card's 98 304 (V100-SXM2, the launcher's compiled figure). The smaller tiles that loaded there on 2026-10-12
149
+ # (64x16, 32x16) left with the hand table; a fp32 attention at those head dims runs the FMA flash.
150
+
151
+ sdpa_thresholds:
152
+ # ── Decode path (seqlen_q ≤ 16) ────────────────────────────────
153
+ - seqlen_q_le: 16
154
+ head_dim_ge: 256
155
+ block_m: 16
156
+ block_n: 32
157
+ num_warps: 4
158
+ - seqlen_q_le: 16 # head_dim < 256 decode
159
+ block_m: 16
160
+ block_n: 64
161
+ num_warps: 4
162
+ # ── Prefill / spatial-attention path (seqlen_q > 16) ───────────
163
+ - head_dim_ge: 256
164
+ block_m: 32
165
+ block_n: 32
166
+ num_warps: 4
167
+ # Prefill below head_dim 256: the FMA-path tile. Triton >= 3.3 lowers tl.dot to scalar fp32 FMA
168
+ # below sm_80 (triton-lang/triton#5066; release/3.8.x AccelerateMatmul.cpp: "falls back to the FMA
169
+ # path"; the compiled flash PTX here: 0 mma.sync, 8 192 fma.rn.f32 per loop body). Holding a 64-row
170
+ # Q tile and a 64-column K tile in registers ran 0.18 TFLOP/s at D 64/96/128 and T 4 096-14 080;
171
+ # a 64x32 tile at 8 warps with the QK^T contraction in 32-wide head-dim chunks ran 2.4-3.6 TFLOP/s
172
+ # (T 4 096, D 64/96/128; nbx/campaigns/2026_10_03_resume/flash_variant*.txt, 2026-10-03). The
173
+ # vendor's tensor-core kernel stays ~4x ahead: no Triton route to Volta MMA exists on 3.8.
174
+ - head_dim_ge: 128
175
+ block_m: 64
176
+ block_n: 32
177
+ num_warps: 8
178
+ qk_chunk: 32
179
+ - head_dim_lt: 128
180
+ block_m: 64
181
+ block_n: 32
182
+ num_warps: 8
183
+ qk_chunk: 32
184
+
185
+ # The bucket ladder of a request-dependent autotune-key dimension (kernels/autotune_bucket.py):
186
+ # measured 2026-09-21 on both memory classes (tools/bucket_loss.py, owed-proofs): exact under
187
+ # 64, then 16-step to 256, 32-step to 1024, 128-step to 8192, 512-step beyond — 0.0 % median
188
+ # and maximum loss against the per-size optimum on matmul M and the SDPA scores' batched
189
+ # GEMM, where powers of two lost up to 26.9 % and a 16-step ladder under 64 up to 16.7 %.
190
+ # `default` serves every dimension that has no row of its own.
191
+ autotune:
192
+ buckets:
193
+ # M — the rows of a GEMM (a prefill's token count; the SDPA scores' batched GEMM): classes of EIGHT below the
194
+ # matrix unit's 64-row tile, where the ladder measured on 2026-09-21 keyed every row exactly. Decision
195
+ # 2026-10-19 (a census gap: prompt lengths with no certified key): under certified-only every prompt
196
+ # length is a key, and an exact row count made ~60 classes per decoder (TinyLlama, 16 GB: 838 census rows
197
+ # where there were 14) — eight classes instead, one re-certification of the keys below 64. The GEMV bound
198
+ # (M <= 4) and the unit's take-over at 64 are the launcher's and unchanged; the rows above 64 are `default`'s.
199
+ # OWED: the loss of the 8-step against the per-row optimum (tools/bucket_loss.py, both classes) — recorded in
200
+ # owed-proofs when measured; the padded class is proven exact by identity first (M=31 keyed 32 vs 31).
201
+ M:
202
+ - {up_to: 64, step: 8}
203
+ - {up_to: 256, step: 16}
204
+ - {up_to: 1024, step: 32}
205
+ - {up_to: 8192, step: 128}
206
+ - {up_to: 16384, step: 512}
207
+ - {up_to: 32768, step: 1024}
208
+ - {up_to: 65536, step: 2048}
209
+ - {up_to: 131072, step: 16384}
210
+ - {up_to: 262144, step: 32768}
211
+ - {up_to: 524288, step: 65536}
212
+ - {up_to: 1048576, step: 131072}
213
+ - {up_to: 2097152, step: 262144}
214
+ - {up_to: null, step: 524288}
215
+ # elements — an element-wise launch's element count (`kernels/ops/elementwise_launch.py`): FOUR classes. Measured
216
+ # 2026-10-23 on V100-SXM2 (campaigns/2026_10_12_mq25_gate/stable/c1rest/ew_bench.json, 8 operations x fp32/fp16 x
217
+ # 15 tiles x warps): at or under 65 536 elements the launch dominates (13 us whatever the tile); at 1 M the
218
+ # copy's best is within 2.4 % (mean) of each operation's own; at 16 M within 0.3 % (max 1.4 %). The class is
219
+ # certified at its floor (`autotune_bucket.class_floor`): 1, 65 537, 1 048 577 and 16 777 217 elements.
220
+ elements:
221
+ - {up_to: 65536, step: 65536}
222
+ - {up_to: 1048576, step: 1048576}
223
+ - {up_to: 16777216, step: 16777216}
224
+ - {up_to: null, step: 68719476736}
225
+ default:
226
+ - {up_to: 64, step: 1}
227
+ - {up_to: 256, step: 16}
228
+ - {up_to: 1024, step: 32}
229
+ - {up_to: 8192, step: 128}
230
+ # Above 8 192 a QUARTER-OCTAVE, not a 512-step. The 512 tail was decided by a sweep
231
+ # that ran to about 4 096 and never met a request-scale dimension: a vocoder's batched
232
+ # GEMM keys on the WAVEFORM and reaches 1 963 520, which a 512-step cuts into some four
233
+ # thousand buckets — 1 400 of one model's 1 522 distinct M values sat above 8 192.
234
+ # Measured 2026-09-22 on both classes, two shapes (the vocoder's B=1,N=1,K=9 and a
235
+ # GEMM at N=K=512), each octave bucket carrying three or four measured values with its
236
+ # TOP as representative: 0.0 % median loss, 0.2 % max at ONE octave bucket. The rows
237
+ # below are finer than the octave that was measured, so they cost no more than it did.
238
+ # The first three octaves above the knee keep a NARROW step. Measured directly on the
239
+ # rows as shipped (the upscalers' N=360, K=180; three sizes inside each bucket with
240
+ # its TOP among them, 2026-09-22): a quarter-octave there cost 0.0 % median but
241
+ # **5.2 %** at the 10 240 bucket and 1.2 % at 16 384 — the loss lives just above the
242
+ # knee, where a quarter of an OCTAVE is still a quarter of the VALUE. Beyond 65 536
243
+ # the same sweep measured 0.0 % median and at most 0.6 %, so the quarter-octave stands.
244
+ # The convolution-width ladder below keeps its quarter-octave: its own sweep measured
245
+ # 0.0 % median AND max there, on both classes and two channel counts.
246
+ - {up_to: 16384, step: 512}
247
+ - {up_to: 32768, step: 1024}
248
+ - {up_to: 65536, step: 2048}
249
+ - {up_to: 131072, step: 16384}
250
+ - {up_to: 262144, step: 32768}
251
+ - {up_to: 524288, step: 65536}
252
+ - {up_to: 1048576, step: 131072}
253
+ - {up_to: 2097152, step: 262144}
254
+ - {up_to: null, step: 524288}
255
+ # The width of a ONE-ROW convolution (a 1-D convolution over a sequence: a vocoder's
256
+ # samples, a mel spectrogram's frames) is the request's length, unbounded by any
257
+ # resolution — chatterbox's vocoder reaches 444 721 samples for 18 s of speech. Above the
258
+ # GEMM ladder it steps by a quarter-octave (≤ 25 % of the value), so a census meets every
259
+ # class of a speech length in ~100 runs instead of ~1 000; the loss of that step is owed a
260
+ # measurement on both classes (bucket_loss.py) before the ladder is called final.
261
+ W:
262
+ - {up_to: 64, step: 1}
263
+ - {up_to: 256, step: 16}
264
+ - {up_to: 1024, step: 32}
265
+ # 1 024-8 192 by an EIGHTH of an octave (2026-09-28, both classes, cards 0 and 2): the fine
266
+ # 128-step was never measured coarser there, and an audio codec's widths spend ~95 % of their
267
+ # classes in it. W8 (these rows) against the 128-step and a quarter-octave, 38 widths across the
268
+ # buckets, 1x1 and 1x7 one-row convs at 128 and 512 channels: W8 equal to the 128-step on every
269
+ # shape (median 0.0 %, max identical), the quarter-octave up to +15.6 % (512 ch, 1x1) and
270
+ # +11.4 % (512 ch, 1x7, 32 GB) — above the run-to-run spread (p95 3.1 %, max 8.6 %). 24 classes
271
+ # instead of 56. The measurement: docs/reference/owed-proofs.md, 2026-09-28.
272
+ - {up_to: 2048, step: 128}
273
+ - {up_to: 4096, step: 256}
274
+ - {up_to: 8192, step: 512}
275
+ - {up_to: 16384, step: 2048}
276
+ - {up_to: 32768, step: 4096}
277
+ - {up_to: 65536, step: 8192}
278
+ - {up_to: 131072, step: 16384}
279
+ - {up_to: 262144, step: 32768}
280
+ - {up_to: 524288, step: 65536}
281
+ - {up_to: null, step: 131072}
282
+
283
+ memory:
284
+ max_shared_memory_per_block: 98304 # 96 KB (Volta opt-in)
285
+ max_registers_per_block: 65536
286
+ # NVIDIA CUDA C++ Programming Guide, Technical Specifications per Compute Capability: "Maximum number of 32-bit
287
+ # registers per thread: 255" (7.x, 8.x, 9.x). Bounds a program's elements per thread (the row programs' prune).
288
+ max_registers_per_thread: 255
289
+ warp_size: 32
290
+ # SDPA deterministic-routing budget (P-TRITON-MOE-DETERMINISM-RESIDUAL).
291
+ # The Dao-AILab flash Triton kernel is non-deterministic on pre-Ampere
292
+ # SIMT. The deterministic _math_attention path is routed for pow2
293
+ # head_dim only when its [B*H,Tq,Tk] scores tensor is within this
294
+ # budget (non-pow2 head_dim is routed unconditionally — preserved
295
+ # PixArt/Sana path).
296
+ #
297
+ # 2026-07-27 (D6 root cause): the sm_70 flash race is not just
298
+ # nondeterministic NOISE — it is STRUCTURALLY BIASED. Measured on
299
+ # Wan2.1-T2V-1.3B block-0 self-attention ([2,12,4096,128], scores
300
+ # 1.61 GiB): bit-equal-input microtest flash-vs-math shows rel 9.4%
301
+ # concentrated 374x on tokens ≡ 9-15 (mod 32) — a tile-aligned
302
+ # corruption window that CFG (x5 on a 0.26-cancellation guided term)
303
+ # and short-schedule iteration amplify into the recorded vertical
304
+ # pixel band (cols 127-269) at 13f/10s. NBX_FORCE_MATH_ATTENTION=1
305
+ # kills the band (R29) and runs FASTER on that config. Budget raised
306
+ # 128 MiB -> 2 GiB so V100-32G-feasible diffusion self-attention
307
+ # (Wan-class 4096-token video DiT included) takes the deterministic
308
+ # math path; video-native token counts (Allegro 79200² ~ 1.2 TB,
309
+ # CogVideoX-class >> 2 GiB) stay on flash — no OOM regression. LLM
310
+ # prefill between the old and new bound (seqlen ~1152-4600 @ 32
311
+ # heads) moves to math: deterministic, and on sm_70 the flash kernel
312
+ # holds no perf advantage (structural ~10% cuBLAS ceiling; the Wan
313
+ # math run was faster end-to-end). Gate: attention-change diffusion
314
+ # regression battery per doctrine.
315
+ sdpa_math_max_scores_bytes: 2147483648 # 2 GiB (was 128 MiB pre-D6)
316
+ # Row block (alignment and floor) of the chunked deterministic
317
+ # math prefill; the chunk-halving retry on a refused allocation
318
+ # never goes below it.
319
+ sdpa_math_min_chunk_rows: 128
320
+ # Allocator pool: bytes the free-list may keep PARKED per device as a
321
+ # fraction of that device's memory (2026-09-02, pool default-on gate).
322
+ # Beyond it the largest parked blocks go back to the driver, bounding
323
+ # the pool's contribution to the driver watermark (measured +3.4 GB on
324
+ # the xlong int4 row unbounded). 0 = unbounded.
325
+ alloc_pool_parked_cap_fraction: 0.50
326
+ # Per-DEVICE cap: budget = min(bytes above, fraction x device memory_mb
327
+ # from the Prism profile). The auto profile (config/hardware/default.yml,
328
+ # generated from nvidia-smi memory.total) records memory_mb 16384 for
329
+ # V100-16G rows and 32768 for V100-32G rows — verified 2026-09-01
330
+ # against the file the runtime loads. 0.066 x 32768 MiB =
331
+ # 2,267,742,732 bytes > 2 GiB -> min() keeps the 32G budget at the
332
+ # 2 GiB base (zero route change there); 0.066 x 16384 MiB =
333
+ # 1,133,871,366 bytes (~1.06 GiB) caps 16G cards so the 1.90 GiB xlong
334
+ # scores chunk shrinks to fit instead of OOMing (2026-08-31
335
+ # heterogeneous-rig finding, block_scatter model->cuda:0).
336
+ sdpa_math_scores_device_fraction: 0.066
337
+
338
+ # P-NONDET-LONG-ROW (2026-08-23): shapes whose fp32 scores exceed the
339
+ # budget above routed to flash, whose Volta masked-load specialisation
340
+ # (where the exact D>=128 pad-by-one detour lands) is
341
+ # NON-DETERMINISTIC (kernel-level: 3 distinct outputs in 5 identical
342
+ # calls at the 4,164-token prefill shape). CHUNKED math splits the
343
+ # query rows so every chunk's scores fit the budget — deterministic
344
+ # by construction — bounded by this chunk-count ceiling. 16 covers
345
+ # LLM-class prefills to ~16k context (4k ctx -> 2 chunks); video-
346
+ # scale shapes (30-500+ chunks, prohibitive) keep their existing
347
+ # path and are the REGISTERED residual non-deterministic class on
348
+ # this hardware (defect register, trigger measured).
349
+ sdpa_math_max_chunks: 16
350
+
351
+ precision:
352
+ # Attention operands that disagree in dtype (an fp16 GEMM stored fp32 feeding V) all take the
353
+ # narrowest of the three, the compiled engine's alignment: the half attention stays on the matrix
354
+ # unit (V100, 2026-10-08: 1.16 s/op aligned narrowest vs 22.0 s/op on the scalar flash aligned widest).
355
+ attention_operands: narrowest
356
+ # Whether each engine branch's OWN kernels compute float64 / complex128 elements, read with
357
+ # supports_fp64 (both must hold) -- a CAPABILITY: `compiled` is ATen's, which carries both wherever
358
+ # the device does; `triton` is the NeuroBrix Triton kernels' (cuda/hip lower double; Metal's
359
+ # lowering narrows it in silence, measured 2026-09-28 on the Sana 4K positional embedding). Read
360
+ # by the DtypeEngine (`config.device_supports_fp64`) and by the Triton wrappers' binding
361
+ # (`triton.dtype.triton_has_fp64` -> `nbx_tensor.set_backend_has_fp64`).
362
+ kernels_carry_fp64:
363
+ compiled: true
364
+ triton: true
365
+ # Software-pipelining budget for autotuned Triton kernels (R23/R24: a
366
+ # hardware capability is read here, never queried from the driver in
367
+ # code). `max_num_stages` caps the num_stages of every autotune config.
368
+ # Volta (sm_70) has NO cp.async: Triton's pipelining with num_stages > 2
369
+ # emits async-copy instructions that fault with
370
+ # CUDA_ERROR_MISALIGNED_ADDRESS in any kernel using tl.dot. 2 is measured,
371
+ # not conservative.
372
+ pipelining:
373
+ max_num_stages: 2
374
+
375
+ # Autotune correctness screen. The engine runs every candidate config once and
376
+ # compares its result against a reference config's before timing any of them,
377
+ # because an autotuner that ranks on speed alone selects whichever WRONG
378
+ # kernel is fastest — a kernel that writes half its output does half the
379
+ # stores and wins. Measured on Apple 2026-09-07: fp16 mm [64,32]@[32,64] chose
380
+ # a config that left half the columns zero.
381
+ #
382
+ # These are the tolerances that separate "a different but valid summation
383
+ # order" from "a different answer". Two configs with different block sizes
384
+ # reduce in a different order, so their results differ in the last bits; a
385
+ # config that drops output differs by the scale of the output itself. The
386
+ # gap between those two is several orders of magnitude, and these sit in it.
387
+ #
388
+ # Relative to the reference's own magnitude: max|a - b| / max|b|. Integer
389
+ # and boolean results are compared BIT-IDENTICALLY and ignore this table —
390
+ # there is no valid reordering that changes an integer.
391
+ autotune_screen_rtol:
392
+ float16: 2.0e-2
393
+ bfloat16: 4.0e-2
394
+ float32: 1.0e-4
395
+ float64: 1.0e-8
396
+ int64: 0.0 # an integer result (the MoE alignment's routing tables) is met exactly
397
+
398
+ # Above this many bytes of buffer, the autotune correctness screen does not
399
+ # run. Screening copies every argument out and back once per candidate, so a
400
+ # very large tensor turns a tuning step into hundreds of megabytes of traffic
401
+ # — and on unified memory that pressure is the machine's, not a card's.
402
+ # MEASURED 2026-09-07: unbounded screening of a 151936-wide softmax perturbed
403
+ # six unrelated tests in the same process. A skipped screen is announced, not
404
+ # silent.
405
+ autotune_screen_max_bytes: 33554432
406
+
407
+ # Convolution weight storage order (launch_keys.conv_weight_layout): KCRS, the container's own,
408
+ # until this arch measures KRSC (the M4 Pro measured +46-63 % on its 3x3 keys, 2026-10-07).
409
+ conv:
410
+ weight_layout: KCRS
411
+