carray 3.0.0 → 3.0.2

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 (202) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/CHANGELOG.md +845 -3
  4. data/{NEWS.md → CHANGELOG.v1.md} +1 -1
  5. data/README.md +33 -33
  6. data/carray.gemspec +12 -8
  7. data/ext/ca_axis_dispatch.c +33 -4
  8. data/ext/ca_axis_group.c +256 -114
  9. data/ext/ca_binop_dispatch.c +5 -6
  10. data/ext/ca_binop_dispatch.h +0 -7
  11. data/ext/ca_categorical_iterator.c +121 -67
  12. data/ext/ca_for_each_element.h +6 -8
  13. data/ext/ca_group_iter.c +1 -1
  14. data/ext/ca_kernel_iterator.c +386 -74
  15. data/ext/ca_kernel_iterator.h +145 -45
  16. data/ext/ca_obj_array.c +62 -20
  17. data/ext/ca_obj_bincmp.c +57 -27
  18. data/ext/ca_obj_binop.c +86 -30
  19. data/ext/ca_obj_block.c +4 -4
  20. data/ext/ca_obj_const_string.c +88 -27
  21. data/ext/ca_obj_face.c +104 -0
  22. data/ext/ca_obj_face.h +48 -1
  23. data/ext/ca_obj_fake.c +11 -0
  24. data/ext/ca_obj_fixlen_string.c +21 -6
  25. data/ext/ca_obj_grid.c +11 -3
  26. data/ext/ca_obj_meld.c +125 -22
  27. data/ext/ca_obj_moncmp.c +33 -14
  28. data/ext/ca_obj_monop.c +19 -7
  29. data/ext/ca_obj_object.c +107 -4
  30. data/ext/ca_obj_record.c +3 -1
  31. data/ext/ca_obj_refer.c +30 -6
  32. data/ext/ca_obj_roll.c +13 -5
  33. data/ext/ca_obj_select.c +49 -34
  34. data/ext/ca_obj_select_axis.c +16 -6
  35. data/ext/ca_obj_shift.c +3 -3
  36. data/ext/ca_obj_stack.c +3 -8
  37. data/ext/ca_obj_stride.c +178 -24
  38. data/ext/ca_obj_string.c +11 -5
  39. data/ext/ca_obj_tile.c +13 -5
  40. data/ext/ca_obj_time.c +3 -1
  41. data/ext/ca_obj_timedelta.c +3 -1
  42. data/ext/ca_obj_transpose.c +1 -1
  43. data/ext/ca_obj_triop.c +62 -23
  44. data/ext/ca_obj_window.c +94 -19
  45. data/ext/ca_op_cmplx64.h +123 -0
  46. data/ext/ca_op_ipower.c +1 -5
  47. data/ext/ca_rng_normal.h +42 -0
  48. data/ext/ca_rng_xoshiro256pp.h +105 -0
  49. data/ext/ca_sort_kernels.h +5 -5
  50. data/ext/ca_sweep_engine.c +362 -155
  51. data/ext/ca_sweep_engine.h +39 -9
  52. data/ext/ca_transform_common.c +7 -0
  53. data/ext/carray.h +148 -132
  54. data/ext/carray_access.c +83 -49
  55. data/ext/carray_address_basis.c +590 -0
  56. data/ext/carray_bincount.c +8 -8
  57. data/ext/carray_broadcast.c +102 -9
  58. data/ext/carray_build_flags.h +3 -0
  59. data/ext/carray_call_cfunc.c +2010 -335
  60. data/ext/carray_call_cfunc.h +153 -0
  61. data/ext/carray_cast.c +184 -72
  62. data/ext/carray_conversion.c +22 -22
  63. data/ext/carray_copy.c +67 -32
  64. data/ext/carray_core.c +140 -13
  65. data/ext/carray_count.c +10 -11
  66. data/ext/carray_element.c +7 -7
  67. data/ext/carray_factorize.c +72 -51
  68. data/ext/carray_hold.c +1 -1
  69. data/ext/carray_index_classifier.c +7 -21
  70. data/ext/carray_internal.h +36 -3
  71. data/ext/carray_kernels_bincmp.c +1 -0
  72. data/ext/carray_kernels_binop.c +320 -298
  73. data/ext/carray_kernels_init.c +1095 -0
  74. data/ext/carray_kernels_map.c +1 -0
  75. data/ext/carray_kernels_moncmp.c +1 -0
  76. data/ext/carray_kernels_monop.c +412 -411
  77. data/ext/carray_kernels_reduce_aggregate.c +256 -87
  78. data/ext/carray_kernels_reduce_boolean.c +1 -0
  79. data/ext/carray_kernels_reduce_cumulative.c +324 -54
  80. data/ext/carray_kernels_reduce_extreme.c +605 -58
  81. data/ext/carray_kernels_reduce_variance.c +1 -0
  82. data/ext/carray_kernels_scan.c +5 -4
  83. data/ext/carray_kernels_search.c +187 -106
  84. data/ext/carray_kernels_sort.c +1 -0
  85. data/ext/carray_kernels_triop.c +1 -0
  86. data/ext/carray_lazy.c +175 -5
  87. data/ext/carray_loop.c +7 -1
  88. data/ext/carray_mask.c +29 -13
  89. data/ext/carray_median_percentile.c +56 -1
  90. data/ext/carray_memory_view.c +46 -21
  91. data/ext/carray_operator.c +50 -53
  92. data/ext/carray_order.c +1 -1
  93. data/ext/carray_partition.c +4 -4
  94. data/ext/carray_random.c +391 -47
  95. data/ext/carray_scatter.c +1 -1
  96. data/ext/carray_slab.c +13 -0
  97. data/ext/carray_sort.c +22 -24
  98. data/ext/carray_sort_kernel.c +10 -10
  99. data/ext/carray_test.c +1 -1
  100. data/ext/extconf.rb +18 -0
  101. data/ext/mk_call_cfunc.rb +323 -145
  102. data/ext/mkkernel.rb +651 -129
  103. data/ext/ruby_carray.c +28 -17
  104. data/ext/version.h +4 -4
  105. data/lib/carray/autoload_carray.rb +24 -3
  106. data/lib/carray/autoload_method_extension.rb +14 -1
  107. data/lib/carray/axis_group.rb +84 -7
  108. data/lib/carray/basics.rb +63 -59
  109. data/lib/carray/bincount_nd.rb +12 -12
  110. data/lib/carray/block_iterator.rb +111 -25
  111. data/lib/carray/categorical.rb +154 -37
  112. data/lib/carray/categorical_iterator.rb +300 -151
  113. data/lib/carray/conditional.rb +14 -14
  114. data/lib/carray/const_string.rb +131 -27
  115. data/lib/carray/construct.rb +61 -0
  116. data/lib/carray/core_extensions.rb +62 -5
  117. data/lib/carray/data_type_extension.rb +21 -1
  118. data/lib/carray/data_type_limits.rb +91 -0
  119. data/lib/carray/fixlen_string.rb +1 -1
  120. data/lib/carray/frame/concat.rb +3 -3
  121. data/lib/carray/frame/convert.rb +1 -1
  122. data/lib/carray/frame/csv_parser.rb +11 -4
  123. data/lib/carray/frame/frame.rb +85 -21
  124. data/lib/carray/frame/group.rb +36 -3
  125. data/lib/carray/frame/io.rb +224 -15
  126. data/lib/carray/frame/records.rb +18 -4
  127. data/lib/carray/frame/sort.rb +1 -1
  128. data/lib/carray/frame/verbs.rb +32 -12
  129. data/lib/carray/fuse_source.rb +123 -0
  130. data/lib/carray/fusion.rb +218 -0
  131. data/lib/carray/histogram.rb +16 -16
  132. data/lib/carray/inspect.rb +43 -16
  133. data/lib/carray/iterator.rb +147 -3
  134. data/lib/carray/lazy.rb +88 -73
  135. data/lib/carray/mask_gap_fill.rb +3 -1
  136. data/lib/carray/meld_reduce.rb +2 -2
  137. data/lib/carray/methods/align_addr.rb +1 -1
  138. data/lib/carray/methods/composition.rb +1 -1
  139. data/lib/carray/methods/discovery_along.rb +74 -0
  140. data/lib/carray/methods/factorize.rb +50 -0
  141. data/lib/carray/methods/is_in.rb +25 -14
  142. data/lib/carray/methods/locate_addr.rb +81 -3
  143. data/lib/carray/methods/mask_duplicates.rb +36 -2
  144. data/lib/carray/methods/meshgrid.rb +4 -5
  145. data/lib/carray/methods/mode.rb +2 -2
  146. data/lib/carray/methods/nunique.rb +23 -2
  147. data/lib/carray/methods/repeat.rb +110 -0
  148. data/lib/carray/methods/snap.rb +7 -2
  149. data/lib/carray/methods/unique.rb +44 -4
  150. data/lib/carray/methods/value_counts.rb +2 -2
  151. data/lib/carray/rng.rb +86 -0
  152. data/lib/carray/runtime.rb +0 -19
  153. data/lib/carray/slab_iterator.rb +77 -19
  154. data/lib/carray/string_operation_extension.rb +10 -6
  155. data/lib/carray/time.rb +906 -491
  156. data/lib/carray/window_iterator.rb +421 -27
  157. data/lib/carray.rb +7 -5
  158. data/yard-stubs/ca_obj_array.rb +385 -0
  159. data/yard-stubs/ca_obj_bitarray.rb +38 -0
  160. data/yard-stubs/ca_obj_bitfield.rb +43 -0
  161. data/yard-stubs/ca_obj_block.rb +68 -0
  162. data/yard-stubs/ca_obj_byte_swap.rb +56 -0
  163. data/yard-stubs/ca_obj_fake.rb +31 -0
  164. data/yard-stubs/ca_obj_farray.rb +32 -0
  165. data/yard-stubs/ca_obj_field.rb +45 -0
  166. data/yard-stubs/ca_obj_grid.rb +35 -0
  167. data/yard-stubs/ca_obj_refer.rb +72 -0
  168. data/yard-stubs/ca_obj_roll.rb +45 -0
  169. data/yard-stubs/ca_obj_shift.rb +43 -0
  170. data/yard-stubs/ca_obj_stride.rb +181 -0
  171. data/yard-stubs/ca_obj_tile.rb +29 -0
  172. data/yard-stubs/ca_obj_transpose.rb +40 -0
  173. data/yard-stubs/ca_obj_window.rb +57 -0
  174. data/yard-stubs/carray_access.rb +131 -0
  175. data/yard-stubs/carray_attribute.rb +246 -0
  176. data/yard-stubs/carray_broadcast.rb +37 -0
  177. data/yard-stubs/carray_cast.rb +489 -0
  178. data/yard-stubs/carray_class.rb +65 -0
  179. data/yard-stubs/carray_conversion.rb +76 -0
  180. data/yard-stubs/carray_copy.rb +79 -0
  181. data/yard-stubs/carray_core.rb +34 -0
  182. data/yard-stubs/carray_count.rb +84 -0
  183. data/yard-stubs/carray_element.rb +108 -0
  184. data/yard-stubs/carray_generate.rb +66 -0
  185. data/yard-stubs/carray_lazy.rb +228 -0
  186. data/yard-stubs/carray_loop.rb +140 -0
  187. data/yard-stubs/carray_mask.rb +259 -0
  188. data/yard-stubs/carray_math.rb +1615 -0
  189. data/yard-stubs/carray_mathfunc.rb +45 -0
  190. data/yard-stubs/carray_median_percentile.rb +103 -0
  191. data/yard-stubs/carray_memory_view.rb +163 -0
  192. data/yard-stubs/carray_order.rb +252 -0
  193. data/yard-stubs/carray_random.rb +89 -0
  194. data/yard-stubs/carray_scatter.rb +106 -0
  195. data/yard-stubs/carray_slab.rb +59 -0
  196. data/yard-stubs/carray_sort.rb +165 -0
  197. data/yard-stubs/carray_test.rb +85 -0
  198. data/yard-stubs/carray_undef.rb +64 -0
  199. data/yard-stubs/carray_utils.rb +97 -0
  200. data/yard-stubs/ruby_carray.rb +193 -0
  201. metadata +67 -10
  202. data/ext/ca_obj_unbound_repeat.c +0 -496
