bend demo: add kickmix circuit sim — actually feel the GPU win

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.
This commit is contained in:
russell@unturf.com 2026-06-14 19:37:37 -04:00
parent af0bf9cb35
commit ec70ddb5ae
No known key found for this signature in database
2 changed files with 36 additions and 10 deletions

View file

@ -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")