diff --git a/kidlisp/PIECE-IL.md b/kidlisp/PIECE-IL.md index 22e485c4d5..dbd23a7fb6 100644 --- a/kidlisp/PIECE-IL.md +++ b/kidlisp/PIECE-IL.md @@ -234,6 +234,13 @@ The Wasm and JavaScript numbers agree bit for bit on every operation as the raytrace backends are. A host without WebAssembly runs the JavaScript; a host without a GPU runs the Wasm; the piece does not change. +`(gpu kernel from [to])` is the same map dispatched to the device as a +compute pass: the results land in the pool on the next frame that calls +it, one frame late by design, which the source says by using `gpu` and not +`run`. Without WebGPU, or while the device warms up, `gpu` is `run`. A +readback costs about a millisecond regardless of size, so `gpu` pays only +for pools in the thousands; `run` on Wasm is right for a hundred points. + What this is not: the whole program. Control flow over many small polygons, the painter's order, the near-plane clipper with its variable output stay in the closure compiler. Kernels take the parts that are diff --git a/kidlisp/tools/bench-pieces.mjs b/kidlisp/tools/bench-pieces.mjs index 58119d254a..b6af3a90ba 100644 --- a/kidlisp/tools/bench-pieces.mjs +++ b/kidlisp/tools/bench-pieces.mjs @@ -63,7 +63,7 @@ async function measure(browser, file, [width, height]) { samples: fps.length, fpsMedian: sorted[Math.floor(sorted.length / 2)] ?? 0, fpsMin: sorted[0] ?? 0, fpsMax: sorted.at(-1) ?? 0, errors, shot}; } -const browser = await puppeteer.launch({headless: true, executablePath: CHROME, args: ['--no-sandbox', '--ignore-certificate-errors', '--disable-background-timer-throttling', '--disable-renderer-backgrounding', '--disable-backgrounding-occluded-windows', '--autoplay-policy=no-user-gesture-required', '--mute-audio']}); +const browser = await puppeteer.launch({headless: true, executablePath: CHROME, args: ['--no-sandbox', '--ignore-certificate-errors', '--enable-unsafe-webgpu', '--enable-features=WebGPU', '--use-angle=metal', '--disable-background-timer-throttling', '--disable-renderer-backgrounding', '--disable-backgrounding-occluded-windows', '--autoplay-policy=no-user-gesture-required', '--mute-audio']}); const results = []; try { for (const file of files) for (const size of SIZES) {