@@ -34,6 +34,7 @@ static inline VALUE BOOL2VAL (boolean8_t x) { return x ? Qtrue : Qfalse; }
34
34
  #endif
35
35
 
36
36
  #include "ca_op_powi.h"
37
+ #include "ca_op_cmplx64.h"
37
38
 
38
39
  /* ===== sum_ki ============================================ */
39
40
 
@@ -136,6 +137,7 @@ sum_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
136
137
  (void) v;
137
138
  }
138
139
  }
140
+
139
141
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
140
142
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
141
143
  }
@@ -215,6 +217,7 @@ sum_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
215
217
  (void) v;
216
218
  }
217
219
  }
220
+
218
221
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
219
222
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
220
223
  }
@@ -340,6 +343,7 @@ sum_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
340
343
  (void) v;
341
344
  }
342
345
  }
346
+
343
347
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
344
348
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
345
349
  }
@@ -370,8 +374,8 @@ sum_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
370
374
  write stride 1 (= contig output tail) both preserved -> SIMD
371
375
  tile reduce + write maintained.
372
376
 
373
- Performance characteristic (deliver-via-view, per the CLAUDE.md
374
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
377
+ Performance characteristic (deliver-via-view -- the surface
378
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
375
379
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
376
380
  = 2.38x slow. Root cause is the multi-parent data layout
377
381
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -500,6 +504,7 @@ sum_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
500
504
  (void) v;
501
505
  }
502
506
  }
507
+
503
508
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
504
509
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
505
510
  }
@@ -655,6 +660,7 @@ sum_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
655
660
  (void) v;
656
661
  }
657
662
  }
663
+
658
664
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
659
665
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
660
666
  }
@@ -734,6 +740,7 @@ sum_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
734
740
  (void) v;
735
741
  }
736
742
  }
743
+
737
744
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
738
745
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
739
746
  }
@@ -859,6 +866,7 @@ sum_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
859
866
  (void) v;
860
867
  }
861
868
  }
869
+
862
870
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
863
871
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
864
872
  }
@@ -889,8 +897,8 @@ sum_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
889
897
  write stride 1 (= contig output tail) both preserved -> SIMD
890
898
  tile reduce + write maintained.
891
899
 
892
- Performance characteristic (deliver-via-view, per the CLAUDE.md
893
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
900
+ Performance characteristic (deliver-via-view -- the surface
901
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
894
902
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
895
903
  = 2.38x slow. Root cause is the multi-parent data layout
896
904
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -1019,6 +1027,7 @@ sum_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int k
1019
1027
  (void) v;
1020
1028
  }
1021
1029
  }
1030
+
1022
1031
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
1023
1032
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
1024
1033
  }
@@ -1174,6 +1183,7 @@ sum_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
1174
1183
  (void) v;
1175
1184
  }
1176
1185
  }
1186
+
1177
1187
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
1178
1188
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
1179
1189
  }
@@ -1253,6 +1263,7 @@ sum_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
1253
1263
  (void) v;
1254
1264
  }
1255
1265
  }
1266
+
1256
1267
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
1257
1268
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
1258
1269
  }
@@ -1378,6 +1389,7 @@ sum_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
1378
1389
  (void) v;
1379
1390
  }
1380
1391
  }
1392
+
1381
1393
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
1382
1394
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
1383
1395
  }
@@ -1408,8 +1420,8 @@ sum_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
1408
1420
  write stride 1 (= contig output tail) both preserved -> SIMD
1409
1421
  tile reduce + write maintained.
1410
1422
 
1411
- Performance characteristic (deliver-via-view, per the CLAUDE.md
1412
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
1423
+ Performance characteristic (deliver-via-view -- the surface
1424
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
1413
1425
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
1414
1426
  = 2.38x slow. Root cause is the multi-parent data layout
1415
1427
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -1538,6 +1550,7 @@ sum_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
1538
1550
  (void) v;
1539
1551
  }
1540
1552
  }
1553
+
1541
1554
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
1542
1555
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
1543
1556
  }
@@ -1693,6 +1706,7 @@ sum_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
1693
1706
  (void) v;
1694
1707
  }
1695
1708
  }
1709
+
1696
1710
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
1697
1711
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
1698
1712
  }
@@ -1772,6 +1786,7 @@ sum_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
1772
1786
  (void) v;
1773
1787
  }
1774
1788
  }
1789
+
1775
1790
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
1776
1791
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
1777
1792
  }
@@ -1897,6 +1912,7 @@ sum_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
1897
1912
  (void) v;
1898
1913
  }
1899
1914
  }
1915
+
1900
1916
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
1901
1917
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
1902
1918
  }
@@ -1927,8 +1943,8 @@ sum_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
1927
1943
  write stride 1 (= contig output tail) both preserved -> SIMD
1928
1944
  tile reduce + write maintained.
1929
1945
 
1930
- Performance characteristic (deliver-via-view, per the CLAUDE.md
1931
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
1946
+ Performance characteristic (deliver-via-view -- the surface
1947
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
1932
1948
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
1933
1949
  = 2.38x slow. Root cause is the multi-parent data layout
1934
1950
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -2057,6 +2073,7 @@ sum_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2057
2073
  (void) v;
2058
2074
  }
2059
2075
  }
2076
+
2060
2077
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
2061
2078
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
2062
2079
  }
@@ -2212,6 +2229,7 @@ sum_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2212
2229
  (void) v;
2213
2230
  }
2214
2231
  }
2232
+
2215
2233
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
2216
2234
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
2217
2235
  }
@@ -2291,6 +2309,7 @@ sum_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2291
2309
  (void) v;
2292
2310
  }
2293
2311
  }
2312
+
2294
2313
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
2295
2314
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
2296
2315
  }
@@ -2416,6 +2435,7 @@ sum_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2416
2435
  (void) v;
2417
2436
  }
2418
2437
  }
2438
+
2419
2439
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
2420
2440
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
2421
2441
  }
@@ -2446,8 +2466,8 @@ sum_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2446
2466
  write stride 1 (= contig output tail) both preserved -> SIMD
2447
2467
  tile reduce + write maintained.
2448
2468
 
2449
- Performance characteristic (deliver-via-view, per the CLAUDE.md
2450
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
2469
+ Performance characteristic (deliver-via-view -- the surface
2470
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
2451
2471
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
2452
2472
  = 2.38x slow. Root cause is the multi-parent data layout
2453
2473
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -2576,6 +2596,7 @@ sum_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2576
2596
  (void) v;
2577
2597
  }
2578
2598
  }
