@genai-fi/nanogpt 0.10.2 → 0.10.3

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 (249) hide show
  1. package/dist/Generator.js +11761 -171
  2. package/dist/{RealDiv-zz7FpkKX.js → RealDiv-KAPDe8zB.js} +23 -25
  3. package/dist/Reshape-BYkmUnAv.js +14 -0
  4. package/dist/{Reshape-CHdUjC72.js → Reshape-Zt6eb7yh.js} +18 -20
  5. package/dist/TeachableLLM.js +10 -11
  6. package/dist/{axis_util-BsIr9ZNu.js → axis_util-BaG7mf5A.js} +3 -3
  7. package/dist/backend.js +2 -2
  8. package/dist/{backend_util-B1XRLuq9.js → backend_util-RCe-rHaj.js} +72 -73
  9. package/dist/{backend_webgpu-CqpfEImu.js → backend_webgpu-DE3ACOLx.js} +45 -47
  10. package/dist/broadcast_to-B3eYlZm7.js +28 -0
  11. package/dist/checks/appendCache.js +2 -2
  12. package/dist/checks/attentionMask.js +3 -3
  13. package/dist/checks/gelu.js +2 -2
  14. package/dist/checks/matMulGelu.js +7 -11
  15. package/dist/checks/normRMS.js +9 -9
  16. package/dist/checks/normRMSGrad.js +3 -3
  17. package/dist/checks/packUnpack.js +2 -2
  18. package/dist/checks/qkv.js +12 -13
  19. package/dist/checks/rope.js +2 -2
  20. package/dist/clip_by_value-BnO7-a88.js +12 -0
  21. package/dist/complex-DjxcVmoX.js +11 -0
  22. package/dist/concat-BV8bt5H-.js +17 -0
  23. package/dist/{concat_util-iBYIyuQe.js → concat_util-DpW8mL_l.js} +1 -1
  24. package/dist/{dataset-D2P7rHAw.js → dataset-BcwmTGYc.js} +137 -139
  25. package/dist/dropout-BcvN9JYi.js +92 -0
  26. package/dist/expand_dims-DT4tEPwA.js +11 -0
  27. package/dist/{exports_initializers-CZSUJoVE.js → exports_initializers-Hta_rEnm.js} +1 -1
  28. package/dist/floor-D5QdR_le.js +9 -0
  29. package/dist/gather-D3JcZUaI.js +9 -0
  30. package/dist/{gelu-Bmhopi0J.js → gelu-CjNPL4OH.js} +10 -11
  31. package/dist/{gpgpu_math-DsCcikas.js → gpgpu_math-DAOmgtXR.js} +841 -1015
  32. package/dist/{index-DRyE072i.js → index-BwexR4lA.js} +262 -263
  33. package/dist/index-DOvlwCh-.js +3520 -0
  34. package/dist/{kernel_funcs_utils-CWfOAPGO.js → kernel_funcs_utils-CCzYdUZg.js} +130 -132
  35. package/dist/layers/BaseLayer.js +15 -16
  36. package/dist/layers/CausalSelfAttention.js +6 -6
  37. package/dist/layers/MLP.js +4 -4
  38. package/dist/layers/PositionEmbedding.js +7 -7
  39. package/dist/layers/RMSNorm.js +3 -3
  40. package/dist/layers/RoPECache.js +9 -9
  41. package/dist/layers/TiedEmbedding.js +6 -6
  42. package/dist/layers/TransformerBlock.js +1 -1
  43. package/dist/loader/loadTransformers.js +1 -1
  44. package/dist/loader/oldZipLoad.js +13 -14
  45. package/dist/log_sum_exp-ngO0-4pK.js +39 -0
  46. package/dist/main.js +49 -50
  47. package/dist/{matMul16-fEAJ4smh.js → matMul16-BWRSOCWB.js} +14 -15
  48. package/dist/matMulGelu-CzfgT6Wq.js +163 -0
  49. package/dist/mat_mul-SjpJRLyL.js +11 -0
  50. package/dist/mod-AnXEvvpo.js +11 -0
  51. package/dist/models/NanoGPTV1.js +2 -2
  52. package/dist/models/model.js +13 -14
  53. package/dist/ones-D2rT0xk2.js +14 -0
  54. package/dist/ops/adamAdjust.js +1 -1
  55. package/dist/ops/adamMoments.js +1 -1
  56. package/dist/ops/add16.js +1 -1
  57. package/dist/ops/appendCache.js +3 -3
  58. package/dist/ops/attentionMask.js +1 -1
  59. package/dist/ops/concat16.js +2 -2
  60. package/dist/ops/cpu/adamAdjust.js +13 -14
  61. package/dist/ops/cpu/adamMoments.js +6 -7
  62. package/dist/ops/cpu/appendCache.js +7 -8
  63. package/dist/ops/cpu/attentionMask.js +7 -7
  64. package/dist/ops/cpu/fusedSoftmax.js +10 -11
  65. package/dist/ops/cpu/gatherSub.js +9 -10
  66. package/dist/ops/cpu/gelu.js +9 -10
  67. package/dist/ops/cpu/matMul16.js +6 -7
  68. package/dist/ops/cpu/matMulGelu.js +5 -6
  69. package/dist/ops/cpu/matMulMul.js +3 -4
  70. package/dist/ops/cpu/mulDropout.js +3 -4
  71. package/dist/ops/cpu/normRMS.js +10 -11
  72. package/dist/ops/cpu/qkv.js +8 -9
  73. package/dist/ops/cpu/rope.js +5 -6
  74. package/dist/ops/cpu/scatterSub.js +17 -19
  75. package/dist/ops/dot16.js +2 -2
  76. package/dist/ops/gatherSub.js +1 -1
  77. package/dist/ops/gelu.js +2 -2
  78. package/dist/ops/grads/add16.js +11 -12
  79. package/dist/ops/grads/attentionMask.js +5 -6
  80. package/dist/ops/grads/gelu.js +3 -4
  81. package/dist/ops/grads/matMul16.js +4 -5
  82. package/dist/ops/grads/matMulGelu.js +9 -10
  83. package/dist/ops/grads/normRMS.js +7 -8
  84. package/dist/ops/grads/pack16.js +4 -5
  85. package/dist/ops/grads/qkv.js +17 -19
  86. package/dist/ops/grads/rope.js +3 -5
  87. package/dist/ops/grads/softmax16.js +3 -4
  88. package/dist/ops/grads/unpack16.js +3 -4
  89. package/dist/ops/grads/utils.d.ts +1 -0
  90. package/dist/ops/grads/utils.js +8 -4
  91. package/dist/ops/matMul16.js +3 -3
  92. package/dist/ops/matMulGelu.js +2 -2
  93. package/dist/ops/matMulMul.js +1 -1
  94. package/dist/ops/mul16.js +1 -1
  95. package/dist/ops/mulDrop.js +1 -1
  96. package/dist/ops/normRMS.js +1 -1
  97. package/dist/ops/pack16.js +3 -4
  98. package/dist/ops/qkv.js +4 -8
  99. package/dist/ops/reshape16.js +14 -16
  100. package/dist/ops/rope.d.ts +1 -1
  101. package/dist/ops/rope.js +3 -8
  102. package/dist/ops/scatterSub.js +1 -1
  103. package/dist/ops/slice16.js +2 -2
  104. package/dist/ops/softmax16.js +5 -8
  105. package/dist/ops/sub16.js +1 -1
  106. package/dist/ops/sum16.js +2 -2
  107. package/dist/ops/transpose16.js +23 -24
  108. package/dist/ops/unpack16.js +2 -2
  109. package/dist/ops/webgl/adamAdjust.js +2 -3
  110. package/dist/ops/webgl/adamMoments.js +1 -2
  111. package/dist/ops/webgl/appendCache.js +1 -2
  112. package/dist/ops/webgl/attentionMask.js +4 -5
  113. package/dist/ops/webgl/fusedSoftmax.js +4 -6
  114. package/dist/ops/webgl/gatherSub.js +6 -7
  115. package/dist/ops/webgl/gelu.js +2 -3
  116. package/dist/ops/webgl/log.js +11 -12
  117. package/dist/ops/webgl/matMul16.js +10 -11
  118. package/dist/ops/webgl/matMulGelu.js +7 -111
  119. package/dist/ops/webgl/matMulMul.js +9 -10
  120. package/dist/ops/webgl/mulDropout.js +8 -9
  121. package/dist/ops/webgl/normRMS.js +2 -3
  122. package/dist/ops/webgl/qkv.js +5 -6
  123. package/dist/ops/webgl/rope.js +7 -8
  124. package/dist/ops/webgl/scatterSub.js +5 -6
  125. package/dist/ops/webgpu/adamAdjust.js +10 -12
  126. package/dist/ops/webgpu/adamMoments.js +8 -10
  127. package/dist/ops/webgpu/add16.js +8 -9
  128. package/dist/ops/webgpu/appendCache.js +23 -25
  129. package/dist/ops/webgpu/attentionMask.js +8 -10
  130. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  131. package/dist/ops/webgpu/concat16.js +12 -14
  132. package/dist/ops/webgpu/gatherSub.js +11 -13
  133. package/dist/ops/webgpu/gelu.js +28 -29
  134. package/dist/ops/webgpu/matMul16.js +26 -28
  135. package/dist/ops/webgpu/matMul16_program.js +4 -5
  136. package/dist/ops/webgpu/mul16.js +9 -10
  137. package/dist/ops/webgpu/normRMS.js +15 -17
  138. package/dist/ops/webgpu/normRMSGrad.js +21 -28
  139. package/dist/ops/webgpu/pack16.js +12 -13
  140. package/dist/ops/webgpu/pack16_program.js +2 -2
  141. package/dist/ops/webgpu/qkv.js +16 -18
  142. package/dist/ops/webgpu/rope.js +25 -27
  143. package/dist/ops/webgpu/scatterSub.js +7 -9
  144. package/dist/ops/webgpu/slice16.js +21 -23
  145. package/dist/ops/webgpu/softmax16.js +17 -19
  146. package/dist/ops/webgpu/softmax16_program.js +2 -2
  147. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  148. package/dist/ops/webgpu/softmax16grad.js +7 -8
  149. package/dist/ops/webgpu/sub16.js +7 -8
  150. package/dist/ops/webgpu/sum16.js +18 -20
  151. package/dist/ops/webgpu/transpose16.js +19 -20
  152. package/dist/ops/webgpu/transpose16_program.js +2 -2
  153. package/dist/ops/webgpu/transpose16_shared_program.js +11 -12
  154. package/dist/ops/webgpu/unpack16.js +3 -4
  155. package/dist/ops/webgpu/utils/binary_op.js +7 -8
  156. package/dist/ops/webgpu/utils/reductions.js +14 -22
  157. package/dist/ops-B5yanEdW.js +476 -0
  158. package/dist/pack16-nQ6JaLo-.js +39 -0
  159. package/dist/patches/webgpu_backend.js +19 -20
  160. package/dist/patches/webgpu_base.js +1 -1
  161. package/dist/patches/webgpu_program.js +21 -22
  162. package/dist/{random_width-BVV9HveY.js → random_width-or-CEftb.js} +2506 -2761
  163. package/dist/range-BklejeeW.js +10 -0
  164. package/dist/relu-CP0ZcxWO.js +9 -0
  165. package/dist/reshape-ByE68wS9.js +9 -0
  166. package/dist/resize_nearest_neighbor-B19mCEg2.js +175 -0
  167. package/dist/rope-Ir4mTyD1.js +24 -0
  168. package/dist/{scatter_nd_util-C7zXRT_h.js → scatter_nd_util-lvSiX8q4.js} +1 -1
  169. package/dist/selu_util-kbhpTdYD.js +44 -0
  170. package/dist/{shared-CHhxz-O5.js → shared-DT1TkE6w.js} +1 -1
  171. package/dist/{shared-D2NP_CpY.js → shared-dntlHIDQ.js} +343 -345
  172. package/dist/slice-BfEGSH82.js +12 -0
  173. package/dist/{slice_util-DyjSAD0u.js → slice_util-uTKwiEpW.js} +1 -1
  174. package/dist/{softmax-C9JQEtnO.js → softmax-CA5jFsLR.js} +4 -5
  175. package/dist/split-CVLc0w--.js +9 -0
  176. package/dist/squeeze-C7Z2srUo.js +10 -0
  177. package/dist/stack-Cf4n9h0N.js +11 -0
  178. package/dist/step-CINUs5QB.js +261 -0
  179. package/dist/sum-DWAtNGez.js +11 -0
  180. package/dist/tensor-DJoc7gJU.js +8 -0
  181. package/dist/tensor1d-D11P_7Dp.js +11 -0
  182. package/dist/{tensor2d-CSB4KOb0.js → tensor2d-Bs9wZRc7.js} +6 -7
  183. package/dist/{tensor4d-D7bLqGqz.js → tensor4d-BARPdTaS.js} +6 -7
  184. package/dist/{tfjs_backend-CNkSTL0c.js → tfjs_backend-y1cvNhLA.js} +255 -264
  185. package/dist/tile-mbfagpsB.js +11 -0
  186. package/dist/training/Adam.js +2 -2
  187. package/dist/training/AdamExt.js +1 -1
  188. package/dist/training/DatasetBuilder.js +2 -2
  189. package/dist/training/FullTrainer.js +1 -1
  190. package/dist/training/Trainer.js +2 -2
  191. package/dist/training/sparseCrossEntropy.js +5 -5
  192. package/dist/transpose-ClWiBS_b.js +36 -0
  193. package/dist/unsorted_segment_sum-BDDhB_E6.js +277 -0
  194. package/dist/utilities/dummy.js +3 -3
  195. package/dist/utilities/multinomialCPU.js +2 -2
  196. package/dist/utilities/packed.d.ts +1 -4
  197. package/dist/utilities/packed.js +10 -745
  198. package/dist/utilities/performance.js +1 -1
  199. package/dist/utilities/profile.js +1 -1
  200. package/dist/utilities/safetensors.js +2 -2
  201. package/dist/utilities/sentences.js +5 -5
  202. package/dist/utilities/weights.js +2 -2
  203. package/dist/{variable-DzfrwYuP.js → variable-WawDEaAb.js} +1 -1
  204. package/dist/{webgpu_program-DzaQiqel.js → webgpu_program-DuOXPQol.js} +178 -172
  205. package/dist/{webgpu_util-0_ubCEHJ.js → webgpu_util-RxEF33Rj.js} +34 -35
  206. package/dist/zeros-KnWaWf-X.js +13 -0
  207. package/dist/zeros_like-DvE73F4e.js +721 -0
  208. package/package.json +4 -2
  209. package/dist/Reshape-CDVLyVfz.js +0 -16
  210. package/dist/broadcast_to-B0ChcDaz.js +0 -30
  211. package/dist/complex-BBiRlsVq.js +0 -13
  212. package/dist/concat-DmBLPVGC.js +0 -19
  213. package/dist/dropout-B1x1kYMa.js +0 -99
  214. package/dist/expand_dims-ouvfxQ1n.js +0 -13
  215. package/dist/gather-CH9sdacz.js +0 -10
  216. package/dist/index-D6Q1lPZO.js +0 -2157
  217. package/dist/log_sum_exp-D3ftBNY5.js +0 -41
  218. package/dist/mat_mul-C59XWcJd.js +0 -12
  219. package/dist/mod-DESSvHIU.js +0 -12
  220. package/dist/mulmat_packed_gpu-Coh6qbJk.js +0 -55
  221. package/dist/ones-jU9jlQvM.js +0 -15
  222. package/dist/ops-BFDtP6th.js +0 -645
  223. package/dist/pack16-CmVZs6af.js +0 -41
  224. package/dist/patches/PackedTensor.d.ts +0 -12
  225. package/dist/patches/PackedTensor.js +0 -11
  226. package/dist/patches/engine.d.ts +0 -261
  227. package/dist/patches/engine.js +0 -12
  228. package/dist/patches/tape.d.ts +0 -12
  229. package/dist/patches/tape.js +0 -5
  230. package/dist/range-ZZZD60Fx.js +0 -11
  231. package/dist/reciprocal-CrYlsAGD.js +0 -10
  232. package/dist/register_all_kernels-nvj2k7OC.js +0 -12307
  233. package/dist/relu-BYDneVPn.js +0 -10
  234. package/dist/reshape-CaPQzFvz.js +0 -10
  235. package/dist/rope-s4W2XO9B.js +0 -32
  236. package/dist/selu_util-BGPXmd4B.js +0 -303
  237. package/dist/sin-Djs4aQiu.js +0 -16
  238. package/dist/slice-DvovR5wq.js +0 -13
  239. package/dist/split-DBck65sX.js +0 -10
  240. package/dist/squeeze-C00Ipm_7.js +0 -11
  241. package/dist/stack-ChnHwRpX.js +0 -13
  242. package/dist/sum-ywRJj3Zr.js +0 -12
  243. package/dist/tensor-0r5yOo2R.js +0 -8
  244. package/dist/tensor-CzmOBsdf.js +0 -909
  245. package/dist/tensor1d-BlUT89BP.js +0 -12
  246. package/dist/tensor_util-DfwaWayG.js +0 -523
  247. package/dist/tile-CR074jmp.js +0 -13
  248. package/dist/transpose-DH4gmHvu.js +0 -38
  249. package/dist/zeros-DBFVbpv5.js +0 -14
