@margoengine/compute 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +736 -3
- package/dist/array-DbI848Wf.js +166 -0
- package/dist/array.d.ts +109 -0
- package/dist/autodiff.d.ts +22 -0
- package/dist/autodiff.js +143 -0
- package/dist/autotune.d.ts +100 -0
- package/dist/autotune.js +179 -0
- package/dist/compat-YK57ZCbA.js +4 -0
- package/dist/compat.d.ts +2 -0
- package/dist/context-C75sQQra.js +2470 -0
- package/dist/context.d.ts +368 -0
- package/dist/cpu-CdVdqP4I.js +871 -0
- package/dist/cpu-kernel.wasm +0 -0
- package/dist/cpu-load-aTmfphVu.js +5 -0
- package/dist/cpu-load.d.ts +3 -0
- package/dist/cpu-runtime.d.ts +8 -0
- package/dist/cpu-wasm.d.ts +42 -0
- package/dist/cpu-wasm.js +161 -0
- package/dist/cpu.d.ts +138 -0
- package/dist/decomp-kernel.wasm +0 -0
- package/dist/decomp.d.ts +42 -0
- package/dist/decomp.js +158 -0
- package/dist/distance.d.ts +85 -0
- package/dist/distance.js +256 -0
- package/dist/dtype.d.ts +36 -0
- package/dist/errors-CDgOgzCd.js +7 -0
- package/dist/expr-DwFen60A.js +995 -0
- package/dist/expr.d.ts +196 -0
- package/dist/fft.d.ts +33 -0
- package/dist/fft.js +168 -0
- package/dist/frame.d.ts +63 -0
- package/dist/frame.js +82 -0
- package/dist/graph.d.ts +75 -0
- package/dist/graph.js +174 -0
- package/dist/histogram.d.ts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +4 -0
- package/dist/kernel.d.ts +65 -0
- package/dist/linalg.d.ts +21 -0
- package/dist/linalg.js +149 -0
- package/dist/nn-extra.d.ts +130 -0
- package/dist/nn-extra.js +322 -0
- package/dist/nn.d.ts +385 -0
- package/dist/nn.js +704 -0
- package/dist/onnx-kernel.wasm +0 -0
- package/dist/onnx.d.ts +164 -0
- package/dist/onnx.js +817 -0
- package/dist/quant.d.ts +59 -0
- package/dist/quant.js +242 -0
- package/dist/random.d.ts +64 -0
- package/dist/random.js +150 -0
- package/dist/reduce.d.ts +34 -0
- package/dist/scan.d.ts +26 -0
- package/dist/select.d.ts +38 -0
- package/dist/shaders.d.ts +80 -0
- package/dist/shape.d.ts +23 -0
- package/dist/shape.js +134 -0
- package/dist/signal.d.ts +29 -0
- package/dist/signal.js +178 -0
- package/dist/sort.d.ts +38 -0
- package/dist/sparse.d.ts +136 -0
- package/dist/sparse.js +273 -0
- package/dist/stream.d.ts +39 -0
- package/dist/stream.js +100 -0
- package/dist/subgroups.d.ts +27 -0
- package/dist/subgroups.js +191 -0
- package/dist/usingCtx-igdMnAhr.js +57 -0
- package/dist/wgsl.d.ts +68 -0
- package/package.json +144 -6
package/dist/wgsl.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** The layout of a WGSL type in host-shareable memory (WGSL 13.4). */
|
|
2
|
+
export interface TypeLayout {
|
|
3
|
+
/** The type as written after alias resolution, such as `vec3<f32>` or `Params`. */
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly kind: 'scalar' | 'vector' | 'matrix' | 'array' | 'struct' | 'atomic';
|
|
6
|
+
readonly align: number;
|
|
7
|
+
/** Size in bytes; for a runtime-sized array, the size of one element stride (count it per element). */
|
|
8
|
+
readonly size: number;
|
|
9
|
+
/** Scalar component type for scalars, vectors, matrices and atomics. */
|
|
10
|
+
readonly scalar?: 'f32' | 'i32' | 'u32' | 'f16';
|
|
11
|
+
/** Vector width, or a matrix's row count. */
|
|
12
|
+
readonly rows?: number;
|
|
13
|
+
/** A matrix's column count. */
|
|
14
|
+
readonly columns?: number;
|
|
15
|
+
/** An array's element layout and stride; `count` 0 for a runtime-sized array. */
|
|
16
|
+
readonly element?: TypeLayout;
|
|
17
|
+
readonly stride?: number;
|
|
18
|
+
readonly count?: number;
|
|
19
|
+
/** A struct's members with their byte offsets. */
|
|
20
|
+
readonly members?: readonly {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly offset: number;
|
|
23
|
+
readonly layout: TypeLayout;
|
|
24
|
+
}[];
|
|
25
|
+
}
|
|
26
|
+
/** One `@group @binding` resource a module declares. */
|
|
27
|
+
export interface BindingInfo {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly group: number;
|
|
30
|
+
readonly binding: number;
|
|
31
|
+
/** Resource kind as a bind group layout entry needs it. */
|
|
32
|
+
readonly resource: 'uniform' | 'storage' | 'read-only-storage' | 'texture' | 'storage-texture' | 'sampler';
|
|
33
|
+
/** The declared type as written. */
|
|
34
|
+
readonly type: string;
|
|
35
|
+
/** Layout of a buffer binding's type (absent for textures and samplers, or when a type cannot be resolved). */
|
|
36
|
+
readonly layout?: TypeLayout;
|
|
37
|
+
/** Texture details: view dimension, sample type, storage format and access. */
|
|
38
|
+
readonly texture?: {
|
|
39
|
+
readonly viewDimension: GPUTextureViewDimension;
|
|
40
|
+
readonly sampleType?: GPUTextureSampleType;
|
|
41
|
+
readonly multisampled?: boolean;
|
|
42
|
+
readonly format?: GPUTextureFormat;
|
|
43
|
+
readonly access?: GPUStorageTextureAccess;
|
|
44
|
+
};
|
|
45
|
+
/** A sampler's type: `filtering` for `sampler`, `comparison` for `sampler_comparison`. */
|
|
46
|
+
readonly sampler?: GPUSamplerBindingType;
|
|
47
|
+
}
|
|
48
|
+
/** One `@compute` entry point. */
|
|
49
|
+
export interface EntryPointInfo {
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly workgroupSize: readonly [number, number, number];
|
|
52
|
+
}
|
|
53
|
+
/** What a WGSL module declares at module scope. */
|
|
54
|
+
export interface ModuleInfo {
|
|
55
|
+
readonly bindings: readonly BindingInfo[];
|
|
56
|
+
readonly entryPoints: readonly EntryPointInfo[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Reads a WGSL module's resource bindings (with buffer layouts) and compute entry points (with workgroup sizes).
|
|
60
|
+
* Throws a TypeError for a declaration it cannot read, such as a binding whose group or index is not a literal.
|
|
61
|
+
*/
|
|
62
|
+
export declare function reflectWGSL(code: string): ModuleInfo;
|
|
63
|
+
/** A value a uniform or storage struct field accepts: a number, a vector or matrix as numbers, or nested values. */
|
|
64
|
+
export type HostValue = number | boolean | ArrayLike<number> | readonly HostValue[] | {
|
|
65
|
+
readonly [key: string]: HostValue;
|
|
66
|
+
};
|
|
67
|
+
/** Encodes `value` as host-shareable bytes laid out as `layout` (rounded up to 16 bytes, the uniform minimum). */
|
|
68
|
+
export declare function encode(layout: TypeLayout, value: HostValue, name?: string): Uint8Array<ArrayBuffer>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,144 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@margoengine/compute",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
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
|
+
}
|