2599
+
2579
2600
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
2580
2601
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
2581
2602
  }
@@ -2731,6 +2752,7 @@ sum_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2731
2752
  (void) v;
2732
2753
  }
2733
2754
  }
2755
+
2734
2756
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
2735
2757
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
2736
2758
  }
@@ -2810,6 +2832,7 @@ sum_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2810
2832
  (void) v;
2811
2833
  }
2812
2834
  }
2835
+
2813
2836
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
2814
2837
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
2815
2838
  }
@@ -2935,6 +2958,7 @@ sum_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2935
2958
  (void) v;
2936
2959
  }
2937
2960
  }
2961
+
2938
2962
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
2939
2963
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
2940
2964
  }
@@ -2965,8 +2989,8 @@ sum_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
2965
2989
  write stride 1 (= contig output tail) both preserved -> SIMD
2966
2990
  tile reduce + write maintained.
2967
2991
 
2968
- Performance characteristic (deliver-via-view, per the CLAUDE.md
2969
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
2992
+ Performance characteristic (deliver-via-view -- the surface
2993
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
2970
2994
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
2971
2995
  = 2.38x slow. Root cause is the multi-parent data layout
2972
2996
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -3095,6 +3119,7 @@ sum_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
3095
3119
  (void) v;
3096
3120
  }
3097
3121
  }
3122
+
3098
3123
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
3099
3124
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
3100
3125
  }
@@ -3250,6 +3275,7 @@ sum_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
3250
3275
  (void) v;
3251
3276
  }
3252
3277
  }
3278
+
3253
3279
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
3254
3280
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
3255
3281
  }
@@ -3329,6 +3355,7 @@ sum_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
3329
3355
  (void) v;
3330
3356
  }
3331
3357
  }
3358
+
3332
3359
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
3333
3360
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
3334
3361
  }
@@ -3454,6 +3481,7 @@ sum_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
3454
3481
  (void) v;
3455
3482
  }
3456
3483
  }
3484
+
3457
3485
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
3458
3486
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
3459
3487
  }
@@ -3484,8 +3512,8 @@ sum_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
3484
3512
  write stride 1 (= contig output tail) both preserved -> SIMD
3485
3513
  tile reduce + write maintained.
3486
3514
 
3487
- Performance characteristic (deliver-via-view, per the CLAUDE.md
3488
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
3515
+ Performance characteristic (deliver-via-view -- the surface
3516
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
3489
3517
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
3490
3518
  = 2.38x slow. Root cause is the multi-parent data layout
3491
3519
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -3614,6 +3642,7 @@ sum_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
3614
3642
  (void) v;
3615
3643
  }
3616
3644
  }
3645
+
3617
3646
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
3618
3647
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
3619
3648
  }
@@ -3769,6 +3798,7 @@ sum_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
3769
3798
  (void) v;
3770
3799
  }
3771
3800
  }
3801
+
3772
3802
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
3773
3803
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
3774
3804
  }
@@ -3848,6 +3878,7 @@ sum_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
3848
3878
  (void) v;
3849
3879
  }
3850
3880
  }
3881
+
3851
3882
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
3852
3883
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
3853
3884
  }
@@ -3973,6 +4004,7 @@ sum_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
3973
4004
  (void) v;
3974
4005
  }
3975
4006
  }
4007
+
3976
4008
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
3977
4009
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
3978
4010
  }
@@ -4003,8 +4035,8 @@ sum_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
4003
4035
  write stride 1 (= contig output tail) both preserved -> SIMD
4004
4036
  tile reduce + write maintained.
4005
4037
 
4006
- Performance characteristic (deliver-via-view, per the CLAUDE.md
4007
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
4038
+ Performance characteristic (deliver-via-view -- the surface
4039
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
4008
4040
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
4009
4041
  = 2.38x slow. Root cause is the multi-parent data layout
4010
4042
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -4133,6 +4165,7 @@ sum_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
4133
4165
  (void) v;
4134
4166
  }
4135
4167
  }
4168
+
4136
4169
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
4137
4170
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
4138
4171
  }
@@ -4288,6 +4321,7 @@ sum_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
4288
4321
  (void) v;
4289
4322
  }
4290
4323
  }
4324
+
4291
4325
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
4292
4326
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
4293
4327
  }
@@ -4367,6 +4401,7 @@ sum_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
4367
4401
  (void) v;
4368
4402
  }
4369
4403
  }
4404
+
4370
4405
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
4371
4406
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
4372
4407
  }
@@ -4492,6 +4527,7 @@ sum_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
4492
4527
  (void) v;
4493
4528
  }
4494
4529
  }
4530
+
4495
4531
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
4496
4532
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
4497
4533
  }
@@ -4522,8 +4558,8 @@ sum_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
4522
4558
  write stride 1 (= contig output tail) both preserved -> SIMD
4523
4559
  tile reduce + write maintained.
4524
4560
 
4525
- Performance characteristic (deliver-via-view, per the CLAUDE.md
4526
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
4561
+ Performance characteristic (deliver-via-view -- the surface
4562
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
4527
4563
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
4528
4564
  = 2.38x slow. Root cause is the multi-parent data layout
4529
4565
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -4652,6 +4688,7 @@ sum_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
4652
4688
  (void) v;
4653
4689
  }
4654
4690
  }
4691
+
4655
4692
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
4656
4693
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
4657
4694
  }
@@ -4807,6 +4844,7 @@ sum_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
4807
4844
  (void) v;
4808
4845
  }
4809
4846
  }
4847
+
4810
4848
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
4811
4849
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
4812
4850
  }
@@ -4886,6 +4924,7 @@ sum_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
4886
4924
  (void) v;
4887
4925
  }
4888
4926
  }
4927
+
4889
4928
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
4890
4929
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
4891
4930
  }
@@ -5011,6 +5050,7 @@ sum_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
5011
5050
  (void) v;
5012
5051
  }
5013
5052
  }
5053
+
5014
5054
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
5015
5055
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
5016
5056
  }
@@ -5041,8 +5081,8 @@ sum_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
5041
5081
  write stride 1 (= contig output tail) both preserved -> SIMD
5042
5082
  tile reduce + write maintained.
5043
5083
 
5044
- Performance characteristic (deliver-via-view, per the CLAUDE.md
5045
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
5084
+ Performance characteristic (deliver-via-view -- the surface
5085
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
5046
5086
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
5047
5087
  = 2.38x slow. Root cause is the multi-parent data layout
5048
5088
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -5171,6 +5211,7 @@ sum_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
5171
5211
  (void) v;
5172
5212
  }
5173
5213
  }
5214
+
5174
5215
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
5175
5216
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
5176
5217
  }
@@ -5326,6 +5367,7 @@ sum_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
5326
5367
  (void) v;
5327
5368
  }
5328
5369
  }
5370
+
5329
5371
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
5330
5372
  op[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
5331
5373
  }
@@ -5405,6 +5447,7 @@ sum_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
5405
5447
  (void) v;
5406
5448
  }
5407
5449
  }
5450
+
5408
5451
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
5409
5452
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
5410
5453
  }
@@ -5530,6 +5573,7 @@ sum_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
5530
5573
  (void) v;
5531
5574
  }
5532
5575
  }
5576
+
5533
5577
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
5534
5578
  __li_op_k[__li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
5535
5579
  }
@@ -5560,8 +5604,8 @@ sum_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
5560
5604
  write stride 1 (= contig output tail) both preserved -> SIMD
5561
5605
  tile reduce + write maintained.
5562
5606
 
5563
- Performance characteristic (deliver-via-view, per the CLAUDE.md
5564
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
5607
+ Performance characteristic (deliver-via-view -- the surface
5608
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
5565
5609
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
5566
5610
  = 2.38x slow. Root cause is the multi-parent data layout
5567
5611
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -5690,6 +5734,7 @@ sum_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
5690
5734
  (void) v;
5691
5735
  }
5692
5736
  }
5737
+
5693
5738
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
5694
5739
  __li_op_k[__li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
5695
5740
  }
@@ -5845,6 +5890,7 @@ sum_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
5845
5890
  (void) v;
5846
5891
  }
5847
5892
  }
5893
+
5848
5894
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
5849
5895
  op[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
5850
5896
  }
@@ -5924,6 +5970,7 @@ sum_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
5924
5970
  (void) v;
5925
5971
  }
5926
5972
  }
5973
+
5927
5974
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
5928
5975
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
5929
5976
  }
@@ -6049,6 +6096,7 @@ sum_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
6049
6096
  (void) v;
6050
6097
  }
6051
6098
  }
6099
+
6052
6100
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
6053
6101
  __li_op_k[__li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
6054
6102
  }
@@ -6079,8 +6127,8 @@ sum_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
6079
6127
  write stride 1 (= contig output tail) both preserved -> SIMD
6080
6128
  tile reduce + write maintained.
6081
6129
 
6082
- Performance characteristic (deliver-via-view, per the CLAUDE.md
6083
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
6130
+ Performance characteristic (deliver-via-view -- the surface
6131
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
6084
6132
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
6085
6133
  = 2.38x slow. Root cause is the multi-parent data layout
6086
6134
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -6209,6 +6257,7 @@ sum_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
6209
6257
  (void) v;
6210
6258
  }
6211
6259
  }
