browser/ is a wasm32 module that runs every graph vector of ops-conformance on the WebGPU adapter a page is offered, the kernels compiled by the browser's own WGSL compiler, and holds each decode to the committed result and to the interpreter running in the same page. run.mjs serves it with the corpus and drives a headless browser (on macOS through Metal), and fails on a mismatch, a device error or a page error, or, under WAI_OPS_GPU_REQUIRE=1, when no adapter ran the corpus. tests/support/corpus.rs now parses a file apart from reading it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
28 lines
1 KiB
HTML
28 lines
1 KiB
HTML
<!doctype html>
|
|
<meta charset="utf-8">
|
|
<title>wai-ops-gpu in a browser</title>
|
|
<p id="status">running</p>
|
|
<pre id="report"></pre>
|
|
<script type="module">
|
|
// Loads every graph-vector file of ops-conformance/ (the list run.mjs serves as
|
|
// files.json), runs them through wai-ops-gpu on this browser's WebGPU, and leaves the
|
|
// report in window.opsGpu for run.mjs to read.
|
|
import init, { run_corpus } from "./pkg/wai_ops_gpu_browser.js";
|
|
window.opsGpu = { done: false, report: "" };
|
|
try {
|
|
await init();
|
|
const files = await (await fetch("files.json")).json();
|
|
let bundle = "";
|
|
for (const f of files) {
|
|
const r = await fetch(`/ops-conformance/${f}`);
|
|
if (!r.ok) throw new Error(`${f}: ${r.status}`);
|
|
bundle += `### ${f}\n` + await r.text();
|
|
}
|
|
window.opsGpu.report = await run_corpus(bundle);
|
|
} catch (e) {
|
|
window.opsGpu.report = `browser webgpu: page error: ${e}`;
|
|
}
|
|
document.getElementById("report").textContent = window.opsGpu.report;
|
|
document.getElementById("status").textContent = "done";
|
|
window.opsGpu.done = true;
|
|
</script>
|