open-standards/wai/wai-ops-gpu/browser/semantics_reference.mjs
Transaction Science 836d0255df wai packaging stack: #426, #438 and #452's GPU tier, squashed onto main
One squashed history of three stacked PRs, onto main at b16816671:

- #426 (wai/pack-efficiency): a title's whole AV1 ladder in one package over one
  integer base; several floor rungs (packaging §7.1), a re-pack from a parent
  (§11.5), a floor that is the ladder's own CMAF (§7.7), a floor-only profile
  (§7.8), a streaming pack (§11.4), and the independent verifier at scale (§9.4).
- #438 (wai/cross-fabric): each pack and verify step on the fabric with the least
  measured energy (§11.6); the `fabrics` member of measurement claims
  (jwp-receipts §2.4.8, energy-measurement §6.3); the wai-pack-gpu crate;
  `wai-pack fabric`; `wai-pack floor-decode`.
- #452 (wai/gpu-int-tier), its GPU-tier part only: claiming decode-equivalence on a
  GPU (determinism-tiers §5), the WGSL integer semantics suite, the rules check on
  naga's IR, and the kernels' shift masks and min(max()) clamps.

Left out, by the review's split (EN-C takes it over): #452's platform decode in
dispatch, its commits 6ad92e2e8, 8695bc75f and fed8694f4 and its CHANGELOG entry:
extensions/platform-decode.md, platform-decode-conformance/, wai::platform_decode,
wai-web's platform_decode bundle and demo, and its two SPEC.md sentences.

#438's research note is not carried as written: it is rewritten as
wai/research/cross-fabric.md, with hardware named by architecture, PCI id and OS
version, and every table marked as one run. floor_decode.rs and a wai_pack.rs
comment name the platform's media engine and a full-length film the same way.

wai/CHANGELOG.md is the union of both sides' entries, the stack's first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 20:31:28 -04:00

26 lines
1.3 KiB
JavaScript

// WGSL's integer semantics vectors (wai/wgsl-conformance/integer.jsonl) against the
// reference compiled to wasm32, under Node, with no GPU: every committed result must be
// the one `wai_ops_gpu::semantics::reference` gives in WebAssembly.
//
// Build the page's module first (run.mjs's header says how), then:
//
// node wai/wai-ops-gpu/browser/semantics_reference.mjs
//
// Prints `wasm reference: target=wasm32 ... cases=N equal` and exits 0, or prints the
// first difference and exits 1.
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const HERE = path.dirname(fileURLToPath(import.meta.url));
const pkg = path.join(HERE, "pkg");
if (!fs.existsSync(path.join(pkg, "wai_ops_gpu_browser.js"))) {
console.error("no pkg/wai_ops_gpu_browser.js; build it as run.mjs's header says");
process.exit(2);
}
const mod = await import(path.join(pkg, "wai_ops_gpu_browser.js"));
mod.initSync({ module: fs.readFileSync(path.join(pkg, "wai_ops_gpu_browser_bg.wasm")) });
const vectors = fs.readFileSync(path.resolve(HERE, "../../wgsl-conformance/integer.jsonl"), "utf8");
const out = mod.semantics_reference(vectors);
console.log(`node ${process.version}: ${out}`);
if (!/^wasm reference: target=wasm32 .* cases=[1-9][0-9]* equal$/.test(out)) process.exit(1);