6260
+
6212
6261
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
6213
6262
  __li_op_k[__li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
6214
6263
  }
@@ -6364,6 +6413,7 @@ sum_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
6364
6413
  (void) v;
6365
6414
  }
6366
6415
  }
6416
+
6367
6417
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
6368
6418
  op[__li_o * __li_INNER + __li_tile + __j] = (uint64_t) (__li_buf_acc[__j]);
6369
6419
  }
@@ -6443,6 +6493,7 @@ sum_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
6443
6493
  (void) v;
6444
6494
  }
6445
6495
  }
6496
+
6446
6497
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
6447
6498
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (uint64_t) (__li_buf_acc[__j]);
6448
6499
  }
@@ -6568,6 +6619,7 @@ sum_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
6568
6619
  (void) v;
6569
6620
  }
6570
6621
  }
6622
+
6571
6623
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
6572
6624
  __li_op_k[__li_tile + __j] = (uint64_t) (__li_buf_acc[__j]);
6573
6625
  }
@@ -6598,8 +6650,8 @@ sum_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
6598
6650
  write stride 1 (= contig output tail) both preserved -> SIMD
6599
6651
  tile reduce + write maintained.
6600
6652
 
6601
- Performance characteristic (deliver-via-view, per the CLAUDE.md
6602
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
6653
+ Performance characteristic (deliver-via-view -- the surface
6654
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
6603
6655
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
6604
6656
  = 2.38x slow. Root cause is the multi-parent data layout
6605
6657
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -6728,6 +6780,7 @@ sum_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
6728
6780
  (void) v;
6729
6781
  }
6730
6782
  }
6783
+
6731
6784
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
6732
6785
  __li_op_k[__li_tile + __j] = (uint64_t) (__li_buf_acc[__j]);
6733
6786
  }
@@ -6814,7 +6867,7 @@ sum_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, i
6814
6867
  ca_size_t masked_cnt = 0; /* unused on streaming (no mask) */
6815
6868
  (void) masked_cnt;
6816
6869
  ca_lazy_arena_enter();
6817
- VALUE *__chunk = (VALUE *) ca_lazy_arena_acquire(__chunk_elems * sizeof(VALUE));
6870
+ VALUE *__chunk = (VALUE *) ca_lazy_arena_acquire_object(__chunk_elems);
6818
6871
  while ( __outer_off < __outer ) {
6819
6872
  ca_size_t __r = (__outer - __outer_off < __rows) ? (__outer - __outer_off) : __rows;
6820
6873
  ca_size_t __n = __r * __inner;
@@ -6883,6 +6936,7 @@ sum_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, i
6883
6936
  (void) v;
6884
6937
  }
6885
6938
  }
6939
+
6886
6940
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
6887
6941
  op[__li_o * __li_INNER + __li_tile + __j] = (VALUE) (__li_buf_acc[__j]);
6888
6942
  }
@@ -6962,6 +7016,7 @@ sum_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, i
6962
7016
  (void) v;
6963
7017
  }
6964
7018
  }
7019
+
6965
7020
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
6966
7021
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (VALUE) (__li_buf_acc[__j]);
6967
7022
  }
@@ -7087,6 +7142,7 @@ sum_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, i
7087
7142
  (void) v;
7088
7143
  }
7089
7144
  }
7145
+
7090
7146
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
7091
7147
  __li_op_k[__li_tile + __j] = (VALUE) (__li_buf_acc[__j]);
7092
7148
  }
@@ -7117,8 +7173,8 @@ sum_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, i
7117
7173
  write stride 1 (= contig output tail) both preserved -> SIMD
7118
7174
  tile reduce + write maintained.
7119
7175
 
7120
- Performance characteristic (deliver-via-view, per the CLAUDE.md
7121
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
7176
+ Performance characteristic (deliver-via-view -- the surface
7177
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
7122
7178
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
7123
7179
  = 2.38x slow. Root cause is the multi-parent data layout
7124
7180
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -7247,6 +7303,7 @@ sum_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, i
7247
7303
  (void) v;
7248
7304
  }
7249
7305
  }
7306
+
7250
7307
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
7251
7308
  __li_op_k[__li_tile + __j] = (VALUE) (__li_buf_acc[__j]);
7252
7309
  }
@@ -7500,6 +7557,7 @@ prod_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
7500
7557
  (void) v;
7501
7558
  }
7502
7559
  }
7560
+
7503
7561
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
7504
7562
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
7505
7563
  }
@@ -7579,6 +7637,7 @@ prod_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
7579
7637
  (void) v;
7580
7638
  }
7581
7639
  }
7640
+
7582
7641
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
7583
7642
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
7584
7643
  }
@@ -7704,6 +7763,7 @@ prod_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
7704
7763
  (void) v;
7705
7764
  }
7706
7765
  }
7766
+
7707
7767
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
7708
7768
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
7709
7769
  }
@@ -7734,8 +7794,8 @@ prod_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
7734
7794
  write stride 1 (= contig output tail) both preserved -> SIMD
7735
7795
  tile reduce + write maintained.
7736
7796
 
7737
- Performance characteristic (deliver-via-view, per the CLAUDE.md
7738
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
7797
+ Performance characteristic (deliver-via-view -- the surface
7798
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
7739
7799
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
7740
7800
  = 2.38x slow. Root cause is the multi-parent data layout
7741
7801
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -7864,6 +7924,7 @@ prod_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
7864
7924
  (void) v;
7865
7925
  }
7866
7926
  }
7927
+
7867
7928
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
7868
7929
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
7869
7930
  }
@@ -8019,6 +8080,7 @@ prod_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8019
8080
  (void) v;
8020
8081
  }
8021
8082
  }
8083
+
8022
8084
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
8023
8085
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
8024
8086
  }
@@ -8098,6 +8160,7 @@ prod_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8098
8160
  (void) v;
8099
8161
  }
8100
8162
  }
8163
+
8101
8164
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
8102
8165
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
8103
8166
  }
@@ -8223,6 +8286,7 @@ prod_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8223
8286
  (void) v;
8224
8287
  }
8225
8288
  }
8289
+
8226
8290
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
8227
8291
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
8228
8292
  }
@@ -8253,8 +8317,8 @@ prod_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8253
8317
  write stride 1 (= contig output tail) both preserved -> SIMD
8254
8318
  tile reduce + write maintained.
8255
8319
 
8256
- Performance characteristic (deliver-via-view, per the CLAUDE.md
8257
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
8320
+ Performance characteristic (deliver-via-view -- the surface
8321
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
8258
8322
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
8259
8323
  = 2.38x slow. Root cause is the multi-parent data layout
8260
8324
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -8383,6 +8447,7 @@ prod_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8383
8447
  (void) v;
8384
8448
  }
8385
8449
  }
8450
+
8386
8451
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
8387
8452
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
8388
8453
  }
@@ -8538,6 +8603,7 @@ prod_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8538
8603
  (void) v;
8539
8604
  }
8540
8605
  }
8606
+
8541
8607
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
8542
8608
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
8543
8609
  }
@@ -8617,6 +8683,7 @@ prod_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8617
8683
  (void) v;
8618
8684
  }
8619
8685
  }
8686
+
8620
8687
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
8621
8688
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
8622
8689
  }
@@ -8742,6 +8809,7 @@ prod_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8742
8809
  (void) v;
8743
8810
  }
8744
8811
  }
8812
+
8745
8813
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
8746
8814
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
8747
8815
  }
@@ -8772,8 +8840,8 @@ prod_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8772
8840
  write stride 1 (= contig output tail) both preserved -> SIMD
8773
8841
  tile reduce + write maintained.
8774
8842
 
8775
- Performance characteristic (deliver-via-view, per the CLAUDE.md
8776
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
8843
+ Performance characteristic (deliver-via-view -- the surface
8844
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
8777
8845
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
8778
8846
  = 2.38x slow. Root cause is the multi-parent data layout
8779
8847
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -8902,6 +8970,7 @@ prod_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
8902
8970
  (void) v;
8903
8971
  }
8904
8972
  }
8973
+
8905
8974
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
8906
8975
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
8907
8976
  }
@@ -9057,6 +9126,7 @@ prod_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9057
9126
  (void) v;
9058
9127
  }
9059
9128
  }
9129
+
9060
9130
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
9061
9131
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
9062
9132
  }
@@ -9136,6 +9206,7 @@ prod_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9136
9206
  (void) v;
9137
9207
  }
9138
9208
  }
9209
+
9139
9210
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
9140
9211
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
9141
9212
  }
@@ -9261,6 +9332,7 @@ prod_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9261
9332
  (void) v;
9262
9333
  }
9263
9334
  }
9335
+
9264
9336
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
9265
9337
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
9266
9338
  }
@@ -9291,8 +9363,8 @@ prod_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9291
9363
  write stride 1 (= contig output tail) both preserved -> SIMD
9292
9364
  tile reduce + write maintained.
9293
9365
 
9294
- Performance characteristic (deliver-via-view, per the CLAUDE.md
9295
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
9366
+ Performance characteristic (deliver-via-view -- the surface
9367
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
9296
9368
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
9297
9369
  = 2.38x slow. Root cause is the multi-parent data layout
9298
9370
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -9421,6 +9493,7 @@ prod_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9421
9493
  (void) v;
9422
9494
  }
9423
9495
  }
