diff --git a/.gitignore b/.gitignore index 2bab528..09a8a9a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ Gemfile.lock .DS_Store .backup_*/ vendor/bundle/ +node_modules/ diff --git a/binop.mjs b/binop.mjs index 90979ea..9292fd7 100644 --- a/binop.mjs +++ b/binop.mjs @@ -13,7 +13,7 @@ * {inclusive, exclusive}-scans across a subgroup */ -class BinOp { +export class BinOp { constructor(args) { // no defaults! if something is undefined, go with it Object.assign(this, args); diff --git a/index.d.ts b/index.d.ts index c1593ba..53d75d9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -24,6 +24,42 @@ export class BasePrimitive { registerBuffer(args: { label: string; buffer: any; device?: GPUDevice }): void; } +export class Kernel { + label: string; + kernel: string | ((args?: { [key: string]: any }) => string); + + constructor( + args: + | ((args?: { [key: string]: any }) => string) + | { + kernel: string | ((args?: { [key: string]: any }) => string); + label?: string; + [key: string]: any; + } + ); + + enabled(): boolean; +} + +export class AllocateBuffer { + label: string; + size: number; + + constructor(args: { + label: string; + size: number; + usage?: number; + [key: string]: any; + }); +} + +export class WriteGPUBuffer { + label: string; + cpuSource: any; + + constructor(args: { label: string; cpuSource: any; [key: string]: any }); +} + export class Buffer { label: string; device: GPUDevice; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..c1d6b22 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,60 @@ +{ + "name": "gridwise", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "gridwise", + "version": "0.1.0", + "license": "Apache-2.0", + "devDependencies": { + "webgpu": "^0.4.0" + } + }, + "node_modules/@webgpu/types": { + "version": "0.1.71", + "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.71.tgz", + "integrity": "sha512-mMy8/ODcKhab808co15eW+yN+HgXoQxRQHTiBV9Mrvl1r0ufnid7YOcI+gi4eUWSWl9ezD6TW2KXccrL8HCh2A==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/webgpu": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/webgpu/-/webgpu-0.4.0.tgz", + "integrity": "sha512-F5pimn3Aoi0zWjuRdiVs5TnrUwSzD2lESBohsIUsqyitWkGRQlXU2fhV6ycXlQTa1bvAf3sjqiUpBEpmSQ5ptA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@webgpu/types": "^0.1.69", + "debug": "^4.4.0" + } + } + } +} diff --git a/package.json b/package.json index 131e3de..5c6bcaa 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,10 @@ "main": "./index.mjs", "types": "./index.d.ts", "exports": { - ".": "./index.mjs" + ".": { + "types": "./index.d.ts", + "import": "./index.mjs" + } }, "scripts": { "test:node": "node examples/regression_node.mjs", @@ -33,6 +36,7 @@ "datatype.mjs", "LICENSE.txt" ], + "sideEffects": false, "repository": { "type": "git", "url": "git+https://github.com/gridwise-js/gridwise.git" @@ -48,7 +52,6 @@ "reduce", "gpgpu" ], - "author": "", "license": "Apache-2.0", "bugs": { "url": "https://github.com/gridwise-js/gridwise/issues"