@simulatte/webgpu 0.3.0 → 0.3.2
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/CHANGELOG.md +37 -10
- package/LICENSE +191 -0
- package/README.md +62 -48
- package/api-contract.md +67 -49
- package/architecture.md +317 -0
- package/assets/package-layers.svg +3 -3
- package/docs/doe-api-reference.html +1842 -0
- package/doe-api-design.md +237 -0
- package/examples/doe-api/README.md +19 -0
- package/examples/doe-api/buffers-readback.js +3 -2
- package/examples/{doe-routines/compute-once-like-input.js → doe-api/compute-one-shot-like-input.js} +1 -1
- package/examples/{doe-routines/compute-once-matmul.js → doe-api/compute-one-shot-matmul.js} +2 -2
- package/examples/{doe-routines/compute-once-multiple-inputs.js → doe-api/compute-one-shot-multiple-inputs.js} +1 -1
- package/examples/{doe-routines/compute-once.js → doe-api/compute-one-shot.js} +1 -1
- package/examples/doe-api/{compile-and-dispatch.js → kernel-create-and-dispatch.js} +4 -6
- package/examples/doe-api/{compute-dispatch.js → kernel-run.js} +4 -6
- package/headless-webgpu-comparison.md +3 -3
- package/jsdoc-style-guide.md +435 -0
- package/native/doe_napi.c +1481 -84
- package/package.json +18 -6
- package/prebuilds/darwin-arm64/doe_napi.node +0 -0
- package/prebuilds/darwin-arm64/libwebgpu_doe.dylib +0 -0
- package/prebuilds/darwin-arm64/metadata.json +5 -5
- package/prebuilds/linux-x64/metadata.json +1 -1
- package/scripts/generate-doe-api-docs.js +1607 -0
- package/scripts/generate-readme-assets.js +3 -3
- package/src/build_metadata.js +7 -4
- package/src/bun-ffi.js +1229 -474
- package/src/bun.js +5 -1
- package/src/compute.d.ts +16 -7
- package/src/compute.js +84 -53
- package/src/full.d.ts +16 -7
- package/src/full.js +12 -10
- package/src/index.js +679 -1324
- package/src/runtime_cli.js +17 -17
- package/src/shared/capabilities.js +144 -0
- package/src/shared/compiler-errors.js +78 -0
- package/src/shared/encoder-surface.js +295 -0
- package/src/shared/full-surface.js +514 -0
- package/src/shared/public-surface.js +82 -0
- package/src/shared/resource-lifecycle.js +120 -0
- package/src/shared/validation.js +495 -0
- package/src/webgpu_constants.js +30 -0
- package/support-contracts.md +2 -2
- package/compat-scope.md +0 -46
- package/layering-plan.md +0 -259
- package/src/auto_bind_group_layout.js +0 -32
- package/src/doe.d.ts +0 -184
- package/src/doe.js +0 -641
- package/zig-source-inventory.md +0 -468
package/src/bun.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ffi from "./bun-ffi.js";
|
|
2
2
|
import * as full from "./full.js";
|
|
3
|
-
import { createDoeNamespace } from "
|
|
3
|
+
import { createDoeNamespace } from "@simulatte/webgpu-doe";
|
|
4
4
|
|
|
5
5
|
const runtime = process.platform === "linux" ? ffi : full;
|
|
6
6
|
|
|
@@ -14,10 +14,14 @@ export const setupGlobals = runtime.setupGlobals;
|
|
|
14
14
|
export const requestAdapter = runtime.requestAdapter;
|
|
15
15
|
export const requestDevice = runtime.requestDevice;
|
|
16
16
|
export const providerInfo = runtime.providerInfo;
|
|
17
|
+
export const preflightShaderSource = runtime.preflightShaderSource ?? full.preflightShaderSource;
|
|
18
|
+
export const setNativeTimeoutMs = runtime.setNativeTimeoutMs ?? full.setNativeTimeoutMs;
|
|
17
19
|
export const createDoeRuntime = runtime.createDoeRuntime;
|
|
18
20
|
export const runDawnVsDoeCompare = runtime.runDawnVsDoeCompare;
|
|
19
21
|
|
|
20
22
|
export default {
|
|
21
23
|
...runtime,
|
|
24
|
+
preflightShaderSource,
|
|
25
|
+
setNativeTimeoutMs,
|
|
22
26
|
doe,
|
|
23
27
|
};
|
package/src/compute.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
BoundDoeNamespace,
|
|
3
3
|
DoeKernelDispatchOptions,
|
|
4
|
+
DoeKernelCreateOptions,
|
|
4
5
|
DoeNamespace,
|
|
5
|
-
|
|
6
|
-
} from "./doe.js";
|
|
6
|
+
} from "@simulatte/webgpu-doe";
|
|
7
7
|
import type {
|
|
8
8
|
DoeRuntime,
|
|
9
9
|
DoeRuntimeRunResult,
|
|
@@ -107,7 +107,7 @@ export interface RequestDeviceOptions {
|
|
|
107
107
|
createArgs?: string[] | null;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
export interface
|
|
110
|
+
export interface ComputeDoeKernelCreateOptions extends DoeKernelCreateOptions<ComputeGPUBuffer> {}
|
|
111
111
|
|
|
112
112
|
export interface ComputeDoeKernelDispatchOptions extends DoeKernelDispatchOptions<ComputeGPUBuffer> {}
|
|
113
113
|
|
|
@@ -118,15 +118,12 @@ export interface ComputeDoeKernel {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
export interface ComputeBoundDoeNamespace
|
|
121
|
-
extends BoundDoeNamespace<ComputeGPUDevice, ComputeGPUBuffer, ComputeDoeKernel,
|
|
121
|
+
extends BoundDoeNamespace<ComputeGPUDevice, ComputeGPUBuffer, ComputeDoeKernel, ComputeDoeKernelCreateOptions> {}
|
|
122
122
|
|
|
123
123
|
export interface ComputeDoeNamespace
|
|
124
124
|
extends DoeNamespace<
|
|
125
125
|
ComputeGPUDevice,
|
|
126
|
-
ComputeGPUBuffer,
|
|
127
|
-
ComputeDoeKernel,
|
|
128
126
|
ComputeBoundDoeNamespace,
|
|
129
|
-
ComputeDoeRunComputeOptions,
|
|
130
127
|
RequestDeviceOptions
|
|
131
128
|
> {}
|
|
132
129
|
|
|
@@ -144,6 +141,16 @@ export function createDoeRuntime(options?: {
|
|
|
144
141
|
libPath?: string;
|
|
145
142
|
}): DoeRuntime;
|
|
146
143
|
export function runDawnVsDoeCompare(options: Record<string, unknown>): DoeRuntimeRunResult;
|
|
144
|
+
export function preflightShaderSource(code: string): {
|
|
145
|
+
ok: boolean;
|
|
146
|
+
stage: string;
|
|
147
|
+
kind: string;
|
|
148
|
+
message: string;
|
|
149
|
+
reasons: string[];
|
|
150
|
+
line?: number;
|
|
151
|
+
column?: number;
|
|
152
|
+
};
|
|
153
|
+
export function setNativeTimeoutMs(ms: number): void;
|
|
147
154
|
|
|
148
155
|
export const doe: ComputeDoeNamespace;
|
|
149
156
|
|
|
@@ -156,6 +163,8 @@ declare const _default: {
|
|
|
156
163
|
providerInfo: typeof providerInfo;
|
|
157
164
|
createDoeRuntime: typeof createDoeRuntime;
|
|
158
165
|
runDawnVsDoeCompare: typeof runDawnVsDoeCompare;
|
|
166
|
+
preflightShaderSource: typeof preflightShaderSource;
|
|
167
|
+
setNativeTimeoutMs: typeof setNativeTimeoutMs;
|
|
159
168
|
doe: ComputeDoeNamespace;
|
|
160
169
|
};
|
|
161
170
|
|
package/src/compute.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as full from './index.js';
|
|
2
|
-
import { createDoeNamespace } from '
|
|
2
|
+
import { createDoeNamespace } from '@simulatte/webgpu-doe';
|
|
3
3
|
|
|
4
4
|
function unwrap(value) {
|
|
5
5
|
return value && typeof value === 'object' && '_raw' in value ? value._raw : value;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function wrapBuffer(raw) {
|
|
9
9
|
return {
|
|
10
10
|
_raw: raw,
|
|
11
11
|
size: raw.size,
|
|
@@ -100,19 +100,19 @@ function wrap_buffer(raw) {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
function
|
|
103
|
+
function wrapBindGroupLayout(raw) {
|
|
104
104
|
return { _raw: raw };
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
function
|
|
107
|
+
function wrapBindGroup(raw) {
|
|
108
108
|
return { _raw: raw };
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
function
|
|
111
|
+
function wrapPipelineLayout(raw) {
|
|
112
112
|
return { _raw: raw };
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
function
|
|
115
|
+
function wrapComputePipeline(raw) {
|
|
116
116
|
return {
|
|
117
117
|
_raw: raw,
|
|
118
118
|
/**
|
|
@@ -131,12 +131,12 @@ function wrap_compute_pipeline(raw) {
|
|
|
131
131
|
* - The returned layout is wrapped back into the compute facade.
|
|
132
132
|
*/
|
|
133
133
|
getBindGroupLayout(index) {
|
|
134
|
-
return
|
|
134
|
+
return wrapBindGroupLayout(raw.getBindGroupLayout(index));
|
|
135
135
|
},
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
function
|
|
139
|
+
function wrapComputePass(raw) {
|
|
140
140
|
return {
|
|
141
141
|
_raw: raw,
|
|
142
142
|
/**
|
|
@@ -246,7 +246,7 @@ function wrap_compute_pass(raw) {
|
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
function
|
|
249
|
+
function wrapCommandEncoder(raw) {
|
|
250
250
|
return {
|
|
251
251
|
_raw: raw,
|
|
252
252
|
/**
|
|
@@ -264,7 +264,7 @@ function wrap_command_encoder(raw) {
|
|
|
264
264
|
* - The returned pass is wrapped back into the compute facade.
|
|
265
265
|
*/
|
|
266
266
|
beginComputePass(descriptor) {
|
|
267
|
-
return
|
|
267
|
+
return wrapComputePass(raw.beginComputePass(descriptor));
|
|
268
268
|
},
|
|
269
269
|
/**
|
|
270
270
|
* Record a buffer-to-buffer copy.
|
|
@@ -336,7 +336,7 @@ function wrap_command_encoder(raw) {
|
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
function
|
|
339
|
+
function wrapQueue(raw) {
|
|
340
340
|
return {
|
|
341
341
|
_raw: raw,
|
|
342
342
|
/**
|
|
@@ -394,7 +394,7 @@ function wrap_queue(raw) {
|
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
function
|
|
397
|
+
function wrapQuerySet(raw) {
|
|
398
398
|
return {
|
|
399
399
|
_raw: raw,
|
|
400
400
|
/**
|
|
@@ -417,10 +417,10 @@ function wrap_query_set(raw) {
|
|
|
417
417
|
};
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
function
|
|
420
|
+
function wrapDevice(raw) {
|
|
421
421
|
return {
|
|
422
422
|
_raw: raw,
|
|
423
|
-
queue:
|
|
423
|
+
queue: wrapQueue(raw.queue),
|
|
424
424
|
limits: raw.limits,
|
|
425
425
|
features: raw.features,
|
|
426
426
|
/**
|
|
@@ -441,7 +441,7 @@ function wrap_device(raw) {
|
|
|
441
441
|
* - The returned buffer is wrapped back into the compute facade.
|
|
442
442
|
*/
|
|
443
443
|
createBuffer(descriptor) {
|
|
444
|
-
return
|
|
444
|
+
return wrapBuffer(raw.createBuffer(descriptor));
|
|
445
445
|
},
|
|
446
446
|
/**
|
|
447
447
|
* Create a shader module from WGSL source.
|
|
@@ -479,7 +479,7 @@ function wrap_device(raw) {
|
|
|
479
479
|
*/
|
|
480
480
|
createComputePipeline(descriptor) {
|
|
481
481
|
const compute = descriptor.compute ?? {};
|
|
482
|
-
return
|
|
482
|
+
return wrapComputePipeline(raw.createComputePipeline({
|
|
483
483
|
...descriptor,
|
|
484
484
|
layout: descriptor.layout === 'auto' ? 'auto' : unwrap(descriptor.layout),
|
|
485
485
|
compute: {
|
|
@@ -503,7 +503,15 @@ function wrap_device(raw) {
|
|
|
503
503
|
* - The returned pipeline is wrapped back into the compute facade.
|
|
504
504
|
*/
|
|
505
505
|
async createComputePipelineAsync(descriptor) {
|
|
506
|
-
|
|
506
|
+
const compute = descriptor.compute ?? {};
|
|
507
|
+
return wrapComputePipeline(await raw.createComputePipelineAsync({
|
|
508
|
+
...descriptor,
|
|
509
|
+
layout: descriptor.layout === 'auto' ? 'auto' : unwrap(descriptor.layout),
|
|
510
|
+
compute: {
|
|
511
|
+
...compute,
|
|
512
|
+
module: unwrap(compute.module),
|
|
513
|
+
},
|
|
514
|
+
}));
|
|
507
515
|
},
|
|
508
516
|
/**
|
|
509
517
|
* Create a bind-group layout.
|
|
@@ -520,7 +528,7 @@ function wrap_device(raw) {
|
|
|
520
528
|
* - The returned layout is wrapped for compute-surface use.
|
|
521
529
|
*/
|
|
522
530
|
createBindGroupLayout(descriptor) {
|
|
523
|
-
return
|
|
531
|
+
return wrapBindGroupLayout(raw.createBindGroupLayout(descriptor));
|
|
524
532
|
},
|
|
525
533
|
/**
|
|
526
534
|
* Create a bind group.
|
|
@@ -543,7 +551,7 @@ function wrap_device(raw) {
|
|
|
543
551
|
? { ...entry.resource, buffer: unwrap(entry.resource.buffer) }
|
|
544
552
|
: entry.resource,
|
|
545
553
|
}));
|
|
546
|
-
return
|
|
554
|
+
return wrapBindGroup(raw.createBindGroup({
|
|
547
555
|
...descriptor,
|
|
548
556
|
layout: unwrap(descriptor.layout),
|
|
549
557
|
entries,
|
|
@@ -564,7 +572,7 @@ function wrap_device(raw) {
|
|
|
564
572
|
* - Wrapped bind-group layouts are unwrapped before creation.
|
|
565
573
|
*/
|
|
566
574
|
createPipelineLayout(descriptor) {
|
|
567
|
-
return
|
|
575
|
+
return wrapPipelineLayout(raw.createPipelineLayout({
|
|
568
576
|
...descriptor,
|
|
569
577
|
bindGroupLayouts: (descriptor.bindGroupLayouts ?? []).map(unwrap),
|
|
570
578
|
}));
|
|
@@ -584,7 +592,7 @@ function wrap_device(raw) {
|
|
|
584
592
|
* - The returned encoder is wrapped back into the compute facade.
|
|
585
593
|
*/
|
|
586
594
|
createCommandEncoder(descriptor) {
|
|
587
|
-
return
|
|
595
|
+
return wrapCommandEncoder(raw.createCommandEncoder(descriptor));
|
|
588
596
|
},
|
|
589
597
|
/**
|
|
590
598
|
* Create a query set.
|
|
@@ -604,7 +612,7 @@ function wrap_device(raw) {
|
|
|
604
612
|
if (typeof raw.createQuerySet !== 'function') {
|
|
605
613
|
throw new Error('query sets are unsupported on the compute surface');
|
|
606
614
|
}
|
|
607
|
-
return
|
|
615
|
+
return wrapQuerySet(raw.createQuerySet(descriptor));
|
|
608
616
|
},
|
|
609
617
|
/**
|
|
610
618
|
* Release the wrapped device.
|
|
@@ -626,7 +634,7 @@ function wrap_device(raw) {
|
|
|
626
634
|
};
|
|
627
635
|
}
|
|
628
636
|
|
|
629
|
-
function
|
|
637
|
+
function wrapAdapter(raw) {
|
|
630
638
|
return {
|
|
631
639
|
_raw: raw,
|
|
632
640
|
features: raw.features,
|
|
@@ -646,7 +654,7 @@ function wrap_adapter(raw) {
|
|
|
646
654
|
* - The wrapped device intentionally omits render and surface APIs.
|
|
647
655
|
*/
|
|
648
656
|
async requestDevice(descriptor) {
|
|
649
|
-
return
|
|
657
|
+
return wrapDevice(await raw.requestDevice(descriptor));
|
|
650
658
|
},
|
|
651
659
|
/**
|
|
652
660
|
* Release the wrapped adapter.
|
|
@@ -667,7 +675,7 @@ function wrap_adapter(raw) {
|
|
|
667
675
|
};
|
|
668
676
|
}
|
|
669
677
|
|
|
670
|
-
function
|
|
678
|
+
function wrapGpu(raw) {
|
|
671
679
|
return {
|
|
672
680
|
_raw: raw,
|
|
673
681
|
/**
|
|
@@ -685,7 +693,7 @@ function wrap_gpu(raw) {
|
|
|
685
693
|
* - The wrapped adapter later produces compute-only devices.
|
|
686
694
|
*/
|
|
687
695
|
async requestAdapter(options) {
|
|
688
|
-
return
|
|
696
|
+
return wrapAdapter(await raw.requestAdapter(options));
|
|
689
697
|
},
|
|
690
698
|
};
|
|
691
699
|
}
|
|
@@ -728,7 +736,7 @@ export const globals = full.globals;
|
|
|
728
736
|
* - The returned device intentionally omits render, sampler, and surface methods.
|
|
729
737
|
*/
|
|
730
738
|
export function create(createArgs = null) {
|
|
731
|
-
return
|
|
739
|
+
return wrapGpu(full.create(createArgs));
|
|
732
740
|
}
|
|
733
741
|
|
|
734
742
|
/**
|
|
@@ -803,8 +811,12 @@ export async function requestAdapter(adapterOptions = undefined, createArgs = nu
|
|
|
803
811
|
/**
|
|
804
812
|
* Request a compute-only device facade from the Doe runtime.
|
|
805
813
|
*
|
|
806
|
-
*
|
|
807
|
-
*
|
|
814
|
+
* Surface: Direct WebGPU compute package surface.
|
|
815
|
+
* Input: Optional adapter, device, and package creation options.
|
|
816
|
+
* Returns: A promise for a compute-only device facade.
|
|
817
|
+
*
|
|
818
|
+
* This requests an adapter and then wraps the resulting raw device so the
|
|
819
|
+
* package exposes only the compute-side JS surface.
|
|
808
820
|
*
|
|
809
821
|
* This example shows the API in its basic form.
|
|
810
822
|
*
|
|
@@ -812,11 +824,12 @@ export async function requestAdapter(adapterOptions = undefined, createArgs = nu
|
|
|
812
824
|
* import { requestDevice } from "@simulatte/webgpu/compute";
|
|
813
825
|
*
|
|
814
826
|
* const device = await requestDevice();
|
|
815
|
-
* console.log(typeof device.createRenderPipeline);
|
|
827
|
+
* console.log(typeof device.createRenderPipeline);
|
|
816
828
|
* ```
|
|
817
829
|
*
|
|
818
|
-
* - The facade hides render, sampler, and surface methods even if the
|
|
819
|
-
* - Buffer and queue operations remain available for upload, dispatch, copy, and readback
|
|
830
|
+
* - The facade hides render, sampler, and surface methods even if the runtime has them.
|
|
831
|
+
* - Buffer and queue operations remain available for upload, dispatch, copy, and readback.
|
|
832
|
+
* - See `doe.requestDevice(...)` for the bound Doe API entrypoint over this same device.
|
|
820
833
|
*/
|
|
821
834
|
export async function requestDevice(options = {}) {
|
|
822
835
|
const adapter = await requestAdapter(options?.adapterOptions, options?.createArgs ?? null);
|
|
@@ -824,15 +837,15 @@ export async function requestDevice(options = {}) {
|
|
|
824
837
|
}
|
|
825
838
|
|
|
826
839
|
/**
|
|
827
|
-
* Shared Doe API
|
|
840
|
+
* Shared Doe API namespace for the compute package surface.
|
|
828
841
|
*
|
|
829
|
-
*
|
|
830
|
-
* `doe.
|
|
831
|
-
*
|
|
832
|
-
* surface, and `doe.compute.once(...)` for `Doe routines`.
|
|
842
|
+
* Surface: Doe API on `@simulatte/webgpu/compute`.
|
|
843
|
+
* Input: Called through `doe.requestDevice(...)` or `doe.bind(device)`.
|
|
844
|
+
* Returns: A bound `gpu` helper object over a compute-only device facade.
|
|
833
845
|
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
846
|
+
* This is the JS convenience surface over the compute package. Both entry
|
|
847
|
+
* points return the same bound `gpu` object, with `gpu.buffer.*`,
|
|
848
|
+
* `gpu.kernel.*`, and a single `gpu.compute(...)` helper.
|
|
836
849
|
*
|
|
837
850
|
* This example shows the API in its basic form.
|
|
838
851
|
*
|
|
@@ -840,21 +853,27 @@ export async function requestDevice(options = {}) {
|
|
|
840
853
|
* import { doe } from "@simulatte/webgpu/compute";
|
|
841
854
|
*
|
|
842
855
|
* const gpu = await doe.requestDevice();
|
|
843
|
-
* const src = gpu.
|
|
844
|
-
* const dst = gpu.
|
|
856
|
+
* const src = gpu.buffer.create({ data: new Float32Array([1, 2, 3, 4]) });
|
|
857
|
+
* const dst = gpu.buffer.create({ size: src.size, usage: "storageReadWrite" });
|
|
845
858
|
* ```
|
|
846
859
|
*
|
|
847
|
-
* - This
|
|
848
|
-
* - `gpu.compute
|
|
860
|
+
* - This helper shape matches the full package `doe`; only the raw device underneath differs.
|
|
861
|
+
* - `gpu.compute(...)` is the narrowest helper; drop to `gpu.kernel.*` for explicit control.
|
|
862
|
+
* - See `requestDevice(...)` when you want the compute-only raw facade without Doe helpers.
|
|
849
863
|
*/
|
|
850
864
|
export const doe = createDoeNamespace({
|
|
851
865
|
requestDevice,
|
|
852
866
|
});
|
|
853
867
|
|
|
854
868
|
/**
|
|
855
|
-
* Report how the compute package
|
|
869
|
+
* Report how the compute package resolved the Doe runtime.
|
|
856
870
|
*
|
|
857
|
-
*
|
|
871
|
+
* Surface: Package runtime metadata.
|
|
872
|
+
* Input: None.
|
|
873
|
+
* Returns: A provenance object describing the loaded Doe provider.
|
|
874
|
+
*
|
|
875
|
+
* This re-exports the same runtime provenance report as the full package so
|
|
876
|
+
* callers can inspect which native library and package path were selected.
|
|
858
877
|
*
|
|
859
878
|
* This example shows the API in its basic form.
|
|
860
879
|
*
|
|
@@ -864,14 +883,19 @@ export const doe = createDoeNamespace({
|
|
|
864
883
|
* console.log(providerInfo().loaded);
|
|
865
884
|
* ```
|
|
866
885
|
*
|
|
867
|
-
* - The report describes
|
|
886
|
+
* - The report describes runtime loading, not the compute facade wrapper itself.
|
|
887
|
+
* - The shape is shared with `@simulatte/webgpu`.
|
|
868
888
|
*/
|
|
869
889
|
export const providerInfo = full.providerInfo;
|
|
870
890
|
/**
|
|
871
|
-
* Create a
|
|
891
|
+
* Create a Doe CLI/runtime wrapper from the compute package.
|
|
892
|
+
*
|
|
893
|
+
* Surface: Package tooling and runtime orchestration.
|
|
894
|
+
* Input: Optional runtime configuration accepted by the shared runtime helper.
|
|
895
|
+
* Returns: A Doe runtime wrapper for CLI-style execution paths.
|
|
872
896
|
*
|
|
873
|
-
* This re-exports the same runtime
|
|
874
|
-
*
|
|
897
|
+
* This re-exports the same runtime wrapper as the full package for benchmark,
|
|
898
|
+
* trace, and command-stream execution workflows.
|
|
875
899
|
*
|
|
876
900
|
* This example shows the API in its basic form.
|
|
877
901
|
*
|
|
@@ -881,13 +905,19 @@ export const providerInfo = full.providerInfo;
|
|
|
881
905
|
* const runtime = createDoeRuntime();
|
|
882
906
|
* ```
|
|
883
907
|
*
|
|
884
|
-
* - This is package/runtime orchestration, not the in-process
|
|
908
|
+
* - This is package/runtime orchestration, not the in-process `gpu.*` helper surface.
|
|
909
|
+
* - See `runDawnVsDoeCompare(...)` for the packaged compare entrypoint.
|
|
885
910
|
*/
|
|
886
911
|
export const createDoeRuntime = full.createDoeRuntime;
|
|
887
912
|
/**
|
|
888
|
-
* Run the Dawn-vs-Doe compare harness from the compute package
|
|
913
|
+
* Run the Dawn-vs-Doe compare harness from the compute package.
|
|
914
|
+
*
|
|
915
|
+
* Surface: Package benchmarking and artifact tooling.
|
|
916
|
+
* Input: Compare options or forwarded CLI arguments.
|
|
917
|
+
* Returns: The compare harness result from the shared tooling layer.
|
|
889
918
|
*
|
|
890
|
-
* This re-exports the compare wrapper used for artifact-backed
|
|
919
|
+
* This re-exports the benchmark compare wrapper used for artifact-backed
|
|
920
|
+
* Dawn-vs-Doe performance runs.
|
|
891
921
|
*
|
|
892
922
|
* This example shows the API in its basic form.
|
|
893
923
|
*
|
|
@@ -898,7 +928,8 @@ export const createDoeRuntime = full.createDoeRuntime;
|
|
|
898
928
|
* ```
|
|
899
929
|
*
|
|
900
930
|
* - Requires an explicit compare config path either in options or forwarded CLI args.
|
|
901
|
-
* - This is a tooling entrypoint, not the in-process `
|
|
931
|
+
* - This is a tooling entrypoint, not the in-process `gpu.compute(...)` helper path.
|
|
932
|
+
* - See `createDoeRuntime()` for lower-level runtime orchestration.
|
|
902
933
|
*/
|
|
903
934
|
export const runDawnVsDoeCompare = full.runDawnVsDoeCompare;
|
|
904
935
|
|
package/src/full.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
BoundDoeNamespace,
|
|
3
3
|
DoeKernelDispatchOptions,
|
|
4
|
+
DoeKernelCreateOptions,
|
|
4
5
|
DoeNamespace,
|
|
5
|
-
|
|
6
|
-
} from "./doe.js";
|
|
6
|
+
} from "@simulatte/webgpu-doe";
|
|
7
7
|
|
|
8
8
|
export interface ProviderInfo {
|
|
9
9
|
module: string;
|
|
@@ -64,7 +64,7 @@ export interface RequestDeviceOptions {
|
|
|
64
64
|
createArgs?: string[] | null;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
export interface
|
|
67
|
+
export interface FullDoeKernelCreateOptions extends DoeKernelCreateOptions<GPUBuffer> {}
|
|
68
68
|
|
|
69
69
|
export interface FullDoeKernelDispatchOptions extends DoeKernelDispatchOptions<GPUBuffer> {}
|
|
70
70
|
|
|
@@ -75,15 +75,12 @@ export interface FullDoeKernel {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export interface FullBoundDoeNamespace
|
|
78
|
-
extends BoundDoeNamespace<GPUDevice, GPUBuffer, FullDoeKernel,
|
|
78
|
+
extends BoundDoeNamespace<GPUDevice, GPUBuffer, FullDoeKernel, FullDoeKernelCreateOptions> {}
|
|
79
79
|
|
|
80
80
|
export interface FullDoeNamespace
|
|
81
81
|
extends DoeNamespace<
|
|
82
82
|
GPUDevice,
|
|
83
|
-
GPUBuffer,
|
|
84
|
-
FullDoeKernel,
|
|
85
83
|
FullBoundDoeNamespace,
|
|
86
|
-
FullDoeRunComputeOptions,
|
|
87
84
|
RequestDeviceOptions
|
|
88
85
|
> {}
|
|
89
86
|
|
|
@@ -101,6 +98,16 @@ export function createDoeRuntime(options?: {
|
|
|
101
98
|
libPath?: string;
|
|
102
99
|
}): DoeRuntime;
|
|
103
100
|
export function runDawnVsDoeCompare(options: Record<string, unknown>): DoeRuntimeRunResult;
|
|
101
|
+
export function preflightShaderSource(code: string): {
|
|
102
|
+
ok: boolean;
|
|
103
|
+
stage: string;
|
|
104
|
+
kind: string;
|
|
105
|
+
message: string;
|
|
106
|
+
reasons: string[];
|
|
107
|
+
line?: number;
|
|
108
|
+
column?: number;
|
|
109
|
+
};
|
|
110
|
+
export function setNativeTimeoutMs(ms: number): void;
|
|
104
111
|
|
|
105
112
|
export const doe: FullDoeNamespace;
|
|
106
113
|
|
|
@@ -113,6 +120,8 @@ declare const _default: {
|
|
|
113
120
|
providerInfo: typeof providerInfo;
|
|
114
121
|
createDoeRuntime: typeof createDoeRuntime;
|
|
115
122
|
runDawnVsDoeCompare: typeof runDawnVsDoeCompare;
|
|
123
|
+
preflightShaderSource: typeof preflightShaderSource;
|
|
124
|
+
setNativeTimeoutMs: typeof setNativeTimeoutMs;
|
|
116
125
|
doe: FullDoeNamespace;
|
|
117
126
|
};
|
|
118
127
|
|
package/src/full.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import * as full from './index.js';
|
|
2
|
-
import { createDoeNamespace } from '
|
|
2
|
+
import { createDoeNamespace } from '@simulatte/webgpu-doe';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Shared Doe API
|
|
5
|
+
* Shared Doe API namespace for the full package surface.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* `doe.
|
|
9
|
-
*
|
|
10
|
-
* surface, and `doe.compute.once(...)` for `Doe routines`.
|
|
7
|
+
* Surface: Doe API on `@simulatte/webgpu`.
|
|
8
|
+
* Input: Called through `doe.requestDevice(...)` or `doe.bind(device)`.
|
|
9
|
+
* Returns: A bound `gpu` helper object over a full raw device.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* This is the JS convenience surface over the full package. Both entry points
|
|
12
|
+
* return the same bound `gpu` object, with `gpu.buffer.*`, `gpu.kernel.*`,
|
|
13
|
+
* and a single `gpu.compute(...)` helper, while still leaving the underlying
|
|
14
|
+
* raw device reachable as `gpu.device`.
|
|
14
15
|
*
|
|
15
16
|
* This example shows the API in its basic form.
|
|
16
17
|
*
|
|
@@ -20,8 +21,9 @@ import { createDoeNamespace } from './doe.js';
|
|
|
20
21
|
* const gpu = await doe.requestDevice();
|
|
21
22
|
* ```
|
|
22
23
|
*
|
|
23
|
-
* - The Doe
|
|
24
|
-
* - If you need explicit render, sampler, or surface APIs,
|
|
24
|
+
* - The Doe helper shape matches `@simulatte/webgpu/compute`; the difference is the raw device underneath.
|
|
25
|
+
* - If you need explicit render, sampler, or surface APIs, use `gpu.device`.
|
|
26
|
+
* - See the package `requestDevice()` export when you want the raw full device without Doe helpers.
|
|
25
27
|
*/
|
|
26
28
|
export const doe = createDoeNamespace({
|
|
27
29
|
requestDevice: full.requestDevice,
|