9496
+
9424
9497
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
9425
9498
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
9426
9499
  }
@@ -9576,6 +9649,7 @@ prod_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9576
9649
  (void) v;
9577
9650
  }
9578
9651
  }
9652
+
9579
9653
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
9580
9654
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
9581
9655
  }
@@ -9655,6 +9729,7 @@ prod_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9655
9729
  (void) v;
9656
9730
  }
9657
9731
  }
9732
+
9658
9733
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
9659
9734
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
9660
9735
  }
@@ -9780,6 +9855,7 @@ prod_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9780
9855
  (void) v;
9781
9856
  }
9782
9857
  }
9858
+
9783
9859
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
9784
9860
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
9785
9861
  }
@@ -9810,8 +9886,8 @@ prod_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9810
9886
  write stride 1 (= contig output tail) both preserved -> SIMD
9811
9887
  tile reduce + write maintained.
9812
9888
 
9813
- Performance characteristic (deliver-via-view, per the CLAUDE.md
9814
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
9889
+ Performance characteristic (deliver-via-view -- the surface
9890
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
9815
9891
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
9816
9892
  = 2.38x slow. Root cause is the multi-parent data layout
9817
9893
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -9940,6 +10016,7 @@ prod_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
9940
10016
  (void) v;
9941
10017
  }
9942
10018
  }
10019
+
9943
10020
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
9944
10021
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
9945
10022
  }
@@ -10095,6 +10172,7 @@ prod_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10095
10172
  (void) v;
10096
10173
  }
10097
10174
  }
10175
+
10098
10176
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
10099
10177
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
10100
10178
  }
@@ -10174,6 +10252,7 @@ prod_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10174
10252
  (void) v;
10175
10253
  }
10176
10254
  }
10255
+
10177
10256
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
10178
10257
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
10179
10258
  }
@@ -10299,6 +10378,7 @@ prod_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10299
10378
  (void) v;
10300
10379
  }
10301
10380
  }
10381
+
10302
10382
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
10303
10383
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
10304
10384
  }
@@ -10329,8 +10409,8 @@ prod_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10329
10409
  write stride 1 (= contig output tail) both preserved -> SIMD
10330
10410
  tile reduce + write maintained.
10331
10411
 
10332
- Performance characteristic (deliver-via-view, per the CLAUDE.md
10333
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
10412
+ Performance characteristic (deliver-via-view -- the surface
10413
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
10334
10414
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
10335
10415
  = 2.38x slow. Root cause is the multi-parent data layout
10336
10416
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -10459,6 +10539,7 @@ prod_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10459
10539
  (void) v;
10460
10540
  }
10461
10541
  }
10542
+
10462
10543
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
10463
10544
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
10464
10545
  }
@@ -10614,6 +10695,7 @@ prod_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10614
10695
  (void) v;
10615
10696
  }
10616
10697
  }
10698
+
10617
10699
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
10618
10700
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
10619
10701
  }
@@ -10693,6 +10775,7 @@ prod_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10693
10775
  (void) v;
10694
10776
  }
10695
10777
  }
10778
+
10696
10779
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
10697
10780
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
10698
10781
  }
@@ -10818,6 +10901,7 @@ prod_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10818
10901
  (void) v;
10819
10902
  }
10820
10903
  }
10904
+
10821
10905
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
10822
10906
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
10823
10907
  }
@@ -10848,8 +10932,8 @@ prod_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10848
10932
  write stride 1 (= contig output tail) both preserved -> SIMD
10849
10933
  tile reduce + write maintained.
10850
10934
 
10851
- Performance characteristic (deliver-via-view, per the CLAUDE.md
10852
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
10935
+ Performance characteristic (deliver-via-view -- the surface
10936
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
10853
10937
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
10854
10938
  = 2.38x slow. Root cause is the multi-parent data layout
10855
10939
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -10978,6 +11062,7 @@ prod_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
10978
11062
  (void) v;
10979
11063
  }
10980
11064
  }
11065
+
10981
11066
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
10982
11067
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
10983
11068
  }
@@ -11133,6 +11218,7 @@ prod_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
11133
11218
  (void) v;
11134
11219
  }
11135
11220
  }
11221
+
11136
11222
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
11137
11223
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
11138
11224
  }
@@ -11212,6 +11298,7 @@ prod_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
11212
11298
  (void) v;
11213
11299
  }
11214
11300
  }
11301
+
11215
11302
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
11216
11303
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
11217
11304
  }
@@ -11337,6 +11424,7 @@ prod_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
11337
11424
  (void) v;
11338
11425
  }
11339
11426
  }
11427
+
11340
11428
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
11341
11429
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
11342
11430
  }
@@ -11367,8 +11455,8 @@ prod_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
11367
11455
  write stride 1 (= contig output tail) both preserved -> SIMD
11368
11456
  tile reduce + write maintained.
11369
11457
 
11370
- Performance characteristic (deliver-via-view, per the CLAUDE.md
11371
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
11458
+ Performance characteristic (deliver-via-view -- the surface
11459
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
11372
11460
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
11373
11461
  = 2.38x slow. Root cause is the multi-parent data layout
11374
11462
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -11497,6 +11585,7 @@ prod_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
11497
11585
  (void) v;
11498
11586
  }
11499
11587
  }
11588
+
11500
11589
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
11501
11590
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
11502
11591
  }
@@ -11652,6 +11741,7 @@ prod_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
11652
11741
  (void) v;
11653
11742
  }
11654
11743
  }
11744
+
11655
11745
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
11656
11746
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
11657
11747
  }
@@ -11731,6 +11821,7 @@ prod_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
11731
11821
  (void) v;
11732
11822
  }
11733
11823
  }
11824
+
11734
11825
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
11735
11826
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
11736
11827
  }
@@ -11856,6 +11947,7 @@ prod_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
11856
11947
  (void) v;
11857
11948
  }
11858
11949
  }
11950
+
11859
11951
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
11860
11952
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
11861
11953
  }
@@ -11886,8 +11978,8 @@ prod_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
11886
11978
  write stride 1 (= contig output tail) both preserved -> SIMD
11887
11979
  tile reduce + write maintained.
11888
11980
 
11889
- Performance characteristic (deliver-via-view, per the CLAUDE.md
11890
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
11981
+ Performance characteristic (deliver-via-view -- the surface
11982
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
11891
11983
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
11892
11984
  = 2.38x slow. Root cause is the multi-parent data layout
11893
11985
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -12016,6 +12108,7 @@ prod_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
12016
12108
  (void) v;
12017
12109
  }
12018
12110
  }
12111
+
12019
12112
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
12020
12113
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
12021
12114
  }
@@ -12171,6 +12264,7 @@ prod_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
12171
12264
  (void) v;
12172
12265
  }
12173
12266
  }
12267
+
12174
12268
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
12175
12269
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
12176
12270
  }
@@ -12250,6 +12344,7 @@ prod_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
12250
12344
  (void) v;
12251
12345
  }
12252
12346
  }
12347
+
12253
12348
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
12254
12349
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (__li_buf_acc[__j]);
12255
12350
  }
@@ -12375,6 +12470,7 @@ prod_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
12375
12470
  (void) v;
12376
12471
  }
12377
12472
  }
12473
+
12378
12474
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
12379
12475
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
12380
12476
  }
@@ -12405,8 +12501,8 @@ prod_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
12405
12501
  write stride 1 (= contig output tail) both preserved -> SIMD
12406
12502
  tile reduce + write maintained.
12407
12503
 
12408
- Performance characteristic (deliver-via-view, per the CLAUDE.md
12409
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
12504
+ Performance characteristic (deliver-via-view -- the surface
12505
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
12410
12506
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
12411
12507
  = 2.38x slow. Root cause is the multi-parent data layout
12412
12508
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -12535,6 +12631,7 @@ prod_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
12535
12631
  (void) v;
12536
12632
  }
12537
12633
  }
12634
+
12538
12635
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
12539
12636
  __li_op_k[__li_tile + __j] = (double) (__li_buf_acc[__j]);
12540
12637
  }
@@ -12690,6 +12787,7 @@ prod_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
12690
12787
  (void) v;
12691
12788
  }
12692
12789
  }
12790
+
12693
12791
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
12694
12792
  op[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
12695
12793
  }
@@ -12769,6 +12867,7 @@ prod_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
12769
12867
  (void) v;
12770
12868
  }
12771
12869
  }
12870
+
12772
12871
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
12773
12872
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
12774
12873
  }
@@ -12894,6 +12993,7 @@ prod_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
12894
12993
  (void) v;
12895
12994
  }
12896
12995
  }
12996
+
12897
12997
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
12898
12998
  __li_op_k[__li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
12899
12999
  }
@@ -12924,8 +13024,8 @@ prod_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
12924
13024
  write stride 1 (= contig output tail) both preserved -> SIMD
12925
13025
  tile reduce + write maintained.
12926
13026
 
12927
- Performance characteristic (deliver-via-view, per the CLAUDE.md
12928
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
13027
+ Performance characteristic (deliver-via-view -- the surface
13028
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
12929
13029
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
12930
13030
  = 2.38x slow. Root cause is the multi-parent data layout
12931
13031
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -13054,6 +13154,7 @@ prod_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
13054
13154
  (void) v;
13055
13155
  }
13056
13156
  }