@@ -1,50 +1,49 @@
1
- import { h as k } from "./index-D6Q1lPZO.js";
2
- import { b as z, e as E, i as j, a as A } from "./tensor-CzmOBsdf.js";
3
- function L(e, s) {
4
- if (Math.max(...e) > 5)
1
+ import { o as z, n as F, j, ad as E, l as A } from "./index-DOvlwCh-.js";
2
+ function L(t, s) {
3
+ if (Math.max(...t) > 5)
5
4
  throw new Error("Cannot symbolically compute strides for rank > 6 tensor.");
6
- const t = e.length, o = "xyzwuv", i = e.map((n) => `${s}.${o[n]}`), u = new Array(t - 1);
7
- u[t - 2] = i[t - 1];
8
- for (let n = t - 3; n >= 0; --n)
5
+ const e = t.length, o = "xyzwuv", i = t.map((n) => `${s}.${o[n]}`), u = new Array(e - 1);
6
+ u[e - 2] = i[e - 1];
7
+ for (let n = e - 3; n >= 0; --n)
9
8
  u[n] = `(${u[n + 1]} * ${i[n + 1]})`;
10
9
  return u;
11
10
  }
12
- const H = (e, s, t) => t === "int32" ? `atomicAdd(${e}, bitcast<i32>(${s}));` : `
11
+ const X = (t, s, e) => e === "int32" ? `atomicAdd(${t}, bitcast<i32>(${s}));` : `
13
12
  {
14
13
  var oldValue = 0;
15
14
  loop {
16
15
  let newValueF32 = bitcast<f32>(oldValue) + (${s});
17
16
  let newValue = bitcast<i32>(newValueF32);
18
- let res = atomicCompareExchangeWeak(${e}, oldValue, newValue);
17
+ let res = atomicCompareExchangeWeak(${t}, oldValue, newValue);
19
18
  if res.exchanged {
20
19
  break;
21
20
  }
22
21
  oldValue = res.old_value;
23
22
  }
24
23
  }`;
25
- var b;
26
- (function(e) {
27
- e[e.FROM_PIXELS = 0] = "FROM_PIXELS", e[e.DRAW = 1] = "DRAW";
28
- })(b || (b = {}));
29
- const Y = (e, s, t, o, i) => {
30
- const u = { dtype: o.dtype, shape: o.shape }, n = D(t, u, s), r = e.createShaderModule({ code: n, label: s.constructor.name });
31
- let d = E().get("WEBGPU_PRINT_SHADER");
24
+ var w;
25
+ (function(t) {
26
+ t[t.FROM_PIXELS = 0] = "FROM_PIXELS", t[t.DRAW = 1] = "DRAW";
27
+ })(w || (w = {}));
28
+ const H = (t, s, e, o, i) => {
29
+ const u = { dtype: o.dtype, shape: o.shape }, n = D(e, u, s), r = t.createShaderModule({ code: n, label: s.constructor.name });
30
+ let d = j().get("WEBGPU_PRINT_SHADER");
32
31
  if (d !== "") {
33
32
  d = d.toLowerCase();
34
33
  const p = d.split(",");
35
34
  (d === "all" || p.some((a) => s.shaderKey.toLowerCase().includes(a))) && (console.group(s.shaderKey), console.debug(n), console.groupEnd());
36
35
  }
37
- return i ? e.createComputePipelineAsync({
36
+ return i ? t.createComputePipelineAsync({
38
37
  compute: { module: r, entryPoint: "_start" },
39
38
  label: s.constructor.name,
40
39
  layout: "auto"
41
- }) : e.createComputePipeline({
40
+ }) : t.createComputePipeline({
42
41
  compute: { module: r, entryPoint: "_start" },
43
42
  label: s.constructor.name,
44
43
  layout: "auto"
45
44
  });
46
- }, f = (e, s = "f32") => {
47
- switch (e) {
45
+ }, h = (t, s = "f32") => {
46
+ switch (t) {
48
47
  case 1:
49
48
  return `${s}`;
50
49
  case 2:
@@ -54,42 +53,42 @@ const Y = (e, s, t, o, i) => {
54
53
  case 4:
55
54
  return `vec4<${s}>`;
56
55
  default:
57
- throw new Error(`${e}-component ${s} is not supported.`);
56
+ throw new Error(`${t}-component ${s} is not supported.`);
58
57
  }
59
58
  };
60
- function v(e) {
61
- if (e <= 1)
59
+ function g(t) {
60
+ if (t <= 1)
62
61
  return "i32";
63
- if (e === 2)
62
+ if (t === 2)
64
63
  return "vec2<i32>";
65
- if (e === 3)
64
+ if (t === 3)
66
65
  return "vec3<i32>";
67
- if (e === 4)
66
+ if (t === 4)
68
67
  return "vec4<i32>";
69
- if (e === 5)
68
+ if (t === 5)
70
69
  return "vec5";
71
- if (e === 6)
70
+ if (t === 6)
72
71
  return "vec6";
73
- throw Error(`GPU for rank ${e} is not yet supported`);
72
+ throw Error(`GPU for rank ${t} is not yet supported`);
74
73
  }
75
- function I(e) {
76
- if (e === 0)
74
+ function I(t) {
75
+ if (t === 0)
77
76
  return "x";
78
- if (e === 1)
77
+ if (t === 1)
79
78
  return "y";
80
- if (e === 2)
79
+ if (t === 2)
81
80
  return "z";
82
- if (e === 3)
81
+ if (t === 3)
83
82
  return "w";
84
- if (e === 4)
83
+ if (t === 4)
85
84
  return "u";
86
- if (e === 5)
85
+ if (t === 5)
87
86
  return "v";
88
- throw Error(`Index ${e} is not yet supported`);
87
+ throw Error(`Index ${t} is not yet supported`);
89
88
  }
90
- function q(...e) {
89
+ function Y(...t) {
91
90
  let s;
92
- switch (e.length) {
91
+ switch (t.length) {
93
92
  case 0:
94
93
  s = `
95
94
  fn main()
@@ -97,7 +96,7 @@ function q(...e) {
97
96
  break;
98
97
  case 1:
99
98
  s = `
100
- fn main(${e[0]} : i32)
99
+ fn main(${t[0]} : i32)
101
100
  `;
102
101
  break;
103
102
  default:
@@ -105,118 +104,125 @@ function q(...e) {
105
104
  }
106
105
  return s;
107
106
  }
108
- function w(e, s) {
109
- let t;
110
- return t = `
107
+ function C(t, s) {
108
+ let e;
109
+ return e = `
111
110
  ${N(s)}
112
111
  fn _start(@builtin(local_invocation_id) LocalId : vec3<u32>,
113
112
  @builtin(global_invocation_id) GlobalId : vec3<u32>,
114
113
  @builtin(local_invocation_index) LocalIndex: u32,
115
114
  @builtin(workgroup_id) WorkgroupId : vec3<u32>,
115
+ ${s.subgroupBuiltins ? "@builtin(subgroup_invocation_id) SubgroupInvocationId : u32," : ""}
116
+ ${s.subgroupBuiltins ? "@builtin(subgroup_size) SubgroupSize : u32," : ""}
116
117
  @builtin(num_workgroups) NumWorkgroups : vec3<u32>) {
117
118
  localId = LocalId;
118
119
  localIndex = LocalIndex;
119
120
  globalId = GlobalId;
120
121
  numWorkgroups = NumWorkgroups;
121
122
  workgroupId = WorkgroupId;
122
- ${e ? "main(getGlobalIndex());" : "main();"};
123
+ ${s.subgroupBuiltins ? "subgroupInvocationId = SubgroupInvocationId" : ""};
124
+ ${s.subgroupBuiltins ? "subgroupSize = SubgroupSize" : ""};
125
+ ${t ? "main(getGlobalIndex());" : "main();"};
123
126
  }
124
- `, t;
127
+ `, e;
125
128
  }
126
- function N(e) {
129
+ function N(t) {
127
130
  return `
128
- @compute @workgroup_size(${e.workgroupSize[0]}, ${e.workgroupSize[1]}, ${e.workgroupSize[2]})
131
+ @compute @workgroup_size(${t.workgroupSize[0]}, ${t.workgroupSize[1]}, ${t.workgroupSize[2]})
129
132
  `;
130
133
  }
131
- function D(e, s, t) {
132
- const o = [], i = t.workgroupSize[0] * t.workgroupSize[1] * t.workgroupSize[2];
133
- if (t.outputComponent = t.outputComponent ? t.outputComponent : 1, o.push(`
134
+ function D(t, s, e) {
135
+ const o = [], i = e.workgroupSize[0] * e.workgroupSize[1] * e.workgroupSize[2];
136
+ if (e.outputComponent = e.outputComponent ? e.outputComponent : 1, o.push(`
134
137
 
135
138
  var<private> localId: vec3<u32>;
136
139
  var<private> localIndex: u32;
137
140
  var<private> globalId: vec3<u32>;
138
141
  var<private> numWorkgroups: vec3<u32>;
139
142
  var<private> workgroupId: vec3<u32>;
143
+ ${e.subgroupBuiltins ? "var<private> subgroupInvocationId: u32;" : ""}
144
+ ${e.subgroupBuiltins ? "var<private> subgroupSize: u32;" : ""}
140
145
 
141
146
  // Only used when the y/z dimension of workgroup size is 1.
142
147
  fn getGlobalIndex() -> i32 {
143
- ${F(t) ? " return i32(globalId.x);" : ` return i32((workgroupId.z * numWorkgroups.x * numWorkgroups.y +
148
+ ${_(e) ? " return i32(globalId.x);" : ` return i32((workgroupId.z * numWorkgroups.x * numWorkgroups.y +
144
149
  workgroupId.y * numWorkgroups.x + workgroupId.x) * ${i}u +
145
150
  localIndex);
146
151
  `}
147
152
  }
148
- `), t.pixelsOpType != null) {
149
- const h = t.pixelsOpType === b.FROM_PIXELS ? `@group(0) @binding(0) var<storage, read_write> result: array<${x(s.dtype, t.outputComponent)}>;` : `@group(0) @binding(1) var<storage, read> inBuf : array<${x(e[0].dtype, t.outputComponent)}>;`, c = s.shape.length === 3 ? "vec2<i32>" : "i32";
153
+ `), e.pixelsOpType != null) {
154
+ const c = e.pixelsOpType === w.FROM_PIXELS ? `@group(0) @binding(0) var<storage, read_write> result: array<${b(s.dtype, e.outputComponent)}>;` : `@group(0) @binding(1) var<storage, read> inBuf : array<${b(t[0].dtype, e.outputComponent)}>;`, $ = s.shape.length === 3 ? "vec2<i32>" : "i32";
150
155
  o.push(`
151
156
  struct Uniform {
152
- outShapeStrides : ${c},
157
+ outShapeStrides : ${$},
153
158
  size : i32,
154
159
  numChannels : i32,
155
160
  alpha : f32,
156
161
  };
157
162
 
158
- ${h}
163
+ ${c}
159
164
  @group(0) @binding(2) var<uniform> uniforms: Uniform;
160
165
  `);
161
- const S = m(t);
166
+ const x = k(e);
162
167
  return [
163
- C,
168
+ m,
164
169
  o.join(`
165
170
  `),
166
171
  y(s.shape),
167
- t.getUserCode(),
168
- w(S, t)
172
+ e.getUserCode(),
173
+ C(x, e)
169
174
  ].join(`
170
175
  `);
171
176
  }
172
177
  let u, n, r = "struct Uniforms { NAN : f32, INFINITY : f32, ";
173
- t.variableNames.forEach((h, c) => {
174
- const S = v(e[c].shape.length);
175
- r += `${h.charAt(0).toLowerCase() + h.slice(1)}Shape : ${S}, `, u = e[c].shape.length - 1, n = v(u), r += `${h.charAt(0).toLowerCase() + h.slice(1)}ShapeStrides: ${n}, `;
178
+ e.variableNames.forEach((c, $) => {
179
+ const x = g(t[$].shape.length);
180
+ r += `${c.charAt(0).toLowerCase() + c.slice(1)}Shape : ${x}, `, u = t[$].shape.length - 1, n = g(u), r += `${c.charAt(0).toLowerCase() + c.slice(1)}ShapeStrides: ${n}, `;
176
181
  });
177
- const d = v(s.shape.length);
178
- r += `outShape : ${d}, `, u = s.shape.length - 1, n = v(u), r += `
179
- outShapeStrides: ${n}, `, t.size && (r += "size : i32, "), t.uniforms && (r += t.uniforms), r += "};", r = B(r), o.push(r), t.atomic ? o.push(`
182
+ const d = g(s.shape.length);
183
+ r += `outShape : ${d}, `, u = s.shape.length - 1, n = g(u), r += `
184
+ outShapeStrides: ${n}, `, e.size && (r += "size : i32, "), e.uniforms && (r += e.uniforms), r += "};", r = V(r), o.push(r), e.atomic ? o.push(`
180
185
  @group(0) @binding(0) var<storage, read_write> result: array<atomic<i32>>;
181
186
  `) : o.push(`
182
- @group(0) @binding(0) var<storage, read_write> result: array<${x(s.dtype, t.outputComponent)}>;
183
- `), t.variableNames.forEach((h, c) => {
187
+ @group(0) @binding(0) var<storage, read_write> result: array<${b(s.dtype, e.outputComponent)}>;
188
+ `), e.variableNames.forEach((c, $) => {
184
189
  o.push(`
185
- @group(0) @binding(${1 + c}) var<storage, read> ${h}: array<${t.variableComponents ? x(e[c].dtype, t.variableComponents[c]) : x(e[c].dtype, t.outputComponent)}>;
190
+ @group(0) @binding(${1 + $}) var<storage, read> ${c}: array<${e.variableComponents ? b(t[$].dtype, e.variableComponents[$]) : b(t[$].dtype, e.outputComponent)}>;
186
191
  `);
187
192
  }), r !== "" && o.push(`
188
- @group(0) @binding(${1 + t.variableNames.length}) var<uniform> uniforms: Uniforms;
193
+ @group(0) @binding(${1 + e.variableNames.length}) var<uniform> uniforms: Uniforms;
189
194
  `);
190
- const p = R(s.shape, t.dispatchLayout), a = [
191
- C,
195
+ const p = P(s.shape, e.dispatchLayout), v = [
196
+ e.subgroups ? "enable subgroups;" : "",
197
+ m,
192
198
  o.join(`
193
199
  `) + T,
194
200
  y(s.shape),
195
201
  p,
196
- G(s.shape.length)
202
+ R(s.shape.length)
197
203
  ];
198
- t.atomic || a.push(V(s.shape, s.dtype, t.outputComponent)), t.variableNames.forEach((h, c) => {
199
- a.push(`${y(e[c].shape, h)}`);
204
+ e.atomic || v.push(G(s.shape, s.dtype, e.outputComponent)), e.variableNames.forEach((c, $) => {
205
+ v.push(`${y(t[$].shape, c)}`);
200
206
  });
201
- const g = e.map((h, c) => P(h, s.shape, t.variableComponents ? t.variableComponents[c] : t.outputComponent, t.dispatchLayout.x.length === s.shape.length)).join(`
207
+ const l = t.map((c, $) => B(c, s.shape, e.variableComponents ? e.variableComponents[$] : e.outputComponent, e.dispatchLayout.x.length === s.shape.length)).join(`
202
208
  `);
203
- a.push(g), a.push(t.getUserCode());
204
- const l = m(t);
205
- return a.push(w(l, t)), a.join(`
209
+ v.push(l), v.push(e.getUserCode());
210
+ const f = k(e);
211
+ return v.push(C(f, e)), v.join(`
206
212
  `);
207
213
  }
208
- function Z(e, s, t) {
209
- let o = e.shaderKey;
210
- if (e.pixelsOpType != null)
214
+ function q(t, s, e) {
215
+ let o = t.shaderKey;
216
+ if (t.pixelsOpType != null)
211
217
  return o;
212
218
  const i = [], u = [];
213
219
  s.forEach((a) => {
214
220
  i.push(a.shape), u.push(a.dtype);
215
- }), i.push(t.shape), u.push(t.dtype);
216
- const n = s.map((a) => k(a.shape, t.shape)), r = s.map((a) => z(a.shape, t.shape)).join("_"), d = n.map((a) => a.join("_")).join(";"), p = F(e) ? "flatDispatch" : "";
217
- return o += "_" + (e.workgroupSize ? e.workgroupSize.join(",") : "") + i.map((a) => a.length).join(",") + u.join(",") + e.variableNames.join(",") + d + r + p, o;
221
+ }), i.push(e.shape), u.push(e.dtype);
222
+ const n = s.map((a) => z(a.shape, e.shape)), r = s.map((a) => F(a.shape, e.shape)).join("_"), d = n.map((a) => a.join("_")).join(";"), p = _(t) ? "flatDispatch" : "";
223
+ return o += "_" + (t.workgroupSize ? t.workgroupSize.join(",") : "") + i.map((a) => a.length).join(",") + u.join(",") + t.variableNames.join(",") + d + r + p, o;
218
224
  }
219
- const C = `
225
+ const m = `
220
226
  struct vec5 {x: i32, y: i32, z: i32, w: i32, u: i32};
221
227
  struct vec6 {x: i32, y: i32, z: i32, w: i32, u: i32, v: i32};
222
228
 
@@ -271,12 +277,12 @@ const C = `
271
277
  return abs(val) == uniforms.INFINITY;
272
278
  }
273
279
  `;
274
- function y(e, s = "") {
275
- const t = e.length, o = s !== "" ? `get${s.charAt(0).toUpperCase() + s.slice(1)}CoordsFromIndex` : "getCoordsFromIndex", i = s !== "" ? `${s.charAt(0).toLowerCase() + s.slice(1)}ShapeStrides` : "outShapeStrides";
276
- if (t <= 1)
280
+ function y(t, s = "") {
281
+ const e = t.length, o = s !== "" ? `get${s.charAt(0).toUpperCase() + s.slice(1)}CoordsFromIndex` : "getCoordsFromIndex", i = s !== "" ? `${s.charAt(0).toLowerCase() + s.slice(1)}ShapeStrides` : "outShapeStrides";
282
+ if (e <= 1)
277
283
  return `fn ${o}(index : i32) -> i32 { return index; }`;
278
- const u = j(e), n = v(t), r = [];
279
- for (let p = 0; p < t; p++)
284
+ const u = E(t), n = g(e), r = [];
285
+ for (let p = 0; p < e; p++)
280
286
  r.push(`d${p}`);
281
287
  if (u.length === 1)
282
288
  return ` fn ${o}(index : i32) -> vec2<i32> {
@@ -285,8 +291,8 @@ function y(e, s = "") {
285
291
  }`;
286
292
  let d;
287
293
  return d = "var index2 = index;" + u.map((p, a) => {
288
- const g = `let ${r[a]} = index2 / uniforms.${i}.${I(a)}`, l = a === u.length - 1 ? `let ${r[a + 1]} = index2 - ${r[a]} * uniforms.${i}.${I(a)}` : `index2 = index2 - ${r[a]} * uniforms.${i}.${I(a)}`;
289
- return `${g}; ${l};`;
294
+ const v = `let ${r[a]} = index2 / uniforms.${i}.${I(a)}`, l = a === u.length - 1 ? `let ${r[a + 1]} = index2 - ${r[a]} * uniforms.${i}.${I(a)}` : `index2 = index2 - ${r[a]} * uniforms.${i}.${I(a)}`;
295
+ return `${v}; ${l};`;
290
296
  }).join(""), `
291
297
  fn ${o}(index : i32) -> ${n} {
292
298
  ${d}
@@ -294,112 +300,112 @@ function y(e, s = "") {
294
300
  }
295
301
  `;
296
302
  }
297
- function U(e, s) {
298
- const t = e.name, o = e.shape.length, i = v(o), u = "get" + t.charAt(0).toUpperCase() + t.slice(1), n = ["d0", "d1", "d2", "d3", "d4", "d5"].slice(0, o), r = n.map((a) => `${a} : i32`).join(", ");
303
+ function U(t, s) {
304
+ const e = t.name, o = t.shape.length, i = g(o), u = "get" + e.charAt(0).toUpperCase() + e.slice(1), n = ["d0", "d1", "d2", "d3", "d4", "d5"].slice(0, o), r = n.map((a) => `${a} : i32`).join(", ");
299
305
  if (o < 1)
300
306
  return `
301
- fn ${u}() -> ${f(s)} {
302
- return ${f(s)}(${t}[0]);
307
+ fn ${u}() -> ${h(s)} {
308
+ return ${h(s)}(${e}[0]);
303
309
  }
304
310
  `;
305
- const d = `uniforms.${t.charAt(0).toLowerCase() + t.slice(1)}Shape`;
311
+ const d = `uniforms.${e.charAt(0).toLowerCase() + e.slice(1)}Shape`;
306
312
  let p = `${o}D`;
307
313
  return o === 0 && (p = "1D"), `
308
- fn ${u}(${r}) -> ${f(s)} {
309
- return ${f(s)}(${t}[getIndexFromCoords${p}(${i}(${n.join(",")}),
314
+ fn ${u}(${r}) -> ${h(s)} {
315
+ return ${h(s)}(${e}[getIndexFromCoords${p}(${i}(${n.join(",")}),
310
316
  ${d})${s === 1 ? "" : ` / ${s}`}]);
311
317
  }
312
318
  `;
313
319
  }
314
- function W(e, s, t, o) {
315
- const i = e.name, u = i.charAt(0).toUpperCase() + i.slice(1), n = "get" + u + "ByOutput", r = e.shape.length, d = s.length, p = v(d);
316
- if (z(e.shape, s) && o)
320
+ function W(t, s, e, o) {
321
+ const i = t.name, u = i.charAt(0).toUpperCase() + i.slice(1), n = "get" + u + "ByOutput", r = t.shape.length, d = s.length, p = g(d);
322
+ if (F(t.shape, s) && o)
317
323
  return `
318
- fn ${n}Index(globalIndex : i32) -> ${f(t)} {
319
- return ${f(t)}(${i}[globalIndex]);
324
+ fn ${n}Index(globalIndex : i32) -> ${h(e)} {
325
+ return ${h(e)}(${i}[globalIndex]);
320
326
  }
321
327
 
322
- fn ${n}Coords(coords : ${p}) -> ${f(t)} {
323
- return ${f(t)}(${i}[${d > 1 ? "getOutputIndexFromCoords(coords)" : "coords"}${t === 1 ? "" : ` / ${t}`}]);
328
+ fn ${n}Coords(coords : ${p}) -> ${h(e)} {
329
+ return ${h(e)}(${i}[${d > 1 ? "getOutputIndexFromCoords(coords)" : "coords"}${e === 1 ? "" : ` / ${e}`}]);
324
330
  }
325
331
  `;
326
- const a = k(e.shape, s), g = d - r;
332
+ const a = z(t.shape, s), v = d - r;
327
333
  let l = "";
328
334
  if (r === 0)
329
335
  return `
330
- fn ${n}Index(globalIndex : i32) -> ${f(t)}{
336
+ fn ${n}Index(globalIndex : i32) -> ${h(e)}{
331
337
  return get${u}();
332
338
  }
333
339
 
334
- fn ${n}Coords(coords : ${p}) -> ${f(t)}{
340
+ fn ${n}Coords(coords : ${p}) -> ${h(e)}{
335
341
  return get${u}();
336
342
  }
337
343
  `;
338
- d < 2 && a.length >= 1 ? l = "coords = 0;" : l = a.map((S) => `coords.${I(S + g)} = 0;`).join(`
344
+ d < 2 && a.length >= 1 ? l = "coords = 0;" : l = a.map(($) => `coords.${I($ + v)} = 0;`).join(`
339
345
  `);
340
- let $ = "";
346
+ let f = "";
341
347
  if (d < 2 && r > 0)
342
- $ = "coords";
348
+ f = "coords";
343
349
  else if (d > 1) {
344
- const S = v(r), O = e.shape.map((M, _) => `coords.${I(_ + g)}`).join(", ");
345
- $ = `${S}(${O})`;
350
+ const $ = g(r), x = t.shape.map((M, O) => `coords.${I(O + v)}`).join(", ");
351
+ f = `${$}(${x})`;
346
352
  } else
347
- $ = "coords";
348
- const h = `uniforms.${i.charAt(0).toLowerCase() + i.slice(1)}Shape`, c = `${r}D`;
353
+ f = "coords";
354
+ const S = `uniforms.${i.charAt(0).toLowerCase() + i.slice(1)}Shape`, c = `${r}D`;
349
355
  return `
350
- fn ${n}Index(globalIndex : i32) -> ${f(t)} {
356
+ fn ${n}Index(globalIndex : i32) -> ${h(e)} {
351
357
  var coords = getCoordsFromIndex(globalIndex);
352
358
  ${l}
353
- return ${f(t)}(${i}[getIndexFromCoords${c}(${$}, ${h})${t === 1 ? "" : ` / ${t}`}]);
359
+ return ${h(e)}(${i}[getIndexFromCoords${c}(${f}, ${S})${e === 1 ? "" : ` / ${e}`}]);
354
360
  }
355
361
 
356
- fn ${n}Coords(coordsIn : ${p}) -> ${f(t)} {
362
+ fn ${n}Coords(coordsIn : ${p}) -> ${h(e)} {
357
363
  var coords = coordsIn;
358
364
  ${l}
359
- return ${f(t)}(${i}[getIndexFromCoords${c}(${$}, ${h})${t === 1 ? "" : ` / ${t}`}]);
365
+ return ${h(e)}(${i}[getIndexFromCoords${c}(${f}, ${S})${e === 1 ? "" : ` / ${e}`}]);
360
366
  }
361
367
  `;
362
368
  }
363
- function P(e, s, t, o) {
364
- let i = U(e, t);
365
- return e.shape.length <= s.length && (i += W(e, s, t, o)), i;
369
+ function B(t, s, e, o) {
370
+ let i = U(t, e);
371
+ return t.shape.length <= s.length && (i += W(t, s, e, o)), i;
366
372
  }
367
- function R(e, s) {
368
- const { x: t, y: o = [], z: i = [] } = s, u = e.length, n = t.length + o.length + i.length;
373
+ function P(t, s) {
374
+ const { x: e, y: o = [], z: i = [] } = s, u = t.length, n = e.length + o.length + i.length;
369
375
  if (n !== u)
370
376
  return "";
371
- if (t.length === u)
372
- return `fn getOutputCoords() -> ${v(u)}{
377
+ if (e.length === u)
378
+ return `fn getOutputCoords() -> ${g(u)}{
373
379
  let globalIndex = getGlobalIndex();
374
380
  return getCoordsFromIndex(globalIndex);
375
381
  }
376
382
  `;
377
383
  let r = "";
378
- const d = [t, o, i];
384
+ const d = [e, o, i];
379
385
  for (let l = 0; l < d.length; l++) {
380
- const $ = d[l];
381
- if ($.length !== 0)
382
- if ($.length === 1)
383
- r += `let d${$[0]} = i32(globalId[${l}]);`;
386
+ const f = d[l];
387
+ if (f.length !== 0)
388
+ if (f.length === 1)
389
+ r += `let d${f[0]} = i32(globalId[${l}]);`;
384
390
  else {
385
- const h = L($, "uniforms.outShape");
391
+ const S = L(f, "uniforms.outShape");
386
392
  r += `var index${l} = i32(globalId[${l}]);`;
387
- for (let c = 0; c < h.length; c++)
388
- r += `let d${$[c]} = index${l} / ${h[c]};`, c === h.length - 1 ? r += `let d${$[c + 1]} = index${l} - d${$[c]} * ${h[c]};` : r += `index${l} = index${l} - d${$[c]} * ${h[c]};`;
393
+ for (let c = 0; c < S.length; c++)
394
+ r += `let d${f[c]} = index${l} / ${S[c]};`, c === S.length - 1 ? r += `let d${f[c + 1]} = index${l} - d${f[c]} * ${S[c]};` : r += `index${l} = index${l} - d${f[c]} * ${S[c]};`;
389
395
  }
390
396
  }
391
397
  const p = [];
392
398
  for (let l = 0; l < n; l++)
393
399
  p.push(`d${l}`);
394
- const a = v(n);
395
- let g = `fn getOutputCoords() -> ${a} {
400
+ const a = g(n);
401
+ let v = `fn getOutputCoords() -> ${a} {
396
402
  ${r}
397
403
  `;
398
- return p.length === 0 ? g += `return ${a}(0); }` : g += `return ${a}(${p.join(",")}); }`, g;
404
+ return p.length === 0 ? v += `return ${a}(0); }` : v += `return ${a}(${p.join(",")}); }`, v;
399
405
  }
400
- function G(e) {
406
+ function R(t) {
401
407
  let s = "";
402
- switch (e) {
408
+ switch (t) {
403
409
  case 0:
404
410
  case 1:
405
411
  s += `
@@ -454,66 +460,66 @@ function G(e) {
454
460
  `;
455
461
  break;
456
462
  default:
457
- A(!1, () => `Unsupported ${e}D shape`);
463
+ A(!1, () => `Unsupported ${t}D shape`);
458
464
  break;
459
465
  }
460
466
  return s;
461
467
  }
462
- function F(e) {
463
- return e.dispatch[1] === 1 && e.dispatch[2] === 1;
468
+ function _(t) {
469
+ return t.dispatch[1] === 1 && t.dispatch[2] === 1;
464
470
  }
465
- function x(e, s = 1) {
466
- if (e === "float32")
467
- return f(s, "f32");
468
- if (e === "int32" || e === "bool")
469
- return f(s, "i32");
470
- throw new Error(`type ${e} is not supported.`);
471
+ function b(t, s = 1) {
472
+ if (t === "float32")
473
+ return h(s, "f32");
474
+ if (t === "int32" || t === "bool" || t === "packedF16")
475
+ return h(s, "i32");
476
+ throw new Error(`type ${t} is not supported.`);
471
477
  }
472
- function V(e, s, t) {
473
- const o = e.length, i = x(s, t);
474
- let u = `fn setOutputAtIndex(flatIndex : i32, value : ${f(t)}) {
478
+ function G(t, s, e) {
479
+ const o = t.length, i = b(s, e);
480
+ let u = `fn setOutputAtIndex(flatIndex : i32, value : ${h(e)}) {
475
481
  result[flatIndex] = ${i}(value);
476
482
  }
477
483
 
478
- fn setOutputAtIndexI32(flatIndex : i32, value : ${f(t, "i32")}) {
484
+ fn setOutputAtIndexI32(flatIndex : i32, value : ${h(e, "i32")}) {
479
485
  result[flatIndex] = ${i}(value);
480
486
  }
481
487
  `;
482
488
  if (o >= 2) {
483
- const n = ["d0", "d1", "d2", "d3", "d4", "d5"].slice(0, o), r = v(o);
489
+ const n = ["d0", "d1", "d2", "d3", "d4", "d5"].slice(0, o), r = g(o);
484
490
  u += `
485
- fn setOutputAtCoords(${n.map((d) => `${d} : i32`).join(", ")}, value : ${f(t)}) {
491
+ fn setOutputAtCoords(${n.map((d) => `${d} : i32`).join(", ")}, value : ${h(e)}) {
486
492
  let flatIndex = getOutputIndexFromCoords(${r}(${n.join(", ")}));
487
- setOutputAtIndex(flatIndex${t === 1 ? "" : ` / ${t}`}, value);
493
+ setOutputAtIndex(flatIndex${e === 1 ? "" : ` / ${e}`}, value);
488
494
  }
489
- fn setOutputAtCoordsI32(${n.map((d) => `${d} : i32`).join(", ")}, value : ${f(t, "i32")}) {
495
+ fn setOutputAtCoordsI32(${n.map((d) => `${d} : i32`).join(", ")}, value : ${h(e, "i32")}) {
490
496
  let flatIndex = getOutputIndexFromCoords(${r}(${n.join(", ")}));
491
- setOutputAtIndexI32(flatIndex${t === 1 ? "" : ` / ${t}`}, value);
497
+ setOutputAtIndexI32(flatIndex${e === 1 ? "" : ` / ${e}`}, value);
492
498
  }
493
499
  `;
494
500
  }
495
501
  return u;
496
502
  }
497
- function B(e) {
503
+ function V(t) {
498
504
  const s = /(\w+)\s*:\s*vec(5|6)/g;
499
- e = e.replace(s, (o) => "@align(16) " + o);
500
- const t = /vec(5|6)\s*,\s*(\w+)/g;
501
- return e = e.replace(t, (o, i, u) => `vec${i}, @align(16) ${u}`), e;
505
+ t = t.replace(s, (o) => "@align(16) " + o);
506
+ const e = /vec(5|6)\s*,\s*(\w+)/g;
507
+ return t = t.replace(e, (o, i, u) => `vec${i}, @align(16) ${u}`), t;
502
508
  }
503
- function m(e) {
504
- return !(e.dispatchLayout.hasOwnProperty("y") && e.dispatchLayout.y.length !== 0 || e.dispatchLayout.hasOwnProperty("z") && e.dispatchLayout.z.length !== 0);
509
+ function k(t) {
510
+ return !(t.dispatchLayout.hasOwnProperty("y") && t.dispatchLayout.y.length !== 0 || t.dispatchLayout.hasOwnProperty("z") && t.dispatchLayout.z.length !== 0);
505
511
  }
506
512
  export {
507
- b as P,
513
+ w as P,
508
514
  y as a,
509
- v as b,
515
+ g as b,
510
516
  I as c,
511
- x as d,
512
- q as e,
513
- Y as f,
517
+ b as d,
518
+ Y as e,
519
+ H as f,
514
520
  N as g,
515
- H as h,
516
- Z as m,
521
+ X as h,
522
+ q as m,
517
523
  L as s,
518
- f as t
524
+ h as t
519
525
  };