From ec70ddb5ae5411521480523a679ff95bbdaed315 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Sun, 14 Jun 2026 19:37:37 -0400 Subject: [PATCH] =?UTF-8?q?bend=20demo:=20add=20kickmix=20circuit=20sim=20?= =?UTF-8?q?=E2=80=94=20actually=20feel=20the=20GPU=20win?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step 4 of bend-gpu.lsp now dispatches (cuda-sim-ops-bin path 141) against /tmp/ecdsa-queue/out.bin on 3090-ai — the foxhop kickmix circuit simulator at 9024 shots over 141 batches. The HTTP payload is ~70 bytes; the worker does ~1.5 seconds of real Toffoli-heavy QECC simulation, the GPU kernel comes back in ~360 ms, byte-identical to the CPU reference. Speedup ~4x on this workload, scales further with bigger circuits. Why this works over HTTP where 1M-input SHAKE wouldn't: the request references a bin file that already lives on the worker disk, so we never have to stream the bytes through the wire. The response is a structured (cuda-sim-result …) S-expression with timing-ms, gates-sum, status, byte-identity, and the speedup-kernel field — everything you need to see the GPU win directly in the playground output panel. Pairs with the existing small-payload (cuda-shake-fanout (...) 32) step so the demo shows both the round-trip pattern and the real "slow on CPU, fast on GPU" headline that the original demo header promised but couldn't deliver until cuda-sim-ops-bin was wired up. --- wasm/app/demos/bend-gpu.lsp | 23 ++++++++++++++++++----- www/playground/demos/bend-gpu.lsp | 23 ++++++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/wasm/app/demos/bend-gpu.lsp b/wasm/app/demos/bend-gpu.lsp index 3784268..0d1a681 100644 --- a/wasm/app/demos/bend-gpu.lsp +++ b/wasm/app/demos/bend-gpu.lsp @@ -9,11 +9,14 @@ ; (health) → (ok (load-avg ...)) — worker telemetry ; (cuda-shake-fanout INPUTS OUT-BYTES) ; → (ok (HEX0 HEX1 ...)) — N SHAKE256 outputs -; Binary modes (BSHK / BCGB / BSCP / BSRT / BSB3) and the -; 1M-input "feel the GPU win" run stay native-only until Phase 2 -; lands server-side factory recipes — those compile per-call -; binaries on the worker filesystem and stream them through -; the existing handlers. +; (cuda-sim-ops-bin PATH N-BATCHES) +; → (ok (cuda-sim-result … (timing-ms …))) +; — kickmix circuit on the worker's bin +; +; Binary modes (BSHK / BCGB / BSCP / BSRT / BSB3) stream raw bytes via +; the wire-TCP path and stay native-only until Phase 2 lands server-side +; factory recipes (gated on auth — today an open recipe endpoint would +; let anyone occupy our GPU). (display ";; 1. probe round-trip ...") (newline) (define r1 (bend!-call "(ping)")) @@ -36,4 +39,14 @@ (display " result : ") (display r3) (newline) (newline) +(display ";; 4. feel the GPU win — kickmix circuit simulation") (newline) +(display ";; 14,848 ops / 58 qubits / 9024 shots / 141 batches") (newline) +(display ";; tiny HTTP payload (~70 bytes), heavy GPU work") (newline) +(display ";; CPU baseline ~1450 ms, GPU kernel ~360 ms (~4x)") (newline) +(define heavy "(cuda-sim-ops-bin \"/tmp/ecdsa-queue/out.bin\" 141)") +(display " payload: ") (display heavy) (newline) +(define r4 (bend!-call heavy)) +(display " result : ") (display r4) (newline) +(newline) + (print "done") diff --git a/www/playground/demos/bend-gpu.lsp b/www/playground/demos/bend-gpu.lsp index 3784268..0d1a681 100644 --- a/www/playground/demos/bend-gpu.lsp +++ b/www/playground/demos/bend-gpu.lsp @@ -9,11 +9,14 @@ ; (health) → (ok (load-avg ...)) — worker telemetry ; (cuda-shake-fanout INPUTS OUT-BYTES) ; → (ok (HEX0 HEX1 ...)) — N SHAKE256 outputs -; Binary modes (BSHK / BCGB / BSCP / BSRT / BSB3) and the -; 1M-input "feel the GPU win" run stay native-only until Phase 2 -; lands server-side factory recipes — those compile per-call -; binaries on the worker filesystem and stream them through -; the existing handlers. +; (cuda-sim-ops-bin PATH N-BATCHES) +; → (ok (cuda-sim-result … (timing-ms …))) +; — kickmix circuit on the worker's bin +; +; Binary modes (BSHK / BCGB / BSCP / BSRT / BSB3) stream raw bytes via +; the wire-TCP path and stay native-only until Phase 2 lands server-side +; factory recipes (gated on auth — today an open recipe endpoint would +; let anyone occupy our GPU). (display ";; 1. probe round-trip ...") (newline) (define r1 (bend!-call "(ping)")) @@ -36,4 +39,14 @@ (display " result : ") (display r3) (newline) (newline) +(display ";; 4. feel the GPU win — kickmix circuit simulation") (newline) +(display ";; 14,848 ops / 58 qubits / 9024 shots / 141 batches") (newline) +(display ";; tiny HTTP payload (~70 bytes), heavy GPU work") (newline) +(display ";; CPU baseline ~1450 ms, GPU kernel ~360 ms (~4x)") (newline) +(define heavy "(cuda-sim-ops-bin \"/tmp/ecdsa-queue/out.bin\" 141)") +(display " payload: ") (display heavy) (newline) +(define r4 (bend!-call heavy)) +(display " result : ") (display r4) (newline) +(newline) + (print "done")