13157
+
13057
13158
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
13058
13159
  __li_op_k[__li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
13059
13160
  }
@@ -13209,6 +13310,7 @@ prod_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
13209
13310
  (void) v;
13210
13311
  }
13211
13312
  }
13313
+
13212
13314
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
13213
13315
  op[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
13214
13316
  }
@@ -13288,6 +13390,7 @@ prod_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
13288
13390
  (void) v;
13289
13391
  }
13290
13392
  }
13393
+
13291
13394
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
13292
13395
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
13293
13396
  }
@@ -13413,6 +13516,7 @@ prod_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
13413
13516
  (void) v;
13414
13517
  }
13415
13518
  }
13519
+
13416
13520
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
13417
13521
  __li_op_k[__li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
13418
13522
  }
@@ -13443,8 +13547,8 @@ prod_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
13443
13547
  write stride 1 (= contig output tail) both preserved -> SIMD
13444
13548
  tile reduce + write maintained.
13445
13549
 
13446
- Performance characteristic (deliver-via-view, per the CLAUDE.md
13447
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
13550
+ Performance characteristic (deliver-via-view -- the surface
13551
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
13448
13552
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
13449
13553
  = 2.38x slow. Root cause is the multi-parent data layout
13450
13554
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -13573,6 +13677,7 @@ prod_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
13573
13677
  (void) v;
13574
13678
  }
13575
13679
  }
13680
+
13576
13681
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
13577
13682
  __li_op_k[__li_tile + __j] = (cmplx128_t) (__li_buf_acc[__j]);
13578
13683
  }
@@ -13728,6 +13833,7 @@ prod_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
13728
13833
  (void) v;
13729
13834
  }
13730
13835
  }
13836
+
13731
13837
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
13732
13838
  op[__li_o * __li_INNER + __li_tile + __j] = (uint64_t) (__li_buf_acc[__j]);
13733
13839
  }
@@ -13807,6 +13913,7 @@ prod_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
13807
13913
  (void) v;
13808
13914
  }
13809
13915
  }
13916
+
13810
13917
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
13811
13918
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (uint64_t) (__li_buf_acc[__j]);
13812
13919
  }
@@ -13932,6 +14039,7 @@ prod_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
13932
14039
  (void) v;
13933
14040
  }
13934
14041
  }
14042
+
13935
14043
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
13936
14044
  __li_op_k[__li_tile + __j] = (uint64_t) (__li_buf_acc[__j]);
13937
14045
  }
@@ -13962,8 +14070,8 @@ prod_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
13962
14070
  write stride 1 (= contig output tail) both preserved -> SIMD
13963
14071
  tile reduce + write maintained.
13964
14072
 
13965
- Performance characteristic (deliver-via-view, per the CLAUDE.md
13966
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
14073
+ Performance characteristic (deliver-via-view -- the surface
14074
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
13967
14075
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
13968
14076
  = 2.38x slow. Root cause is the multi-parent data layout
13969
14077
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -14092,6 +14200,7 @@ prod_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
14092
14200
  (void) v;
14093
14201
  }
14094
14202
  }
14203
+
14095
14204
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
14096
14205
  __li_op_k[__li_tile + __j] = (uint64_t) (__li_buf_acc[__j]);
14097
14206
  }
@@ -14178,7 +14287,7 @@ prod_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
14178
14287
  ca_size_t masked_cnt = 0; /* unused on streaming (no mask) */
14179
14288
  (void) masked_cnt;
14180
14289
  ca_lazy_arena_enter();
14181
- VALUE *__chunk = (VALUE *) ca_lazy_arena_acquire(__chunk_elems * sizeof(VALUE));
14290
+ VALUE *__chunk = (VALUE *) ca_lazy_arena_acquire_object(__chunk_elems);
14182
14291
  while ( __outer_off < __outer ) {
14183
14292
  ca_size_t __r = (__outer - __outer_off < __rows) ? (__outer - __outer_off) : __rows;
14184
14293
  ca_size_t __n = __r * __inner;
@@ -14247,6 +14356,7 @@ prod_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
14247
14356
  (void) v;
14248
14357
  }
14249
14358
  }
14359
+
14250
14360
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
14251
14361
  op[__li_o * __li_INNER + __li_tile + __j] = (VALUE) (__li_buf_acc[__j]);
14252
14362
  }
@@ -14326,6 +14436,7 @@ prod_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
14326
14436
  (void) v;
14327
14437
  }
14328
14438
  }
14439
+
14329
14440
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
14330
14441
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (VALUE) (__li_buf_acc[__j]);
14331
14442
  }
@@ -14451,6 +14562,7 @@ prod_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
14451
14562
  (void) v;
14452
14563
  }
14453
14564
  }
14565
+
14454
14566
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
14455
14567
  __li_op_k[__li_tile + __j] = (VALUE) (__li_buf_acc[__j]);
14456
14568
  }
@@ -14481,8 +14593,8 @@ prod_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
14481
14593
  write stride 1 (= contig output tail) both preserved -> SIMD
14482
14594
  tile reduce + write maintained.
14483
14595
 
14484
- Performance characteristic (deliver-via-view, per the CLAUDE.md
14485
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
14596
+ Performance characteristic (deliver-via-view -- the surface
14597
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
14486
14598
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
14487
14599
  = 2.38x slow. Root cause is the multi-parent data layout
14488
14600
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -14611,6 +14723,7 @@ prod_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
14611
14723
  (void) v;
14612
14724
  }
14613
14725
  }
14726
+
14614
14727
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
14615
14728
  __li_op_k[__li_tile + __j] = (VALUE) (__li_buf_acc[__j]);
14616
14729
  }
@@ -14865,6 +14978,7 @@ mean_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
14865
14978
  (void) v;
14866
14979
  }
14867
14980
  }
14981
+
14868
14982
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
14869
14983
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
14870
14984
  }
@@ -14944,6 +15058,7 @@ mean_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
14944
15058
  (void) v;
14945
15059
  }
14946
15060
  }
15061
+
14947
15062
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
14948
15063
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
14949
15064
  }
@@ -15069,6 +15184,7 @@ mean_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15069
15184
  (void) v;
15070
15185
  }
15071
15186
  }
15187
+
15072
15188
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
15073
15189
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
15074
15190
  }
@@ -15099,8 +15215,8 @@ mean_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15099
15215
  write stride 1 (= contig output tail) both preserved -> SIMD
15100
15216
  tile reduce + write maintained.
15101
15217
 
15102
- Performance characteristic (deliver-via-view, per the CLAUDE.md
15103
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
15218
+ Performance characteristic (deliver-via-view -- the surface
15219
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
15104
15220
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
15105
15221
  = 2.38x slow. Root cause is the multi-parent data layout
15106
15222
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -15229,6 +15345,7 @@ mean_ki_native_i8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15229
15345
  (void) v;
15230
15346
  }
15231
15347
  }
15348
+
15232
15349
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
15233
15350
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
15234
15351
  }
@@ -15387,6 +15504,7 @@ mean_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15387
15504
  (void) v;
15388
15505
  }
15389
15506
  }
15507
+
15390
15508
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
15391
15509
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
15392
15510
  }
@@ -15466,6 +15584,7 @@ mean_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15466
15584
  (void) v;
15467
15585
  }
15468
15586
  }
15587
+
15469
15588
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
15470
15589
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
15471
15590
  }
@@ -15591,6 +15710,7 @@ mean_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15591
15710
  (void) v;
15592
15711
  }
15593
15712
  }
15713
+
15594
15714
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
15595
15715
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
15596
15716
  }
@@ -15621,8 +15741,8 @@ mean_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15621
15741
  write stride 1 (= contig output tail) both preserved -> SIMD
15622
15742
  tile reduce + write maintained.
15623
15743
 
15624
- Performance characteristic (deliver-via-view, per the CLAUDE.md
15625
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
15744
+ Performance characteristic (deliver-via-view -- the surface
15745
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
15626
15746
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
15627
15747
  = 2.38x slow. Root cause is the multi-parent data layout
15628
15748
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -15751,6 +15871,7 @@ mean_ki_native_u8 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15751
15871
  (void) v;
15752
15872
  }
15753
15873
  }
15874
+
15754
15875
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
15755
15876
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
15756
15877
  }
@@ -15909,6 +16030,7 @@ mean_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15909
16030
  (void) v;
15910
16031
  }
15911
16032
  }
16033
+
15912
16034
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
15913
16035
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
15914
16036
  }
@@ -15988,6 +16110,7 @@ mean_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
15988
16110
  (void) v;
15989
16111
  }
15990
16112
  }
16113
+
15991
16114
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
15992
16115
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
15993
16116
  }
@@ -16113,6 +16236,7 @@ mean_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
16113
16236
  (void) v;
16114
16237
  }
16115
16238
  }
16239
+
16116
16240
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
16117
16241
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
16118
16242
  }
@@ -16143,8 +16267,8 @@ mean_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
16143
16267
  write stride 1 (= contig output tail) both preserved -> SIMD
16144
16268
  tile reduce + write maintained.
16145
16269
 
