@orkestrel/wgsl 0.0.2 → 0.0.7

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/README.md CHANGED
@@ -2,8 +2,63 @@
2
2
 
3
3
  > Typed WGSL compute declarations, fragment linking, and prepared batch execution on a borrowed `GPUDevice`.
4
4
 
5
+ `@orkestrel/wgsl` declares WGSL compute programs in TypeScript, links author-written fragments with
6
+ ordered conditional `variants` and pipeline `overrides`, and executes prepared batches on a borrowed
7
+ WebGPU `GPUDevice`.
8
+
9
+ ## Install
10
+
11
+ Install the package from npm:
12
+
13
+ ```sh
14
+ npm install @orkestrel/wgsl
15
+ ```
16
+
17
+ ## Capabilities
18
+
19
+ The `@orkestrel/wgsl` entry is host-independent and reads no browser or Node global:
20
+
21
+ - **Declarations and linking.** `createWGSLStruct` lays out `u32`, `i32`, and `f32` uniform structs;
22
+ `createWGSLFragment` binds ordered conditional `variants` over `extensions`, `languages`,
23
+ `subgroup` bounds, and `linear` workgroups; `createWGSLProgram` declares storage slots (scalars,
24
+ `f16`, 2-lane and 4-lane vectors, and `read_write` atomics), pipeline `overrides`, and
25
+ dependency-ordered fragment linking; `renderWGSLProgram` and `collectWGSLSections` emit WGSL text
26
+ with compiler-error line attribution.
27
+ - **Prepared execution and batching.** `createWGSLSession` caches shader modules separately from
28
+ override-specialized compute pipelines, reports `extensions`, `languages`, and `subgroup` bounds,
29
+ and opens one `WGSLBatch` at a time. `WGSLBatch` keeps one compute pass open across dispatches,
30
+ uploads aligned uniforms through `WGSLSlab`, records ordered `write`, `copy`, `clear`, and
31
+ coalesced `read(spans)` operations over pooled staging buffers, and traces passes and GPU
32
+ timestamps when enabled.
33
+ - **Math and compute canon.** Static Tier 1 and Tier 2 fragments cover `WGSL_PLACE`, `WGSL_SUM`,
34
+ `WGSL_PEAK`, `WGSL_HALF`, `WGSL_BYTES`, `WGSL_BFLOAT`, `WGSL_FLOAT`, `WGSL_MATH`, `WGSL_JOIN`,
35
+ `WGSL_WELFORD`, `WGSL_COMPENSATED`, `WGSL_HASH`, `WGSL_TILE`, `WGSL_ORDER`, `WGSL_EFT`,
36
+ `WGSL_RANDOM`, `WGSL_DOUBLE`, `WGSL_SPECIAL`, `WGSL_COMPLEX`, `WGSL_QUATERNION`, `WGSL_DUAL`,
37
+ `WGSL_MATRIX`, `WGSL_MORTON`, `WGSL_FP8`, and `WGSL_QUASI`, all executing `0` `fma()` calls and
38
+ paired with TypeScript host twins (`widenWGSLHalf`, `narrowWGSLHalf`, `widenWGSLBFloat`,
39
+ `narrowWGSLBFloat`, `unpackWGSLBytes`, `packWGSLBytes`, `encodeWGSLFloatOrder`,
40
+ `decodeWGSLFloatOrder`, `computeWGSLPhilox`, `computeWGSLErf`, `computeWGSLErfc`,
41
+ `computeWGSLInverseErf`, `computeWGSLLogGamma`, `divideWGSLComplex`, `multiplyWGSLQuaternion`,
42
+ `rotateWGSLVector`, `invertWGSLMatrix3`, `encodeWGSLMorton2`, `decodeWGSLMorton2`,
43
+ `encodeWGSLMorton3`, `decodeWGSLMorton3`, `encodeWGSLDouble`, `decodeWGSLDouble`,
44
+ `widenWGSLE4M3`, `narrowWGSLE4M3`, `widenWGSLE5M2`, `narrowWGSLE5M2`, `sampleWGSLHalton`,
45
+ `sampleWGSLPlastic2`, and `sampleWGSLSobol2`) and the `isWGSLFloatPair` validator. Parameterized
46
+ factories (`createWGSLReduce`, `createWGSLArgReduce`, `createWGSLScan`, `createWGSLBroadcast`,
47
+ `createWGSLSort`, `createWGSLPairSort`, `createWGSLMonoidReduce`, `createWGSLTranspose`,
48
+ `createWGSLCompact`, `createWGSLPartition`, `createWGSLHistogram`, `createWGSLSegmentedScan`,
49
+ `createWGSLSegmentedReduce`, `createWGSLRadixRank`, and `createWGSLPermute`) build
50
+ exact-by-default workgroup, partitioned, and tile collectives with explicit opt-in subgroup
51
+ reordering.
52
+
53
+ ## Guide
54
+
55
+ See [`guides/wgsl.md`](guides/wgsl.md) for the complete API surface, failure codes, worked patterns,
56
+ and fragment authoring conventions.
57
+
5
58
  ## Development
6
59
 
60
+ Install dependencies and run the test suites:
61
+
7
62
  ```sh
8
63
  npm install
9
64
  npm test