@margoengine/compute 0.1.0 → 1.0.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/onnx.js CHANGED
@@ -1,30 +1,6 @@
1
1
  import { n as e, r as t, t as n } from "./errors-CDgOgzCd.js";
2
2
  //#region src/onnx.ts
3
- var r = [
4
- "",
5
- "float32",
6
- "uint8",
7
- "int8",
8
- "uint16",
9
- "int16",
10
- "int32",
11
- "int64",
12
- "string",
13
- "bool",
14
- "float16",
15
- "float64",
16
- "uint32",
17
- "uint64",
18
- "",
19
- "",
20
- "bfloat16",
21
- "",
22
- "",
23
- "",
24
- "",
25
- "uint4",
26
- "int4"
27
- ], i = [
3
+ var r = /* @__PURE__ */ ".float32.uint8.int8.uint16.int16.int32.int64.string.bool.float16.float64.uint32.uint64.complex64.complex128.bfloat16.float8e4m3fn.float8e4m3fnuz.float8e5m2.float8e5m2fnuz.uint4.int4.float4e2m1.float8e8m0.uint2.int2.float6e2m3.float6e3m2".split("."), i = [
28
4
  0,
29
5
  4,
30
6
  1,
@@ -39,15 +15,21 @@ var r = [
39
15
  8,
40
16
  4,
41
17
  8,
42
- 0,
43
- 0,
18
+ 8,
19
+ 16,
44
20
  2,
45
- 0,
46
- 0,
47
- 0,
48
- 0,
21
+ 1,
22
+ 1,
23
+ 1,
24
+ 1,
25
+ .5,
49
26
  .5,
50
- .5
27
+ .5,
28
+ 1,
29
+ .25,
30
+ .25,
31
+ .75,
32
+ .75
51
33
  ], a = [
52
34
  null,
53
35
  Float32Array,
@@ -63,13 +45,19 @@ var r = [
63
45
  Float64Array,
64
46
  Uint32Array,
65
47
  BigUint64Array,
66
- null,
67
- null,
48
+ Float32Array,
49
+ Float64Array,
68
50
  Uint16Array,
69
- null,
70
- null,
71
- null,
72
- null,
51
+ Uint8Array,
52
+ Uint8Array,
53
+ Uint8Array,
54
+ Uint8Array,
55
+ Uint8Array,
56
+ Uint8Array,
57
+ Uint8Array,
58
+ Uint8Array,
59
+ Uint8Array,
60
+ Uint8Array,
73
61
  Uint8Array,
74
62
  Uint8Array
75
63
  ], o = new TextEncoder(), s = new TextDecoder("utf-8", { fatal: !0 });
@@ -237,7 +225,9 @@ var g = class {
237
225
  "OptionalGetElement",
238
226
  "OptionalHasElement",
239
227
  "SequenceMap",
240
- "StringNormalizer"
228
+ "StringNormalizer",
229
+ "RegexFullMatch",
230
+ "ImageDecoder"
241
231
  ].includes(u.op)) && !this.#e.supported(u.kernelIndex, d)) throw n("unsupported", `ONNX operator ${e || "ai.onnx"}:${u.op} opset ${d} has no kernel or model-local function`, "compute");
242
232
  for (let e of m(u.attributes)) o = Math.max(o, 1 + this.#g(e, t, s, i, a + 1));
243
233
  for (let e of u.outputs) e && ((l.has(e) || r.has(e)) && c(`value ${e} is assigned more than once`), l.add(e), s.add(e));
@@ -511,6 +501,34 @@ var g = class {
511
501
  let v = n.shape.length === 1 ? [_.length] : [1, _.length];
512
502
  return [this.#_(new u("string", _, v), d.owned)];
513
503
  }
504
+ case "RegexFullMatch": {
505
+ ((s[""] ?? 1) < 20 || t.length !== 1 || e.outputs.length !== 1) && c("RegexFullMatch needs opset >=20 and one input/output");
506
+ let n = i.find((e) => e.name === "pattern") ?? {
507
+ kind: 3,
508
+ value: ""
509
+ };
510
+ (i.some((e) => e.name !== "pattern") || n.kind !== 3 || typeof n.value != "string") && c("RegexFullMatch takes one string attribute, pattern");
511
+ let r = this.#v(this.#S(t[0]));
512
+ r.dtype !== "string" && c("RegexFullMatch needs a string tensor");
513
+ let { fullMatcher: a } = await import("./onnx-regex-DaesIdrm.js"), o = a(n.value), l = Uint8Array.from(r.data, (e) => Number(o(e)));
514
+ return [this.#_(new u("bool", l, r.shape), d.owned)];
515
+ }
516
+ case "ImageDecoder": {
517
+ ((s[""] ?? 1) < 20 || t.length !== 1 || e.outputs.length !== 1) && c("ImageDecoder needs opset >=20 and one input/output");
518
+ let n = i.find((e) => e.name === "pixel_format") ?? {
519
+ kind: 3,
520
+ value: "RGB"
521
+ };
522
+ (i.some((e) => e.name !== "pixel_format") || n.kind !== 3 || ![
523
+ "RGB",
524
+ "BGR",
525
+ "Grayscale"
526
+ ].includes(n.value)) && c("ImageDecoder takes one attribute, pixel_format: RGB, BGR or Grayscale");
527
+ let r = this.#v(this.#S(t[0]));
528
+ r.dtype !== "uint8" && c("ImageDecoder needs a uint8 tensor");
529
+ let { decodeImagePixels: a } = await import("./onnx-image-D2qfYsXf.js"), o = await a(r.data, n.value);
530
+ return [this.#_(new u("uint8", o.data, o.shape), d.owned)];
531
+ }
514
532
  case "SequenceMap": {
515
533
  (s[""] ?? 1) < 17 && c("SequenceMap requires opset >=17");
516
534
  let r = h(t[0]), a = _("body");
@@ -522,7 +540,7 @@ var g = class {
522
540
  try {
523
541
  for (let e = 0; e < r.length; e++) {
524
542
  let n = new Map(o);
525
- t.forEach((t, r) => n.set(a.inputs[r].name, Array.isArray(t) ? t[e] : t)), (await this.#P(a, n, s, l, d, f + 1, p)).forEach((e, t) => u[t].push(e)), this.#j(d);
543
+ t.forEach((t, r) => n.set(a.inputs[r].name, Array.isArray(t) ? t[e] : t)), (await this.#F(a, n, s, l, d, f + 1, p)).forEach((e, t) => u[t].push(e)), this.#j(d);
526
544
  }
527
545
  return u.map((e, t) => this.#C(e, a.outputs[t].type?.kind));
528
546
  } finally {
@@ -600,7 +618,7 @@ var g = class {
600
618
  if (h >= d.max) throw n("failed", "ONNX Loop reached maxIterations; increase its explicit safety bound", "compute");
601
619
  let t = new Map(o);
602
620
  t.set(e.inputs[0].name, y("int64", h)), t.set(e.inputs[1].name, y("bool", Number(a))), i.forEach((n, r) => t.set(e.inputs[r + 2].name, n));
603
- let c = await this.#P(e, t, s, l, d, f + 1, p);
621
+ let c = await this.#F(e, t, s, l, d, f + 1, p);
604
622
  a = v(c[0]), i = c.slice(1, 1 + r.length), m.forEach((e, t) => e.push(c[1 + r.length + t])), g.set("current", i), this.#j(d), h++;
605
623
  }
606
624
  return [...i, ...m.map((t, n) => t.length ? this.#D(t, 0, !0, d) : this.#A(e.outputs[1 + r.length + n].type, 0, d))];
@@ -609,27 +627,29 @@ var g = class {
609
627
  }
610
628
  }
611
629
  case "Scan": {
612
- let e = _("body"), r = m("num_scan_inputs", 0);
613
- (r < 1 || r > t.length) && c("Scan num_scan_inputs must identify its final inputs");
614
- let a = t.length - r, u = t.slice(0, a), h = t.slice(a);
615
- (e.inputs.length !== t.length || e.outputs.length < a) && c("Scan body input/output count differs");
616
- let g = this.#k(i, "scan_input_axes") ?? Array(r).fill(0), v = this.#k(i, "scan_input_directions") ?? Array(r).fill(0), y = e.outputs.length - a, b = this.#k(i, "scan_output_axes") ?? Array(y).fill(0), x = this.#k(i, "scan_output_directions") ?? Array(y).fill(0);
617
- (g.length !== r || v.length !== r || b.length !== y || x.length !== y || [...v, ...x].some((e) => e !== 0 && e !== 1)) && c("Scan axes/direction lists have invalid lengths or flags");
618
- let S = h.map((e, t) => {
619
- let n = this.#T(e).shape, r = g[t] < 0 ? g[t] + n.length : g[t];
620
- return (r < 0 || r >= n.length) && c("Scan input axis is outside its rank"), g[t] = r, n[r];
630
+ let r = s[""] ?? 1;
631
+ if (r < 8 && c("Scan needs opset >=8"), r === 8) return this.#P(e, t, i, o, s, l, d, f, p);
632
+ let a = _("body"), u = m("num_scan_inputs", 0);
633
+ (u < 1 || u > t.length) && c("Scan num_scan_inputs must identify its final inputs");
634
+ let h = t.length - u, g = t.slice(0, h), v = t.slice(h);
635
+ (a.inputs.length !== t.length || a.outputs.length < h) && c("Scan body input/output count differs");
636
+ let y = this.#k(i, "scan_input_axes") ?? Array(u).fill(0), b = this.#k(i, "scan_input_directions") ?? Array(u).fill(0), x = a.outputs.length - h, S = this.#k(i, "scan_output_axes") ?? Array(x).fill(0), C = this.#k(i, "scan_output_directions") ?? Array(x).fill(0);
637
+ (y.length !== u || b.length !== u || S.length !== x || C.length !== x || [...b, ...C].some((e) => e !== 0 && e !== 1)) && c("Scan axes/direction lists have invalid lengths or flags");
638
+ let w = v.map((e, t) => {
639
+ let n = this.#T(e).shape, r = y[t] < 0 ? y[t] + n.length : y[t];
640
+ return (r < 0 || r >= n.length) && c("Scan input axis is outside its rank"), y[t] = r, n[r];
621
641
  });
622
- if (S.some((e) => e !== S[0]) && c("Scan input axis lengths differ"), S[0] > d.max) throw n("failed", "ONNX Scan exceeds maxIterations; increase its explicit safety bound", "compute");
623
- let C = Array.from({ length: y }, () => []), w = /* @__PURE__ */ new Map([["current", u], ["scanned", C]]);
624
- d.frames.push(w);
642
+ if (w.some((e) => e !== w[0]) && c("Scan input axis lengths differ"), w[0] > d.max) throw n("failed", "ONNX Scan exceeds maxIterations; increase its explicit safety bound", "compute");
643
+ let T = Array.from({ length: x }, () => []), E = /* @__PURE__ */ new Map([["current", g], ["scanned", T]]);
644
+ d.frames.push(E);
625
645
  try {
626
- for (let t = 0; t < S[0]; t++) {
627
- let n = new Map(o);
628
- u.forEach((t, r) => n.set(e.inputs[r].name, t)), h.forEach((r, i) => n.set(e.inputs[a + i].name, this.#E(r, g[i], v[i] ? S[i] - 1 - t : t, !1, d)));
629
- let r = await this.#P(e, n, s, l, d, f + 1, p);
630
- u = r.slice(0, a), C.forEach((e, t) => e.push(r[a + t])), w.set("current", u), this.#j(d);
646
+ for (let e = 0; e < w[0]; e++) {
647
+ let t = new Map(o);
648
+ g.forEach((e, n) => t.set(a.inputs[n].name, e)), v.forEach((n, r) => t.set(a.inputs[h + r].name, this.#E(n, y[r], b[r] ? w[r] - 1 - e : e, !1, d)));
649
+ let n = await this.#F(a, t, s, l, d, f + 1, p);
650
+ g = n.slice(0, h), T.forEach((e, t) => e.push(n[h + t])), E.set("current", g), this.#j(d);
631
651
  }
632
- return [...u, ...C.map((t, n) => t.length ? this.#D(x[n] ? [...t].reverse() : t, b[n], !0, d) : this.#A(e.outputs[a + n].type, b[n], d))];
652
+ return [...g, ...T.map((e, t) => e.length ? this.#D(C[t] ? [...e].reverse() : e, S[t], !0, d) : this.#A(a.outputs[h + t].type, S[t], d))];
633
653
  } finally {
634
654
  d.frames.pop();
635
655
  }
@@ -637,6 +657,54 @@ var g = class {
637
657
  default: return;
638
658
  }
639
659
  }
660
+ async #P(e, t, r, i, a, o, s, l, u) {
661
+ let d = r.find((e) => e.name === "body");
662
+ (!d || d.kind !== 5) && c("Scan requires graph attribute body"), r.some((e) => ![
663
+ "body",
664
+ "directions",
665
+ "num_scan_inputs"
666
+ ].includes(e.name)) && c("unknown Scan opset 8 attribute");
667
+ let f = d.value, p = this.#O(r, "num_scan_inputs", 0);
668
+ (p < 1 || p > t.length - 1) && c("Scan num_scan_inputs must identify its final inputs");
669
+ let m = t.length - 1 - p, h = t.slice(1, 1 + m), g = t.slice(1 + m), _ = e.outputs.length - m;
670
+ (f.inputs.length !== m + p || _ < 0 || f.outputs.length !== e.outputs.length) && c("Scan body input/output count differs");
671
+ let v = this.#k(r, "directions") ?? Array(p).fill(0);
672
+ (v.length !== p || v.some((e) => e !== 0 && e !== 1)) && c("Scan directions must hold one 0 or 1 per scan input");
673
+ let [y, b] = this.#T(g[0]).shape;
674
+ (!y || !b) && c("Scan opset 8 needs at least one batch and one sequence step");
675
+ for (let e of g) {
676
+ let { shape: t } = this.#T(e);
677
+ (t[0] !== y || t[1] !== b) && c("Scan batch or sequence lengths differ");
678
+ }
679
+ for (let e of h) this.#T(e).shape[0] !== y && c("Scan states need the batch size of the scan inputs");
680
+ let x = Array(y).fill(b);
681
+ if (t[0] !== null) {
682
+ let e = this.#v(this.#S(t[0]));
683
+ (e.dtype !== "int64" && e.dtype !== "int32" || e.shape.length !== 1 || e.shape[0] !== y) && c("Scan sequence_lens must be an int32 or int64 vector with one length per batch"), x = Array.from(e.data, Number), x.some((e) => e < 0 || e > b) && c("Scan sequence_lens must lie in 0..the sequence length");
684
+ }
685
+ if (y * b > s.max) throw n("failed", "ONNX Scan exceeds maxIterations; increase its explicit safety bound", "compute");
686
+ let S = h.map(() => []), C = Array.from({ length: _ }, () => []), w = /* @__PURE__ */ new Map([["finals", S], ["stacked", C]]);
687
+ s.frames.push(w);
688
+ try {
689
+ for (let e = 0; e < y; e++) {
690
+ let t = h.map((t) => this.#E(t, 0, e, !1, s)), n = g.map((t) => this.#E(t, 0, e, !1, s)), r = Array.from({ length: _ }, () => []), c = x[e];
691
+ w.set("current", t).set("rows", n).set("scanned", r);
692
+ for (let e = 0; e < b; e++) {
693
+ let d = new Map(i);
694
+ t.forEach((e, t) => d.set(f.inputs[t].name, e)), n.forEach((t, n) => {
695
+ let r = v[n] && e < c ? c - 1 - e : e;
696
+ d.set(f.inputs[m + n].name, this.#E(t, 0, r, !1, s));
697
+ });
698
+ let p = await this.#F(f, d, a, o, s, l + 1, u);
699
+ e < c && (t = p.slice(0, m)), r.forEach((e, t) => e.push(p[m + t])), w.set("current", t), this.#j(s);
700
+ }
701
+ t.forEach((e, t) => S[t].push(e)), r.forEach((e, t) => C[t].push(this.#D(e, 0, !0, s)));
702
+ }
703
+ return [...S, ...C].map((e) => this.#D(e, 0, !0, s));
704
+ } finally {
705
+ s.frames.pop();
706
+ }
707
+ }
640
708
  async run(e, t = {}) {
641
709
  if (this.#u(), d(t.signal), this.#l) throw n("failed", "ONNX session is already running; await its run or use another session", "compute");
642
710
  let r = t.maxIterations ?? 1e4, i = t.maxNodes ?? 1e6, a = t.yieldEvery ?? 16;
@@ -660,7 +728,7 @@ var g = class {
660
728
  nodes: 0,
661
729
  symbols: l,
662
730
  frames: []
663
- }, d = await this.#P(this.#t.graph, n, this.#t.opsets, [], u, 0, ""), f = Object.create(null);
731
+ }, d = await this.#F(this.#t.graph, n, this.#t.opsets, [], u, 0, ""), f = Object.create(null);
664
732
  for (let e of o) {
665
733
  let t = this.outputs.findIndex((t) => t.name === e);
666
734
  f[e] = this.#b(d[t]);
@@ -671,7 +739,7 @@ var g = class {
671
739
  this.#l = !1;
672
740
  }
673
741
  }
674
- async #P(e, t, r, i, a, o, s) {
742
+ async #F(e, t, r, i, a, o, s) {
675
743
  o > 64 && c("runtime graph nesting exceeds 64");
676
744
  let l = new Map(t);
677
745
  for (let t of e.initializers) (!l.has(t.name) || !e.inputs.some((e) => e.name === t.name)) && l.set(t.name, t.id);
@@ -695,7 +763,7 @@ var g = class {
695
763
  if (g) {
696
764
  for (let e of g.requiredAttributes) !m.attrs.some((t) => t.name === e) && !g.defaults.some((t) => t.name === e) && c(`function ${g.name} is missing attribute ${e}`);
697
765
  let t = new Map(g.inputs.map((e, t) => [e, f[t]]));
698
- _ = await this.#P({
766
+ _ = await this.#F({
699
767
  name: g.name,
700
768
  nodes: g.nodes,
701
769
  inputs: g.inputs.map((e) => ({
@@ -714,7 +782,7 @@ var g = class {
714
782
  let n = !!this.#f(this.#e.scalar_bool(t)), s = m.attrs.find((e) => e.name === (n ? "then_branch" : "else_branch"));
715
783
  (!s || s.kind !== 5) && c("If requires then_branch and else_branch graphs");
716
784
  let u = s.value;
717
- u.inputs.length && c("If branch graphs must capture values rather than declare inputs"), _ = await this.#P(u, l, r, i, a, o + 1, e);
785
+ u.inputs.length && c("If branch graphs must capture values rather than declare inputs"), _ = await this.#F(u, l, r, i, a, o + 1, e);
718
786
  } else if ((_ = await this.#N(t, f, m.attrs, l, r, i, a, o, e)) === void 0) {
719
787
  f.some((e) => e !== null && typeof e != "number") && c(`${t.op} needs tensor inputs`);
720
788
  let n = r[t.domain === "ai.onnx" ? "" : t.domain] ?? 1;
package/dist/random.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as e, r as t } from "./errors-CDgOgzCd.js";
2
- import { o as n } from "./expr-DwFen60A.js";
3
- import { r } from "./array-DbI848Wf.js";
2
+ import { o as n } from "./expr-t3jm8acM.js";
3
+ import { r } from "./array-C29noZq7.js";
4
4
  //#region src/random.ts
5
5
  var i = {
6
6
  M0: 3528531795,
package/dist/shape.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as e, r as t } from "./errors-CDgOgzCd.js";
2
- import { m as n, n as r, t as i } from "./expr-DwFen60A.js";
3
- import { n as a } from "./array-DbI848Wf.js";
2
+ import { m as n, n as r, t as i } from "./expr-t3jm8acM.js";
3
+ import { n as a } from "./array-C29noZq7.js";
4
4
  //#region src/shape.ts
5
5
  var o = (e) => e.reduce((e, t) => e * t, 1), s = (e, t) => new i(e.context, {
6
6
  kind: "index",
package/dist/signal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as e, r as t } from "./errors-CDgOgzCd.js";
2
- import { n } from "./expr-DwFen60A.js";
3
- import { t as r } from "./array-DbI848Wf.js";
2
+ import { n } from "./expr-t3jm8acM.js";
3
+ import { t as r } from "./array-C29noZq7.js";
4
4
  import { fft as i, fft2 as a, ifft as o, ifft2 as s } from "./fft.js";
5
5
  //#region src/signal.ts
6
6
  var c = (e) => e instanceof r && e.dtype === "f32" && e.contiguous && e.offset === 0 ? {
package/dist/sparse.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as e, r as t, t as n } from "./errors-CDgOgzCd.js";
2
- import { n as r } from "./context-C75sQQra.js";
3
- import { n as i } from "./expr-DwFen60A.js";
4
- import { t as a } from "./array-DbI848Wf.js";
2
+ import { n as r } from "./context-CCvs3wkC.js";
3
+ import { n as i } from "./expr-t3jm8acM.js";
4
+ import { t as a } from "./array-C29noZq7.js";
5
5
  //#region src/sparse.ts
6
6
  var o = "struct Shape { rows: u32, pad0: u32, pad1: u32, pad2: u32 }\n@group(0) @binding(0) var<storage, read> rowPtr: array<u32>;\n@group(0) @binding(1) var<storage, read> colIdx: array<u32>;\n@group(0) @binding(2) var<storage, read> values: array<f32>;\n@group(0) @binding(3) var<storage, read> x: array<f32>;\n@group(0) @binding(4) var<storage, read_write> y: array<f32>;\n@group(0) @binding(5) var<uniform> shape: Shape;\n@compute @workgroup_size(256)\nfn main(@builtin(workgroup_id) wid: vec3u, @builtin(num_workgroups) nwg: vec3u, @builtin(local_invocation_index) lid: u32) {\n let r = (wid.x + wid.y * nwg.x) * 256u + lid;\n if (r >= shape.rows) { return; }\n var sum = 0.0;\n for (var k = rowPtr[r]; k < rowPtr[r + 1u]; k++) { sum += values[k] * x[colIdx[k]]; }\n y[r] = sum;\n}", s = "struct Shape { rows: u32, pad0: u32, pad1: u32, pad2: u32 }\n@group(0) @binding(0) var<storage, read> rowPtr: array<u32>;\n@group(0) @binding(1) var<storage, read> colIdx: array<u32>;\n@group(0) @binding(2) var<storage, read> values: array<f32>;\n@group(0) @binding(3) var<storage, read_write> d: array<f32>;\n@group(0) @binding(4) var<uniform> shape: Shape;\n@compute @workgroup_size(256)\nfn main(@builtin(workgroup_id) wid: vec3u, @builtin(num_workgroups) nwg: vec3u, @builtin(local_invocation_index) lid: u32) {\n let r = (wid.x + wid.y * nwg.x) * 256u + lid;\n if (r >= shape.rows) { return; }\n var v = 0.0;\n for (var k = rowPtr[r]; k < rowPtr[r + 1u]; k++) { if (colIdx[k] == r) { v += values[k]; } }\n d[r] = v;\n}", c = (e) => e instanceof a && e.dtype === "f32" && e.contiguous && e.offset === 0 ? {
7
7
  array: e,
package/dist/stream.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as e, r as t } from "./errors-CDgOgzCd.js";
2
- import { n } from "./context-C75sQQra.js";
2
+ import { n } from "./context-CCvs3wkC.js";
3
3
  //#region src/stream.ts
4
4
  function* r(t, n) {
5
5
  if (!Number.isInteger(n) || n < 1) throw e(`Chunk size must be a whole number of at least 1, got ${n}`, "compute");
package/package.json CHANGED
@@ -1,144 +1,148 @@
1
- {
2
- "name": "@margoengine/compute",
3
- "version": "0.1.0",
4
- "description": "GPU compute without the WebGPU boilerplate, NumPy style: N-d arrays with views and broadcasting, fused expressions, reductions and statistics, scan, sort, selection, histograms, matmul, FFT, convolution, random numbers, streaming, neural networks, graph algorithms, and WGSL kernels bound by name.",
5
- "keywords": [
6
- "margoengine",
7
- "webgpu",
8
- "gpgpu",
9
- "compute",
10
- "wgsl",
11
- "data-science"
12
- ],
13
- "homepage": "https://margoengine.com",
14
- "bugs": {
15
- "url": "https://github.com/scottcampbelldata/margoengine/issues"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/scottcampbelldata/margoengine.git",
20
- "directory": "packages/compute"
21
- },
22
- "license": "Apache-2.0",
23
- "author": "Scott Campbell",
24
- "type": "module",
25
- "sideEffects": false,
26
- "exports": {
27
- ".": {
28
- "types": "./dist/index.d.ts",
29
- "import": "./dist/index.js"
30
- },
31
- "./linalg": {
32
- "types": "./dist/linalg.d.ts",
33
- "import": "./dist/linalg.js"
34
- },
35
- "./fft": {
36
- "types": "./dist/fft.d.ts",
37
- "import": "./dist/fft.js"
38
- },
39
- "./signal": {
40
- "types": "./dist/signal.d.ts",
41
- "import": "./dist/signal.js"
42
- },
43
- "./random": {
44
- "types": "./dist/random.d.ts",
45
- "import": "./dist/random.js"
46
- },
47
- "./autodiff": {
48
- "types": "./dist/autodiff.d.ts",
49
- "import": "./dist/autodiff.js"
50
- },
51
- "./sparse": {
52
- "types": "./dist/sparse.d.ts",
53
- "import": "./dist/sparse.js"
54
- },
55
- "./stream": {
56
- "types": "./dist/stream.d.ts",
57
- "import": "./dist/stream.js"
58
- },
59
- "./frame": {
60
- "types": "./dist/frame.d.ts",
61
- "import": "./dist/frame.js"
62
- },
63
- "./subgroups": {
64
- "types": "./dist/subgroups.d.ts",
65
- "import": "./dist/subgroups.js"
66
- },
67
- "./nn": {
68
- "types": "./dist/nn.d.ts",
69
- "import": "./dist/nn.js"
70
- },
71
- "./graph": {
72
- "types": "./dist/graph.d.ts",
73
- "import": "./dist/graph.js"
74
- },
75
- "./autotune": {
76
- "types": "./dist/autotune.d.ts",
77
- "import": "./dist/autotune.js"
78
- },
79
- "./shape": {
80
- "types": "./dist/shape.d.ts",
81
- "import": "./dist/shape.js"
82
- },
83
- "./decomp": {
84
- "types": "./dist/decomp.d.ts",
85
- "import": "./dist/decomp.js"
86
- },
87
- "./cpu-wasm": {
88
- "types": "./dist/cpu-wasm.d.ts",
89
- "import": "./dist/cpu-wasm.js"
90
- },
91
- "./nn-extra": {
92
- "types": "./dist/nn-extra.d.ts",
93
- "import": "./dist/nn-extra.js"
94
- },
95
- "./onnx": {
96
- "types": "./dist/onnx.d.ts",
97
- "import": "./dist/onnx.js"
98
- },
99
- "./quant": {
100
- "types": "./dist/quant.d.ts",
101
- "import": "./dist/quant.js"
102
- },
103
- "./distance": {
104
- "types": "./dist/distance.d.ts",
105
- "import": "./dist/distance.js"
106
- }
107
- },
108
- "files": [
109
- "dist",
110
- "LICENSE",
111
- "NOTICE"
112
- ],
113
- "publishConfig": {
114
- "access": "public"
115
- },
116
- "peerDependencies": {
117
- "@margoengine/core": "^0.1.0"
118
- },
119
- "peerDependenciesMeta": {
120
- "@margoengine/core": {
121
- "optional": true
122
- }
123
- },
124
- "scripts": {
125
- "build": "node ../../scripts/build-optional.js compute && node scripts/copy-decomp.mjs",
126
- "test": "npm run build && node --test tests/*.test.js",
127
- "test:browser": "npm run build && node tests/compute-browser.mjs",
128
- "test:browser:spec-math": "npm run build && node tests/compute-browser.mjs --spec-math-error=1",
129
- "test:browser:reassociate": "npm run build && node tests/compute-browser.mjs --reassociate-math",
130
- "test:browser:sweep": "npm run build && node tests/compute-precise-sweep.mjs",
131
- "test:gpu:owners": "cd ../.. && node packages/compute/tests/scene-owner-browser.mjs",
132
- "prepack": "npm run build",
133
- "test:browser:shape": "cd ../.. && node packages/compute/tests/shape-browser.mjs",
134
- "test:browser:decomp": "cd ../.. && node packages/compute/tests/decomp-browser.mjs",
135
- "build:decomp": "node scripts/build-decomp.mjs",
136
- "build:cpu-wasm": "node scripts/build-cpu.mjs",
137
- "test:browser:cpu-wasm": "cd ../.. && node packages/compute/tests/cpu-wasm-browser.mjs",
138
- "test:browser:nn-extra": "cd ../.. && node packages/compute/tests/nn-extra-browser.mjs",
139
- "build:onnx": "node scripts/build-onnx.mjs",
140
- "test:browser:onnx-wasm": "cd ../.. && node packages/compute/tests/onnx-browser.mjs",
141
- "test:browser:quant": "cd ../.. && node packages/compute/tests/quant-browser.mjs",
142
- "test:browser:distance": "cd ../.. && node packages/compute/tests/distance-browser.mjs"
143
- }
144
- }
1
+ {
2
+ "name": "@margoengine/compute",
3
+ "version": "1.0.0",
4
+ "description": "GPU compute without the WebGPU boilerplate, NumPy style: N-d arrays with views and broadcasting, fused expressions, reductions and statistics, scan, sort, selection, histograms, matmul, FFT, convolution, random numbers, streaming, neural networks, graph algorithms, and WGSL kernels bound by name.",
5
+ "keywords": [
6
+ "margoengine",
7
+ "webgpu",
8
+ "gpgpu",
9
+ "compute",
10
+ "wgsl",
11
+ "data-science"
12
+ ],
13
+ "homepage": "https://margoengine.com",
14
+ "bugs": {
15
+ "url": "https://github.com/scottcampbelldata/margoengine/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/scottcampbelldata/margoengine.git",
20
+ "directory": "packages/compute"
21
+ },
22
+ "license": "Apache-2.0",
23
+ "author": "Scott Campbell",
24
+ "type": "module",
25
+ "sideEffects": false,
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
30
+ },
31
+ "./linalg": {
32
+ "types": "./dist/linalg.d.ts",
33
+ "import": "./dist/linalg.js"
34
+ },
35
+ "./fft": {
36
+ "types": "./dist/fft.d.ts",
37
+ "import": "./dist/fft.js"
38
+ },
39
+ "./signal": {
40
+ "types": "./dist/signal.d.ts",
41
+ "import": "./dist/signal.js"
42
+ },
43
+ "./random": {
44
+ "types": "./dist/random.d.ts",
45
+ "import": "./dist/random.js"
46
+ },
47
+ "./autodiff": {
48
+ "types": "./dist/autodiff.d.ts",
49
+ "import": "./dist/autodiff.js"
50
+ },
51
+ "./sparse": {
52
+ "types": "./dist/sparse.d.ts",
53
+ "import": "./dist/sparse.js"
54
+ },
55
+ "./stream": {
56
+ "types": "./dist/stream.d.ts",
57
+ "import": "./dist/stream.js"
58
+ },
59
+ "./frame": {
60
+ "types": "./dist/frame.d.ts",
61
+ "import": "./dist/frame.js"
62
+ },
63
+ "./subgroups": {
64
+ "types": "./dist/subgroups.d.ts",
65
+ "import": "./dist/subgroups.js"
66
+ },
67
+ "./nn": {
68
+ "types": "./dist/nn.d.ts",
69
+ "import": "./dist/nn.js"
70
+ },
71
+ "./graph": {
72
+ "types": "./dist/graph.d.ts",
73
+ "import": "./dist/graph.js"
74
+ },
75
+ "./autotune": {
76
+ "types": "./dist/autotune.d.ts",
77
+ "import": "./dist/autotune.js"
78
+ },
79
+ "./shape": {
80
+ "types": "./dist/shape.d.ts",
81
+ "import": "./dist/shape.js"
82
+ },
83
+ "./decomp": {
84
+ "types": "./dist/decomp.d.ts",
85
+ "import": "./dist/decomp.js"
86
+ },
87
+ "./cpu-wasm": {
88
+ "types": "./dist/cpu-wasm.d.ts",
89
+ "import": "./dist/cpu-wasm.js"
90
+ },
91
+ "./nn-extra": {
92
+ "types": "./dist/nn-extra.d.ts",
93
+ "import": "./dist/nn-extra.js"
94
+ },
95
+ "./onnx": {
96
+ "types": "./dist/onnx.d.ts",
97
+ "import": "./dist/onnx.js"
98
+ },
99
+ "./quant": {
100
+ "types": "./dist/quant.d.ts",
101
+ "import": "./dist/quant.js"
102
+ },
103
+ "./distance": {
104
+ "types": "./dist/distance.d.ts",
105
+ "import": "./dist/distance.js"
106
+ }
107
+ },
108
+ "files": [
109
+ "dist",
110
+ "LICENSE",
111
+ "NOTICE"
112
+ ],
113
+ "publishConfig": {
114
+ "access": "public"
115
+ },
116
+ "peerDependencies": {
117
+ "@margoengine/core": "^1.0.0",
118
+ "@margoengine/decoders": "^1.0.0"
119
+ },
120
+ "peerDependenciesMeta": {
121
+ "@margoengine/core": {
122
+ "optional": true
123
+ },
124
+ "@margoengine/decoders": {
125
+ "optional": true
126
+ }
127
+ },
128
+ "scripts": {
129
+ "build": "node ../../scripts/build-optional.js compute && node scripts/copy-decomp.mjs",
130
+ "test": "npm run build && node --test tests/*.test.js",
131
+ "test:browser": "npm run build && node tests/compute-browser.mjs",
132
+ "test:browser:spec-math": "npm run build && node tests/compute-browser.mjs --spec-math-error=1",
133
+ "test:browser:reassociate": "npm run build && node tests/compute-browser.mjs --reassociate-math",
134
+ "test:browser:sweep": "npm run build && node tests/compute-precise-sweep.mjs",
135
+ "test:gpu:owners": "cd ../.. && node packages/compute/tests/scene-owner-browser.mjs",
136
+ "prepack": "npm run build",
137
+ "test:browser:shape": "cd ../.. && node packages/compute/tests/shape-browser.mjs",
138
+ "test:browser:decomp": "cd ../.. && node packages/compute/tests/decomp-browser.mjs",
139
+ "build:decomp": "node scripts/build-decomp.mjs",
140
+ "build:cpu-wasm": "node scripts/build-cpu.mjs",
141
+ "test:browser:cpu-wasm": "cd ../.. && node packages/compute/tests/cpu-wasm-browser.mjs",
142
+ "test:browser:nn-extra": "cd ../.. && node packages/compute/tests/nn-extra-browser.mjs",
143
+ "build:onnx": "node scripts/build-onnx.mjs",
144
+ "test:browser:onnx-wasm": "cd ../.. && node packages/compute/tests/onnx-browser.mjs",
145
+ "test:browser:quant": "cd ../.. && node packages/compute/tests/quant-browser.mjs",
146
+ "test:browser:distance": "cd ../.. && node packages/compute/tests/distance-browser.mjs"
147
+ }
148
+ }