16146
- Performance characteristic (deliver-via-view, per the CLAUDE.md
16147
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
16270
+ Performance characteristic (deliver-via-view -- the surface
16271
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
16148
16272
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
16149
16273
  = 2.38x slow. Root cause is the multi-parent data layout
16150
16274
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -16273,6 +16397,7 @@ mean_ki_native_i16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
16273
16397
  (void) v;
16274
16398
  }
16275
16399
  }
16400
+
16276
16401
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
16277
16402
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
16278
16403
  }
@@ -16431,6 +16556,7 @@ mean_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
16431
16556
  (void) v;
16432
16557
  }
16433
16558
  }
16559
+
16434
16560
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
16435
16561
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
16436
16562
  }
@@ -16510,6 +16636,7 @@ mean_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
16510
16636
  (void) v;
16511
16637
  }
16512
16638
  }
16639
+
16513
16640
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
16514
16641
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
16515
16642
  }
@@ -16635,6 +16762,7 @@ mean_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
16635
16762
  (void) v;
16636
16763
  }
16637
16764
  }
16765
+
16638
16766
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
16639
16767
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
16640
16768
  }
@@ -16665,8 +16793,8 @@ mean_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
16665
16793
  write stride 1 (= contig output tail) both preserved -> SIMD
16666
16794
  tile reduce + write maintained.
16667
16795
 
16668
- Performance characteristic (deliver-via-view, per the CLAUDE.md
16669
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
16796
+ Performance characteristic (deliver-via-view -- the surface
16797
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
16670
16798
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
16671
16799
  = 2.38x slow. Root cause is the multi-parent data layout
16672
16800
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -16795,6 +16923,7 @@ mean_ki_native_u16 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
16795
16923
  (void) v;
16796
16924
  }
16797
16925
  }
16926
+
16798
16927
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
16799
16928
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
16800
16929
  }
@@ -16953,6 +17082,7 @@ mean_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
16953
17082
  (void) v;
16954
17083
  }
16955
17084
  }
17085
+
16956
17086
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
16957
17087
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
16958
17088
  }
@@ -17032,6 +17162,7 @@ mean_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17032
17162
  (void) v;
17033
17163
  }
17034
17164
  }
17165
+
17035
17166
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
17036
17167
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
17037
17168
  }
@@ -17157,6 +17288,7 @@ mean_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17157
17288
  (void) v;
17158
17289
  }
17159
17290
  }
17291
+
17160
17292
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
17161
17293
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
17162
17294
  }
@@ -17187,8 +17319,8 @@ mean_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17187
17319
  write stride 1 (= contig output tail) both preserved -> SIMD
17188
17320
  tile reduce + write maintained.
17189
17321
 
17190
- Performance characteristic (deliver-via-view, per the CLAUDE.md
17191
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
17322
+ Performance characteristic (deliver-via-view -- the surface
17323
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
17192
17324
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
17193
17325
  = 2.38x slow. Root cause is the multi-parent data layout
17194
17326
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -17317,6 +17449,7 @@ mean_ki_native_i32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17317
17449
  (void) v;
17318
17450
  }
17319
17451
  }
17452
+
17320
17453
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
17321
17454
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
17322
17455
  }
@@ -17475,6 +17608,7 @@ mean_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17475
17608
  (void) v;
17476
17609
  }
17477
17610
  }
17611
+
17478
17612
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
17479
17613
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
17480
17614
  }
@@ -17554,6 +17688,7 @@ mean_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17554
17688
  (void) v;
17555
17689
  }
17556
17690
  }
17691
+
17557
17692
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
17558
17693
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
17559
17694
  }
@@ -17679,6 +17814,7 @@ mean_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17679
17814
  (void) v;
17680
17815
  }
17681
17816
  }
17817
+
17682
17818
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
17683
17819
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
17684
17820
  }
@@ -17709,8 +17845,8 @@ mean_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17709
17845
  write stride 1 (= contig output tail) both preserved -> SIMD
17710
17846
  tile reduce + write maintained.
17711
17847
 
17712
- Performance characteristic (deliver-via-view, per the CLAUDE.md
17713
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
17848
+ Performance characteristic (deliver-via-view -- the surface
17849
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
17714
17850
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
17715
17851
  = 2.38x slow. Root cause is the multi-parent data layout
17716
17852
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -17839,6 +17975,7 @@ mean_ki_native_u32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17839
17975
  (void) v;
17840
17976
  }
17841
17977
  }
17978
+
17842
17979
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
17843
17980
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
17844
17981
  }
@@ -17997,6 +18134,7 @@ mean_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
17997
18134
  (void) v;
17998
18135
  }
17999
18136
  }
18137
+
18000
18138
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
18001
18139
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
18002
18140
  }
@@ -18076,6 +18214,7 @@ mean_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
18076
18214
  (void) v;
18077
18215
  }
18078
18216
  }
18217
+
18079
18218
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
18080
18219
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
18081
18220
  }
@@ -18201,6 +18340,7 @@ mean_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
18201
18340
  (void) v;
18202
18341
  }
18203
18342
  }
18343
+
18204
18344
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
18205
18345
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
18206
18346
  }
@@ -18231,8 +18371,8 @@ mean_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
18231
18371
  write stride 1 (= contig output tail) both preserved -> SIMD
18232
18372
  tile reduce + write maintained.
18233
18373
 
18234
- Performance characteristic (deliver-via-view, per the CLAUDE.md
18235
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
18374
+ Performance characteristic (deliver-via-view -- the surface
18375
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
18236
18376
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
18237
18377
  = 2.38x slow. Root cause is the multi-parent data layout
18238
18378
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -18361,6 +18501,7 @@ mean_ki_native_i64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
18361
18501
  (void) v;
18362
18502
  }
18363
18503
  }
18504
+
18364
18505
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
18365
18506
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
18366
18507
  }
@@ -18519,6 +18660,7 @@ mean_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
18519
18660
  (void) v;
18520
18661
  }
18521
18662
  }
18663
+
18522
18664
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
18523
18665
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
18524
18666
  }
@@ -18598,6 +18740,7 @@ mean_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
18598
18740
  (void) v;
18599
18741
  }
18600
18742
  }
18743
+
18601
18744
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
18602
18745
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
18603
18746
  }
@@ -18723,6 +18866,7 @@ mean_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
18723
18866
  (void) v;
18724
18867
  }
18725
18868
  }
18869
+
18726
18870
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
18727
18871
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
18728
18872
  }
@@ -18753,8 +18897,8 @@ mean_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
18753
18897
  write stride 1 (= contig output tail) both preserved -> SIMD
18754
18898
  tile reduce + write maintained.
18755
18899
 
18756
- Performance characteristic (deliver-via-view, per the CLAUDE.md
18757
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
18900
+ Performance characteristic (deliver-via-view -- the surface
18901
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
18758
18902
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
18759
18903
  = 2.38x slow. Root cause is the multi-parent data layout
18760
18904
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -18883,6 +19027,7 @@ mean_ki_native_u64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
18883
19027
  (void) v;
18884
19028
  }
18885
19029
  }
19030
+
18886
19031
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
18887
19032
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
18888
19033
  }
@@ -19041,6 +19186,7 @@ mean_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19041
19186
  (void) v;
19042
19187
  }
19043
19188
  }
19189
+
19044
19190
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
19045
19191
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
19046
19192
  }
@@ -19120,6 +19266,7 @@ mean_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19120
19266
  (void) v;
19121
19267
  }
19122
19268
  }
19269
+
19123
19270
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
19124
19271
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
19125
19272
  }
@@ -19245,6 +19392,7 @@ mean_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19245
19392
  (void) v;
19246
19393
  }
19247
19394
  }
19395
+
19248
19396
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
19249
19397
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
19250
19398
  }
@@ -19275,8 +19423,8 @@ mean_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19275
19423
  write stride 1 (= contig output tail) both preserved -> SIMD
19276
19424
  tile reduce + write maintained.
19277
19425
 
19278
- Performance characteristic (deliver-via-view, per the CLAUDE.md
19279
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
19426
+ Performance characteristic (deliver-via-view -- the surface
19427
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
19280
19428
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
19281
19429
  = 2.38x slow. Root cause is the multi-parent data layout
19282
19430
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -19405,6 +19553,7 @@ mean_ki_native_f32 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19405
19553
  (void) v;
19406
19554
  }
19407
19555
  }
19556
+
19408
19557
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
19409
19558
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
19410
19559
  }
@@ -19563,6 +19712,7 @@ mean_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19563
19712
  (void) v;
19564
19713
  }
19565
19714
  }
19715
+
19566
19716
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
19567
19717
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
19568
19718
  }
@@ -19642,6 +19792,7 @@ mean_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19642
19792
  (void) v;
19643
19793
  }
19644
19794
  }
19795
+
19645
19796
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
19646
19797
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
19647
19798
  }
@@ -19767,6 +19918,7 @@ mean_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19767
19918
  (void) v;
19768
19919
  }
19769
19920
  }
19921
+
19770
19922
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
19771
19923
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
19772
19924
  }
@@ -19797,8 +19949,8 @@ mean_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19797
19949
  write stride 1 (= contig output tail) both preserved -> SIMD
19798
19950
  tile reduce + write maintained.
19799
19951
 
19800
- Performance characteristic (deliver-via-view, per the CLAUDE.md
19801
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
19952
+ Performance characteristic (deliver-via-view -- the surface
19953
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
19802
19954
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
19803
19955
  = 2.38x slow. Root cause is the multi-parent data layout
19804
19956
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -19927,6 +20079,7 @@ mean_ki_native_f64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, int
19927
20079
  (void) v;
19928
20080
  }
19929
20081
  }
