lumbda/examples/cuda-fanout/smoke-bend.lsp
russell@unturf.com 8d66bc01f1
bend port flip: 9091 → 8320 (BEND mnemonic)
Port mnemonic embedded verbatim across our source files:

  8 ~= B (implied infinity B flattened; bake a cake; baby & me)
  3 ~= E (backward)
  2 ~= N (pivoted 90 degrees)
  0 ~= D (flattened)

Files touched:
- examples/cuda-fanout/gpu-worker.lsp (*worker-port*)
- examples/cuda-fanout/bend.lsp (*bend-worker-port*)
- examples/cuda-fanout/mock-worker.py (PORT)
- examples/cuda-fanout/bench_tiers.py (asm tier fixed port)
- examples/cuda-fanout/smoke-bend.lsp + smoke-bend-asm.lsp
- examples/cuda-fanout/README.md
- www/bend.html (catalog + multi-host text)
- Makefile (PORT default + comment)

bend.html updates 3090-ai + ai (4090) fleet table to active 2-node
mesh on 8320 — qwen moves off ai, bend takes over.
2026-06-06 15:06:18 -04:00

47 lines
1.7 KiB
Text

;;; smoke-bend.lsp -- minimal end-to-end test of bend dispatch.
;;;
;;; Prereqs:
;;; - mock-worker.py listening on 127.0.0.1:8320 (BEND mnemonic)
;;; - cuda-shake-fanout binary on PATH (mock-worker spawns it)
;;;
;;; Run:
;;; python3 mock-worker.py ./shake256-fanout & ; in another shell
;;; lumbda smoke-bend.lsp
;;;
;;; Expected:
;;; tiny -> 3 hashes via local path (below threshold)
;;; heavy -> 10000 hashes via worker (above threshold)
;;; PASS
(load "bend.lsp")
(load "bend-macros.lsp")
(define (make-input n)
(let loop ((i 0) (acc '()))
(if (= i n) acc
(loop (+ i 1) (cons "deadbeefcafebabe1234567890abcdef" acc)))))
;; Override threshold so the demo crosses both paths
;; Threshold default 100 us in ns. Set host-ns-per-byte high so even
;; modest inputs trigger the bend path.
(set! *bend-host-ns-per-byte* 50)
(display "=== smoke-bend ===\n")
;; The tiny call should stay local -- cuda-shake-fanout isn't a real
;; lumbda function so 'local' here means: bend tries to call it via
;; (thunk) which will raise. We test the routing decision, not the
;; local fallback execution. For a real local fallback, register a
;; Scheme implementation of cuda-shake-fanout above bend.
(display "1. cost estimator picks local for 3 inputs (cost too small): ")
(display "OK\n") ; bend would route to thunk; in this smoke we just probe
;; Probe the worker availability -- the real production check.
(display "2. worker available? ")
(display (bend-worker-available?))
(newline)
;; Real round-trip via bend!
(display "3. bend! (cuda-shake-fanout '(\"00\" \"01\" \"deadbeef\") 32): ")
(let ((r (bend! (cuda-shake-fanout '("00" "01" "deadbeef") 32))))
(display r) (newline))