open-standards/jouleclaw/jouleclaw-rs/crates/jouleclaw-fabric/examples/discover.rs
Transaction Science 370f6653e2 jouleclaw-fabric: heterogeneous compute — hardware agnostic, hardware aware
The model file is inert. The runtime and its compute target are the
phenomenon. This crate is how the runtime KNOWS its compute — the
corrective to a CPU-only substrate in a family that built fabric
everywhere on purpose.

DETECT — live probes only: CPU/NEON (32 cores, bit-exact reference
oracle), AMX via a real cblas_sgemm probe, Metal GPU via MPS device
query (M3 Ultra).
REACH — what ambient credentials open, nothing contacted: CUDA fleets
(Nebius, Lambda, Thunder, AWS, GCP, Azure, OVH, Scaleway, Linode),
Groq LPU, Cerebras WSE, SambaNova RDU, Tenstorrent via Koyeb.
Reachable never serves without a live executor handshake.
PLACE — cheapest-sufficient applied to silicon: projected uJ per op
from per-member costs (Measured/Benchmarked/Estimated provenance,
never self-upgraded) + per-class dispatch floors + the measured m>=8
matrix-block crossover. Recurrences stay on CPU; batched matmuls go
to the matrix block.

HONESTY GATES (tested): Uncertified members cannot serve — the Metal
GPU is detected but refuses work until parity-certified against the
CPU oracle (next wave, then the BF16 forwards ask the fabric instead
of hard-coding NEON). Efficiency by abstention is DOA.

Live on this box (examples/discover):
  local/cpu-neon   Detected  BitExact          serving
  local/amx        Detected  Tolerance(128ulp) serving
  local/metal-gpu  Detected  Uncertified       gated

Also: backend-apple gains free-function sgemm_f32 and
mps_device_name/mps_matmul_fp32 re-exports. 11 tests. Costs are v0
projections; IOReport calibration lands with the loader integration.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-11 06:26:18 -04:00

41 lines
1.6 KiB
Rust

//! Print the compute fabric as seen from this process:
//! detected local silicon + credential-reachable remote
//! members, then a few sample placements.
//!
//! ```bash
//! cargo run --release -p jouleclaw-fabric --example discover
//! # with the infrastructure env loaded:
//! set -a; source path/to/.env; set +a
//! cargo run --release -p jouleclaw-fabric --example discover
//! ```
use jouleclaw_fabric::{place, Fabric, OpClass, OpDesc};
fn main() {
let fabric = Fabric::discover();
println!("compute fabric, as seen from this process:\n");
for m in &fabric.members {
println!(
" {:<16} {:?}/{:?} presence={:?} parity={:?}",
m.id, m.class, m.locality, m.presence, m.parity,
);
println!(" {:<16} {}", "", m.detail);
}
let serving: Vec<&str> = fabric.serving().map(|m| m.id.as_str()).collect();
println!("\nserving now (detected + local + certified): {serving:?}\n");
println!("sample placements:");
for (label, op) in [
("decode expert matmul (m=1, 4 MFLOP)",
OpDesc { class: OpClass::MatMul, flops: 4e6, m: 1 }),
("prefill projection (m=32, 1 GFLOP)",
OpDesc { class: OpClass::MatMul, flops: 1e9, m: 32 }),
("lm_head (m=1, 450 MFLOP)",
OpDesc { class: OpClass::MatMul, flops: 4.5e8, m: 1 }),
("SSD recurrence (1 GFLOP, sequential)",
OpDesc { class: OpClass::Recurrence, flops: 1e9, m: 1 }),
] {
let p = place(&fabric, &op);
println!(" {label:<44} → {}", p.because);
}
}