20082
+
19930
20083
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
19931
20084
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
19932
20085
  }
@@ -20085,6 +20238,7 @@ mean_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
20085
20238
  (void) v;
20086
20239
  }
20087
20240
  }
20241
+
20088
20242
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
20089
20243
  op[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (((int64_t)__li_M) ? __li_buf_acc[__j] / (cmplx128_t) ((int64_t)__li_M) : 0);
20090
20244
  }
@@ -20164,6 +20318,7 @@ mean_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
20164
20318
  (void) v;
20165
20319
  }
20166
20320
  }
20321
+
20167
20322
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
20168
20323
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (((int64_t)__li_M) ? __li_buf_acc[__j] / (cmplx128_t) ((int64_t)__li_M) : 0);
20169
20324
  }
@@ -20289,6 +20444,7 @@ mean_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
20289
20444
  (void) v;
20290
20445
  }
20291
20446
  }
20447
+
20292
20448
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
20293
20449
  __li_op_k[__li_tile + __j] = (cmplx128_t) (((int64_t)__li_M) ? __li_buf_acc[__j] / (cmplx128_t) ((int64_t)__li_M) : 0);
20294
20450
  }
@@ -20319,8 +20475,8 @@ mean_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
20319
20475
  write stride 1 (= contig output tail) both preserved -> SIMD
20320
20476
  tile reduce + write maintained.
20321
20477
 
20322
- Performance characteristic (deliver-via-view, per the CLAUDE.md
20323
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
20478
+ Performance characteristic (deliver-via-view -- the surface
20479
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
20324
20480
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
20325
20481
  = 2.38x slow. Root cause is the multi-parent data layout
20326
20482
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -20449,6 +20605,7 @@ mean_ki_native_cmplx64 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
20449
20605
  (void) v;
20450
20606
  }
20451
20607
  }
20608
+
20452
20609
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
20453
20610
  __li_op_k[__li_tile + __j] = (cmplx128_t) (((int64_t)__li_M) ? __li_buf_acc[__j] / (cmplx128_t) ((int64_t)__li_M) : 0);
20454
20611
  }
@@ -20607,6 +20764,7 @@ mean_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
20607
20764
  (void) v;
20608
20765
  }
20609
20766
  }
20767
+
20610
20768
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
20611
20769
  op[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (((int64_t)__li_M) ? __li_buf_acc[__j] / (cmplx128_t) ((int64_t)__li_M) : 0);
20612
20770
  }
@@ -20686,6 +20844,7 @@ mean_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
20686
20844
  (void) v;
20687
20845
  }
20688
20846
  }
20847
+
20689
20848
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
20690
20849
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (cmplx128_t) (((int64_t)__li_M) ? __li_buf_acc[__j] / (cmplx128_t) ((int64_t)__li_M) : 0);
20691
20850
  }
@@ -20811,6 +20970,7 @@ mean_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
20811
20970
  (void) v;
20812
20971
  }
20813
20972
  }
20973
+
20814
20974
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
20815
20975
  __li_op_k[__li_tile + __j] = (cmplx128_t) (((int64_t)__li_M) ? __li_buf_acc[__j] / (cmplx128_t) ((int64_t)__li_M) : 0);
20816
20976
  }
@@ -20841,8 +21001,8 @@ mean_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
20841
21001
  write stride 1 (= contig output tail) both preserved -> SIMD
20842
21002
  tile reduce + write maintained.
20843
21003
 
20844
- Performance characteristic (deliver-via-view, per the CLAUDE.md
20845
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
21004
+ Performance characteristic (deliver-via-view -- the surface
21005
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
20846
21006
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
20847
21007
  = 2.38x slow. Root cause is the multi-parent data layout
20848
21008
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -20971,6 +21131,7 @@ mean_ki_native_cmplx128 (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes
20971
21131
  (void) v;
20972
21132
  }
20973
21133
  }
21134
+
20974
21135
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
20975
21136
  __li_op_k[__li_tile + __j] = (cmplx128_t) (((int64_t)__li_M) ? __li_buf_acc[__j] / (cmplx128_t) ((int64_t)__li_M) : 0);
20976
21137
  }
@@ -21129,6 +21290,7 @@ mean_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
21129
21290
  (void) v;
21130
21291
  }
21131
21292
  }
21293
+
21132
21294
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
21133
21295
  op[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
21134
21296
  }
@@ -21208,6 +21370,7 @@ mean_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
21208
21370
  (void) v;
21209
21371
  }
21210
21372
  }
21373
+
21211
21374
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
21212
21375
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
21213
21376
  }
@@ -21333,6 +21496,7 @@ mean_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
21333
21496
  (void) v;
21334
21497
  }
21335
21498
  }
21499
+
21336
21500
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
21337
21501
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
21338
21502
  }
@@ -21363,8 +21527,8 @@ mean_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
21363
21527
  write stride 1 (= contig output tail) both preserved -> SIMD
21364
21528
  tile reduce + write maintained.
21365
21529
 
21366
- Performance characteristic (deliver-via-view, per the CLAUDE.md
21367
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
21530
+ Performance characteristic (deliver-via-view -- the surface
21531
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
21368
21532
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
21369
21533
  = 2.38x slow. Root cause is the multi-parent data layout
21370
21534
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -21493,6 +21657,7 @@ mean_ki_native_bool (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes, in
21493
21657
  (void) v;
21494
21658
  }
21495
21659
  }
21660
+
21496
21661
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
21497
21662
  __li_op_k[__li_tile + __j] = (double) (((int64_t)__li_M) ? __li_buf_acc[__j] / (double) ((int64_t)__li_M) : 0);
21498
21663
  }
@@ -21582,7 +21747,7 @@ mean_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
21582
21747
  ca_size_t masked_cnt = 0; /* unused on streaming (no mask) */
21583
21748
  (void) masked_cnt;
21584
21749
  ca_lazy_arena_enter();
21585
- VALUE *__chunk = (VALUE *) ca_lazy_arena_acquire(__chunk_elems * sizeof(VALUE));
21750
+ VALUE *__chunk = (VALUE *) ca_lazy_arena_acquire_object(__chunk_elems);
21586
21751
  while ( __outer_off < __outer ) {
21587
21752
  ca_size_t __r = (__outer - __outer_off < __rows) ? (__outer - __outer_off) : __rows;
21588
21753
  ca_size_t __n = __r * __inner;
@@ -21651,6 +21816,7 @@ mean_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
21651
21816
  (void) v;
21652
21817
  }
21653
21818
  }
21819
+
21654
21820
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
21655
21821
  op[__li_o * __li_INNER + __li_tile + __j] = (VALUE) (((int64_t)__li_M) ? rb_funcall(__li_buf_acc[__j], rb_intern("/"), 1, LONG2NUM(((int64_t)__li_M))) : Qnil);
21656
21822
  }
@@ -21730,6 +21896,7 @@ mean_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
21730
21896
  (void) v;
21731
21897
  }
21732
21898
  }
21899
+
21733
21900
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
21734
21901
  __li_op_k[__li_o * __li_INNER + __li_tile + __j] = (VALUE) (((int64_t)__li_M) ? rb_funcall(__li_buf_acc[__j], rb_intern("/"), 1, LONG2NUM(((int64_t)__li_M))) : Qnil);
21735
21902
  }
@@ -21855,6 +22022,7 @@ mean_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
21855
22022
  (void) v;
21856
22023
  }
21857
22024
  }
22025
+
21858
22026
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
21859
22027
  __li_op_k[__li_tile + __j] = (VALUE) (((int64_t)__li_M) ? rb_funcall(__li_buf_acc[__j], rb_intern("/"), 1, LONG2NUM(((int64_t)__li_M))) : Qnil);
21860
22028
  }
@@ -21885,8 +22053,8 @@ mean_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
21885
22053
  write stride 1 (= contig output tail) both preserved -> SIMD
21886
22054
  tile reduce + write maintained.
21887
22055
 
21888
- Performance characteristic (deliver-via-view, per the CLAUDE.md
21889
- "deliver the materials" principle): bench (b2 pattern, M=200, K=5, eff_INNER
22056
+ Performance characteristic (deliver-via-view -- the surface
22057
+ prioritises delivering the cells over avoiding a copy): bench (b2 pattern, M=200, K=5, eff_INNER
21890
22058
  =360, INNER_pre_K=16) yields 3674 us vs eager-entity 1545 us
21891
22059
  = 2.38x slow. Root cause is the multi-parent data layout
21892
22060
  (= 5 separate 9 MB regions instead of one contig 46 MB),
@@ -22015,6 +22183,7 @@ mean_ki_native_object (VALUE self, CArray *ca, int8_t *slab_axes, int8_t naxes,
22015
22183
  (void) v;
22016
22184
  }
22017
22185
  }
22186
+
22018
22187
  for ( ca_size_t __j = 0; __j < __li_tile_len; __j++ ) {
22019
22188
  __li_op_k[__li_tile + __j] = (VALUE) (((int64_t)__li_M) ? rb_funcall(__li_buf_acc[__j], rb_intern("/"), 1, LONG2NUM(((int64_t)__li_M))) : Qnil);
22020
22189
  }