@genai-fi/nanogpt 0.10.2 → 0.11.0
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.
- package/dist/Generator.d.ts +10 -5
- package/dist/Generator.js +11760 -146
- package/dist/{RealDiv-zz7FpkKX.js → RealDiv-Ds-jvL09.js} +28 -30
- package/dist/Reshape-Cd6e-Otn.js +14 -0
- package/dist/{Reshape-CHdUjC72.js → Reshape-Ct266DEk.js} +21 -23
- package/dist/TeachableLLM.d.ts +4 -3
- package/dist/TeachableLLM.js +15 -16
- package/dist/Trainer.d.ts +2 -2
- package/dist/Trainer.js +6 -6
- package/dist/{axis_util-BsIr9ZNu.js → axis_util-DofAuy0p.js} +1 -1
- package/dist/backend.js +2 -2
- package/dist/{backend_util-B1XRLuq9.js → backend_util-C7NWHpv7.js} +72 -73
- package/dist/{backend_webgpu-CqpfEImu.js → backend_webgpu-B0Vls736.js} +52 -54
- package/dist/broadcast_to-DDaNMbX7.js +28 -0
- package/dist/checks/appendCache.js +2 -2
- package/dist/checks/attentionMask.js +3 -3
- package/dist/checks/gelu.js +2 -2
- package/dist/checks/matMulGelu.js +7 -11
- package/dist/checks/normRMS.js +9 -9
- package/dist/checks/normRMSGrad.js +3 -3
- package/dist/checks/packUnpack.js +2 -2
- package/dist/checks/qkv.js +11 -12
- package/dist/checks/rope.js +2 -2
- package/dist/clip_by_value-Dn5tzexi.js +12 -0
- package/dist/complex-DClmWqJt.js +11 -0
- package/dist/concat-C6X3AAlQ.js +17 -0
- package/dist/{concat_util-iBYIyuQe.js → concat_util-CHsJFZJJ.js} +1 -1
- package/dist/{dataset-D2P7rHAw.js → dataset-DcjWqUVQ.js} +135 -137
- package/dist/dropout-OxuaJz6z.js +92 -0
- package/dist/expand_dims-BzfJK2uc.js +11 -0
- package/dist/{exports_initializers-CZSUJoVE.js → exports_initializers-eS9QJ6ut.js} +1 -1
- package/dist/floor-DIb-lN_u.js +9 -0
- package/dist/gather-BcO5UQNJ.js +9 -0
- package/dist/{gelu-Bmhopi0J.js → gelu-DqTbCx5x.js} +10 -11
- package/dist/{gpgpu_math-DsCcikas.js → gpgpu_math-CJcbnKPC.js} +841 -1015
- package/dist/index-D0RBWjq8.js +3520 -0
- package/dist/{index-DRyE072i.js → index-Dj5TkmPY.js} +330 -331
- package/dist/{kernel_funcs_utils-CWfOAPGO.js → kernel_funcs_utils-CSaumNDs.js} +132 -134
- package/dist/layers/BaseLayer.js +15 -16
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/MLP.js +4 -4
- package/dist/layers/PositionEmbedding.js +7 -7
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +9 -9
- package/dist/layers/TiedEmbedding.js +6 -6
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/loader/loadTransformers.js +1 -1
- package/dist/loader/oldZipLoad.js +21 -22
- package/dist/log_sum_exp-VLZgbFAH.js +39 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +49 -50
- package/dist/{matMul16-fEAJ4smh.js → matMul16-cDxwemKj.js} +14 -15
- package/dist/matMulGelu-B2s_80-H.js +163 -0
- package/dist/mat_mul-DxpNTCRz.js +11 -0
- package/dist/mod-PrOKlFxH.js +11 -0
- package/dist/models/NanoGPTV1.js +2 -2
- package/dist/models/model.js +13 -14
- package/dist/ones-BX_wEgzB.js +14 -0
- package/dist/ops/adamAdjust.js +1 -1
- package/dist/ops/adamMoments.js +1 -1
- package/dist/ops/add16.js +1 -1
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/concat16.js +2 -2
- package/dist/ops/cpu/adamAdjust.js +12 -13
- package/dist/ops/cpu/adamMoments.js +6 -7
- package/dist/ops/cpu/appendCache.js +7 -8
- package/dist/ops/cpu/attentionMask.js +11 -11
- package/dist/ops/cpu/fusedSoftmax.js +10 -11
- package/dist/ops/cpu/gatherSub.js +10 -11
- package/dist/ops/cpu/gelu.js +14 -15
- package/dist/ops/cpu/matMul16.js +6 -7
- package/dist/ops/cpu/matMulGelu.js +5 -6
- package/dist/ops/cpu/matMulMul.js +3 -4
- package/dist/ops/cpu/mulDropout.js +3 -4
- package/dist/ops/cpu/normRMS.js +11 -12
- package/dist/ops/cpu/qkv.js +8 -9
- package/dist/ops/cpu/rope.js +9 -10
- package/dist/ops/cpu/scatterSub.js +14 -16
- package/dist/ops/dot16.js +2 -2
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/grads/add16.js +10 -11
- package/dist/ops/grads/attentionMask.js +5 -6
- package/dist/ops/grads/gelu.js +3 -4
- package/dist/ops/grads/matMul16.js +4 -5
- package/dist/ops/grads/matMulGelu.js +8 -9
- package/dist/ops/grads/normRMS.js +9 -10
- package/dist/ops/grads/pack16.js +4 -5
- package/dist/ops/grads/qkv.js +17 -19
- package/dist/ops/grads/rope.js +3 -5
- package/dist/ops/grads/softmax16.js +3 -4
- package/dist/ops/grads/unpack16.js +3 -4
- package/dist/ops/grads/utils.d.ts +1 -0
- package/dist/ops/grads/utils.js +8 -4
- package/dist/ops/matMul16.js +3 -3
- package/dist/ops/matMulGelu.js +2 -2
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mul16.js +1 -1
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/pack16.js +3 -4
- package/dist/ops/qkv.js +4 -8
- package/dist/ops/reshape16.js +16 -18
- package/dist/ops/rope.d.ts +1 -1
- package/dist/ops/rope.js +3 -8
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/slice16.js +2 -2
- package/dist/ops/softmax16.js +5 -8
- package/dist/ops/sub16.js +1 -1
- package/dist/ops/sum16.js +2 -2
- package/dist/ops/transpose16.js +23 -24
- package/dist/ops/unpack16.js +2 -2
- package/dist/ops/webgl/adamAdjust.js +2 -3
- package/dist/ops/webgl/adamMoments.js +1 -2
- package/dist/ops/webgl/appendCache.js +1 -2
- package/dist/ops/webgl/attentionMask.js +5 -6
- package/dist/ops/webgl/fusedSoftmax.js +6 -8
- package/dist/ops/webgl/gatherSub.js +6 -7
- package/dist/ops/webgl/gelu.js +2 -3
- package/dist/ops/webgl/log.js +11 -12
- package/dist/ops/webgl/matMul16.js +15 -16
- package/dist/ops/webgl/matMulGelu.js +7 -111
- package/dist/ops/webgl/matMulMul.js +14 -15
- package/dist/ops/webgl/mulDropout.js +8 -9
- package/dist/ops/webgl/normRMS.js +7 -8
- package/dist/ops/webgl/qkv.js +5 -6
- package/dist/ops/webgl/rope.js +7 -8
- package/dist/ops/webgl/scatterSub.js +5 -6
- package/dist/ops/webgpu/adamAdjust.js +10 -12
- package/dist/ops/webgpu/adamMoments.js +8 -10
- package/dist/ops/webgpu/add16.js +8 -9
- package/dist/ops/webgpu/appendCache.js +23 -25
- package/dist/ops/webgpu/attentionMask.js +10 -12
- package/dist/ops/webgpu/attentionMask32_program.js +2 -2
- package/dist/ops/webgpu/concat16.js +12 -14
- package/dist/ops/webgpu/gatherSub.js +9 -11
- package/dist/ops/webgpu/gelu.js +28 -29
- package/dist/ops/webgpu/matMul16.js +26 -28
- package/dist/ops/webgpu/matMul16_program.js +4 -5
- package/dist/ops/webgpu/mul16.js +7 -8
- package/dist/ops/webgpu/normRMS.js +17 -19
- package/dist/ops/webgpu/normRMSGrad.js +21 -28
- package/dist/ops/webgpu/pack16.js +12 -13
- package/dist/ops/webgpu/pack16_program.js +2 -2
- package/dist/ops/webgpu/qkv.js +13 -15
- package/dist/ops/webgpu/rope.js +25 -27
- package/dist/ops/webgpu/scatterSub.js +7 -9
- package/dist/ops/webgpu/slice16.js +21 -23
- package/dist/ops/webgpu/softmax16.js +17 -19
- package/dist/ops/webgpu/softmax16_program.js +2 -2
- package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
- package/dist/ops/webgpu/softmax16grad.js +7 -8
- package/dist/ops/webgpu/sub16.js +8 -9
- package/dist/ops/webgpu/sum16.js +19 -21
- package/dist/ops/webgpu/transpose16.js +19 -20
- package/dist/ops/webgpu/transpose16_program.js +2 -2
- package/dist/ops/webgpu/transpose16_shared_program.js +11 -12
- package/dist/ops/webgpu/unpack16.js +3 -4
- package/dist/ops/webgpu/utils/binary_op.js +7 -8
- package/dist/ops/webgpu/utils/reductions.js +14 -22
- package/dist/ops-FJapAPfm.js +476 -0
- package/dist/pack16-k4jq6aMX.js +39 -0
- package/dist/patches/webgpu_backend.js +19 -20
- package/dist/patches/webgpu_base.js +1 -1
- package/dist/patches/webgpu_program.js +15 -16
- package/dist/{random_width-BVV9HveY.js → random_width-UGQn4OWb.js} +2506 -2761
- package/dist/range-CuGvVN2c.js +10 -0
- package/dist/relu-Cf80uA2p.js +9 -0
- package/dist/reshape-CkjKPPqB.js +9 -0
- package/dist/resize_nearest_neighbor-DB8k9KN_.js +175 -0
- package/dist/rope-BmZmp9uP.js +24 -0
- package/dist/{scatter_nd_util-C7zXRT_h.js → scatter_nd_util-BY22Cc-C.js} +1 -1
- package/dist/selu_util-BuLbmbrl.js +44 -0
- package/dist/{shared-CHhxz-O5.js → shared-B7USJZgw.js} +1 -1
- package/dist/{shared-D2NP_CpY.js → shared-BQboIImQ.js} +379 -381
- package/dist/slice-Aqy7KbJh.js +12 -0
- package/dist/{slice_util-DyjSAD0u.js → slice_util-D8CQRenR.js} +7 -7
- package/dist/{softmax-C9JQEtnO.js → softmax-faLoUZVT.js} +4 -5
- package/dist/split-BNz5jcGc.js +9 -0
- package/dist/squeeze--YMgaAAf.js +10 -0
- package/dist/stack-WJK22CFn.js +11 -0
- package/dist/step-dXR33iOg.js +261 -0
- package/dist/sum-BdplSvq_.js +11 -0
- package/dist/{tensor-0r5yOo2R.js → tensor-BQqrDvpx.js} +1 -1
- package/dist/tensor1d-LxP9asMm.js +11 -0
- package/dist/{tensor2d-CSB4KOb0.js → tensor2d-BN1sSfQO.js} +6 -7
- package/dist/{tensor4d-D7bLqGqz.js → tensor4d-DVwr7pLF.js} +6 -7
- package/dist/{tfjs_backend-CNkSTL0c.js → tfjs_backend-Vi4JfLzT.js} +256 -265
- package/dist/tile-CvN_LyVr.js +11 -0
- package/dist/tokeniser/BaseTokeniser.d.ts +27 -0
- package/dist/tokeniser/BaseTokeniser.js +94 -0
- package/dist/tokeniser/CharTokeniser.d.ts +4 -3
- package/dist/tokeniser/CharTokeniser.js +46 -32
- package/dist/tokeniser/bpe.d.ts +4 -3
- package/dist/tokeniser/bpe.js +60 -45
- package/dist/tokeniser/type.d.ts +11 -0
- package/dist/training/Adam.js +2 -2
- package/dist/training/AdamExt.js +1 -1
- package/dist/training/DatasetBuilder.d.ts +2 -2
- package/dist/training/DatasetBuilder.js +32 -36
- package/dist/training/FullTrainer.js +1 -1
- package/dist/training/Trainer.d.ts +3 -3
- package/dist/training/Trainer.js +2 -2
- package/dist/training/sparseCrossEntropy.js +5 -5
- package/dist/transpose-JawVKyZy.js +36 -0
- package/dist/unsorted_segment_sum-LAbmE9G4.js +277 -0
- package/dist/utilities/dummy.js +3 -3
- package/dist/utilities/multinomialCPU.js +2 -2
- package/dist/utilities/packed.d.ts +1 -4
- package/dist/utilities/packed.js +10 -745
- package/dist/utilities/performance.js +1 -1
- package/dist/utilities/profile.js +1 -1
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/sentences.js +5 -5
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-DzfrwYuP.js → variable-DQ9yYgEU.js} +1 -1
- package/dist/{webgpu_program-DzaQiqel.js → webgpu_program-CAE4RICo.js} +177 -171
- package/dist/{webgpu_util-0_ubCEHJ.js → webgpu_util-BdovYhXr.js} +34 -35
- package/dist/zeros-DeiE2zTa.js +13 -0
- package/dist/zeros_like-BAz3iKru.js +721 -0
- package/package.json +4 -2
- package/dist/Reshape-CDVLyVfz.js +0 -16
- package/dist/broadcast_to-B0ChcDaz.js +0 -30
- package/dist/complex-BBiRlsVq.js +0 -13
- package/dist/concat-DmBLPVGC.js +0 -19
- package/dist/dropout-B1x1kYMa.js +0 -99
- package/dist/expand_dims-ouvfxQ1n.js +0 -13
- package/dist/gather-CH9sdacz.js +0 -10
- package/dist/index-D6Q1lPZO.js +0 -2157
- package/dist/log_sum_exp-D3ftBNY5.js +0 -41
- package/dist/mat_mul-C59XWcJd.js +0 -12
- package/dist/mod-DESSvHIU.js +0 -12
- package/dist/mulmat_packed_gpu-Coh6qbJk.js +0 -55
- package/dist/ones-jU9jlQvM.js +0 -15
- package/dist/ops-BFDtP6th.js +0 -645
- package/dist/pack16-CmVZs6af.js +0 -41
- package/dist/patches/PackedTensor.d.ts +0 -12
- package/dist/patches/PackedTensor.js +0 -11
- package/dist/patches/engine.d.ts +0 -261
- package/dist/patches/engine.js +0 -12
- package/dist/patches/tape.d.ts +0 -12
- package/dist/patches/tape.js +0 -5
- package/dist/range-ZZZD60Fx.js +0 -11
- package/dist/reciprocal-CrYlsAGD.js +0 -10
- package/dist/register_all_kernels-nvj2k7OC.js +0 -12307
- package/dist/relu-BYDneVPn.js +0 -10
- package/dist/reshape-CaPQzFvz.js +0 -10
- package/dist/rope-s4W2XO9B.js +0 -32
- package/dist/selu_util-BGPXmd4B.js +0 -303
- package/dist/sin-Djs4aQiu.js +0 -16
- package/dist/slice-DvovR5wq.js +0 -13
- package/dist/split-DBck65sX.js +0 -10
- package/dist/squeeze-C00Ipm_7.js +0 -11
- package/dist/stack-ChnHwRpX.js +0 -13
- package/dist/sum-ywRJj3Zr.js +0 -12
- package/dist/tensor-CzmOBsdf.js +0 -909
- package/dist/tensor1d-BlUT89BP.js +0 -12
- package/dist/tensor_util-DfwaWayG.js +0 -523
- package/dist/tile-CR074jmp.js +0 -13
- package/dist/transpose-DH4gmHvu.js +0 -38
- package/dist/zeros-DBFVbpv5.js +0 -14
|
@@ -1,50 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (Math.max(...e) > 5)
|
|
1
|
+
import { ad as z, ac as F, ab as E, a9 as j, y as A } from "./index-D0RBWjq8.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
|
|
7
|
-
u[
|
|
8
|
-
for (let 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
|
|
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(${
|
|
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
|
|
26
|
-
(function(
|
|
27
|
-
|
|
28
|
-
})(
|
|
29
|
-
const
|
|
30
|
-
const u = { dtype: o.dtype, shape: o.shape }, n = D(
|
|
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 });
|
|
31
30
|
let d = E().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 ?
|
|
36
|
+
return i ? t.createComputePipelineAsync({
|
|
38
37
|
compute: { module: r, entryPoint: "_start" },
|
|
39
38
|
label: s.constructor.name,
|
|
40
39
|
layout: "auto"
|
|
41
|
-
}) :
|
|
40
|
+
}) : t.createComputePipeline({
|
|
42
41
|
compute: { module: r, entryPoint: "_start" },
|
|
43
42
|
label: s.constructor.name,
|
|
44
43
|
layout: "auto"
|
|
45
44
|
});
|
|
46
|
-
},
|
|
47
|
-
switch (
|
|
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(`${
|
|
56
|
+
throw new Error(`${t}-component ${s} is not supported.`);
|
|
58
57
|
}
|
|
59
58
|
};
|
|
60
|
-
function
|
|
61
|
-
if (
|
|
59
|
+
function g(t) {
|
|
60
|
+
if (t <= 1)
|
|
62
61
|
return "i32";
|
|
63
|
-
if (
|
|
62
|
+
if (t === 2)
|
|
64
63
|
return "vec2<i32>";
|
|
65
|
-
if (
|
|
64
|
+
if (t === 3)
|
|
66
65
|
return "vec3<i32>";
|
|
67
|
-
if (
|
|
66
|
+
if (t === 4)
|
|
68
67
|
return "vec4<i32>";
|
|
69
|
-
if (
|
|
68
|
+
if (t === 5)
|
|
70
69
|
return "vec5";
|
|
71
|
-
if (
|
|
70
|
+
if (t === 6)
|
|
72
71
|
return "vec6";
|
|
73
|
-
throw Error(`GPU for rank ${
|
|
72
|
+
throw Error(`GPU for rank ${t} is not yet supported`);
|
|
74
73
|
}
|
|
75
|
-
function I(
|
|
76
|
-
if (
|
|
74
|
+
function I(t) {
|
|
75
|
+
if (t === 0)
|
|
77
76
|
return "x";
|
|
78
|
-
if (
|
|
77
|
+
if (t === 1)
|
|
79
78
|
return "y";
|
|
80
|
-
if (
|
|
79
|
+
if (t === 2)
|
|
81
80
|
return "z";
|
|
82
|
-
if (
|
|
81
|
+
if (t === 3)
|
|
83
82
|
return "w";
|
|
84
|
-
if (
|
|
83
|
+
if (t === 4)
|
|
85
84
|
return "u";
|
|
86
|
-
if (
|
|
85
|
+
if (t === 5)
|
|
87
86
|
return "v";
|
|
88
|
-
throw Error(`Index ${
|
|
87
|
+
throw Error(`Index ${t} is not yet supported`);
|
|
89
88
|
}
|
|
90
|
-
function
|
|
89
|
+
function Y(...t) {
|
|
91
90
|
let s;
|
|
92
|
-
switch (
|
|
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(${
|
|
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
|
|
109
|
-
let
|
|
110
|
-
return
|
|
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
|
-
${
|
|
123
|
+
${s.subgroupBuiltins ? "subgroupInvocationId = SubgroupInvocationId" : ""};
|
|
124
|
+
${s.subgroupBuiltins ? "subgroupSize = SubgroupSize" : ""};
|
|
125
|
+
${t ? "main(getGlobalIndex());" : "main();"};
|
|
123
126
|
}
|
|
124
|
-
`,
|
|
127
|
+
`, e;
|
|
125
128
|
}
|
|
126
|
-
function N(
|
|
129
|
+
function N(t) {
|
|
127
130
|
return `
|
|
128
|
-
@compute @workgroup_size(${
|
|
131
|
+
@compute @workgroup_size(${t.workgroupSize[0]}, ${t.workgroupSize[1]}, ${t.workgroupSize[2]})
|
|
129
132
|
`;
|
|
130
133
|
}
|
|
131
|
-
function D(
|
|
132
|
-
const o = [], i =
|
|
133
|
-
if (
|
|
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
|
-
${
|
|
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
|
-
`),
|
|
149
|
-
const
|
|
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 : ${
|
|
157
|
+
outShapeStrides : ${$},
|
|
153
158
|
size : i32,
|
|
154
159
|
numChannels : i32,
|
|
155
160
|
alpha : f32,
|
|
156
161
|
};
|
|
157
162
|
|
|
158
|
-
${
|
|
163
|
+
${c}
|
|
159
164
|
@group(0) @binding(2) var<uniform> uniforms: Uniform;
|
|
160
165
|
`);
|
|
161
|
-
const
|
|
166
|
+
const x = k(e);
|
|
162
167
|
return [
|
|
163
|
-
|
|
168
|
+
m,
|
|
164
169
|
o.join(`
|
|
165
170
|
`),
|
|
166
171
|
y(s.shape),
|
|
167
|
-
|
|
168
|
-
|
|
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
|
-
|
|
174
|
-
const
|
|
175
|
-
r += `${
|
|
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 =
|
|
178
|
-
r += `outShape : ${d}, `, u = s.shape.length - 1, n =
|
|
179
|
-
outShapeStrides: ${n}, `,
|
|
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<${
|
|
183
|
-
`),
|
|
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 +
|
|
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 +
|
|
193
|
+
@group(0) @binding(${1 + e.variableNames.length}) var<uniform> uniforms: Uniforms;
|
|
189
194
|
`);
|
|
190
|
-
const p =
|
|
191
|
-
|
|
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
|
-
|
|
202
|
+
R(s.shape.length)
|
|
197
203
|
];
|
|
198
|
-
|
|
199
|
-
|
|
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
|
|
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
|
-
|
|
204
|
-
const
|
|
205
|
-
return
|
|
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
|
|
209
|
-
let o =
|
|
210
|
-
if (
|
|
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(
|
|
216
|
-
const n = s.map((a) =>
|
|
217
|
-
return 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
|
|
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(
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
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(
|
|
279
|
-
for (let p = 0; p <
|
|
284
|
+
const u = j(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
|
|
289
|
-
return `${
|
|
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(
|
|
298
|
-
const
|
|
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}() -> ${
|
|
302
|
-
return ${
|
|
307
|
+
fn ${u}() -> ${h(s)} {
|
|
308
|
+
return ${h(s)}(${e}[0]);
|
|
303
309
|
}
|
|
304
310
|
`;
|
|
305
|
-
const d = `uniforms.${
|
|
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}) -> ${
|
|
309
|
-
return ${
|
|
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(
|
|
315
|
-
const i =
|
|
316
|
-
if (
|
|
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) -> ${
|
|
319
|
-
return ${
|
|
324
|
+
fn ${n}Index(globalIndex : i32) -> ${h(e)} {
|
|
325
|
+
return ${h(e)}(${i}[globalIndex]);
|
|
320
326
|
}
|
|
321
327
|
|
|
322
|
-
fn ${n}Coords(coords : ${p}) -> ${
|
|
323
|
-
return ${
|
|
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 =
|
|
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) -> ${
|
|
336
|
+
fn ${n}Index(globalIndex : i32) -> ${h(e)}{
|
|
331
337
|
return get${u}();
|
|
332
338
|
}
|
|
333
339
|
|
|
334
|
-
fn ${n}Coords(coords : ${p}) -> ${
|
|
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((
|
|
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
|
-
|
|
348
|
+
f = "coords";
|
|
343
349
|
else if (d > 1) {
|
|
344
|
-
const
|
|
345
|
-
|
|
350
|
+
const $ = g(r), x = t.shape.map((M, O) => `coords.${I(O + v)}`).join(", ");
|
|
351
|
+
f = `${$}(${x})`;
|
|
346
352
|
} else
|
|
347
|
-
|
|
348
|
-
const
|
|
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) -> ${
|
|
356
|
+
fn ${n}Index(globalIndex : i32) -> ${h(e)} {
|
|
351
357
|
var coords = getCoordsFromIndex(globalIndex);
|
|
352
358
|
${l}
|
|
353
|
-
return ${
|
|
359
|
+
return ${h(e)}(${i}[getIndexFromCoords${c}(${f}, ${S})${e === 1 ? "" : ` / ${e}`}]);
|
|
354
360
|
}
|
|
355
361
|
|
|
356
|
-
fn ${n}Coords(coordsIn : ${p}) -> ${
|
|
362
|
+
fn ${n}Coords(coordsIn : ${p}) -> ${h(e)} {
|
|
357
363
|
var coords = coordsIn;
|
|
358
364
|
${l}
|
|
359
|
-
return ${
|
|
365
|
+
return ${h(e)}(${i}[getIndexFromCoords${c}(${f}, ${S})${e === 1 ? "" : ` / ${e}`}]);
|
|
360
366
|
}
|
|
361
367
|
`;
|
|
362
368
|
}
|
|
363
|
-
function
|
|
364
|
-
let i = U(
|
|
365
|
-
return
|
|
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
|
|
368
|
-
const { x:
|
|
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 (
|
|
372
|
-
return `fn getOutputCoords() -> ${
|
|
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 = [
|
|
384
|
+
const d = [e, o, i];
|
|
379
385
|
for (let l = 0; l < d.length; l++) {
|
|
380
|
-
const
|
|
381
|
-
if (
|
|
382
|
-
if (
|
|
383
|
-
r += `let d${
|
|
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
|
|
391
|
+
const S = L(f, "uniforms.outShape");
|
|
386
392
|
r += `var index${l} = i32(globalId[${l}]);`;
|
|
387
|
-
for (let c = 0; c <
|
|
388
|
-
r += `let d${
|
|
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 =
|
|
395
|
-
let
|
|
400
|
+
const a = g(n);
|
|
401
|
+
let v = `fn getOutputCoords() -> ${a} {
|
|
396
402
|
${r}
|
|
397
403
|
`;
|
|
398
|
-
return p.length === 0 ?
|
|
404
|
+
return p.length === 0 ? v += `return ${a}(0); }` : v += `return ${a}(${p.join(",")}); }`, v;
|
|
399
405
|
}
|
|
400
|
-
function
|
|
406
|
+
function R(t) {
|
|
401
407
|
let s = "";
|
|
402
|
-
switch (
|
|
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 ${
|
|
463
|
+
A(!1, () => `Unsupported ${t}D shape`);
|
|
458
464
|
break;
|
|
459
465
|
}
|
|
460
466
|
return s;
|
|
461
467
|
}
|
|
462
|
-
function
|
|
463
|
-
return
|
|
468
|
+
function _(t) {
|
|
469
|
+
return t.dispatch[1] === 1 && t.dispatch[2] === 1;
|
|
464
470
|
}
|
|
465
|
-
function
|
|
466
|
-
if (
|
|
467
|
-
return
|
|
468
|
-
if (
|
|
469
|
-
return
|
|
470
|
-
throw new Error(`type ${
|
|
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
|
|
473
|
-
const o =
|
|
474
|
-
let u = `fn setOutputAtIndex(flatIndex : i32, value : ${
|
|
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 : ${
|
|
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 =
|
|
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 : ${
|
|
491
|
+
fn setOutputAtCoords(${n.map((d) => `${d} : i32`).join(", ")}, value : ${h(e)}) {
|
|
486
492
|
let flatIndex = getOutputIndexFromCoords(${r}(${n.join(", ")}));
|
|
487
|
-
setOutputAtIndex(flatIndex${
|
|
493
|
+
setOutputAtIndex(flatIndex${e === 1 ? "" : ` / ${e}`}, value);
|
|
488
494
|
}
|
|
489
|
-
fn setOutputAtCoordsI32(${n.map((d) => `${d} : i32`).join(", ")}, value : ${
|
|
495
|
+
fn setOutputAtCoordsI32(${n.map((d) => `${d} : i32`).join(", ")}, value : ${h(e, "i32")}) {
|
|
490
496
|
let flatIndex = getOutputIndexFromCoords(${r}(${n.join(", ")}));
|
|
491
|
-
setOutputAtIndexI32(flatIndex${
|
|
497
|
+
setOutputAtIndexI32(flatIndex${e === 1 ? "" : ` / ${e}`}, value);
|
|
492
498
|
}
|
|
493
499
|
`;
|
|
494
500
|
}
|
|
495
501
|
return u;
|
|
496
502
|
}
|
|
497
|
-
function
|
|
503
|
+
function V(t) {
|
|
498
504
|
const s = /(\w+)\s*:\s*vec(5|6)/g;
|
|
499
|
-
|
|
500
|
-
const
|
|
501
|
-
return
|
|
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
|
|
504
|
-
return !(
|
|
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
|
-
|
|
513
|
+
w as P,
|
|
508
514
|
y as a,
|
|
509
|
-
|
|
515
|
+
g as b,
|
|
510
516
|
I as c,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
517
|
+
b as d,
|
|
518
|
+
Y as e,
|
|
519
|
+
H as f,
|
|
514
520
|
N as g,
|
|
515
|
-
|
|
516
|
-
|
|
521
|
+
X as h,
|
|
522
|
+
q as m,
|
|
517
523
|
L as s,
|
|
518
|
-
|
|
524
|
+
h as t
|
|
519
525
|
};
|