Skip to content
lab-emiPublic

About

RustEDA circuit simulation: SoA device evaluation, topology-specialized sparse solvers and discrete adjoint sensitivity.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

41 Commits

Folders and files

Repository files navigation

RustSpice — Differentiable SPICE & adjoints

Clean-room, differentiable SPICE circuit simulation and discrete adjoint sensitivity analysis in Rust.
Documentation · RustEDA Suite · Benchmarks · Development Status · Apache-2.0

RustSpice pipeline: SPICE deck lowered into SoA device kernels and JIT sparse LU solvers to compute transient waveforms and adjoint gradients

Why RustSpice

RustSpice compiles SPICE netlists (.op, .dc, .tran) into contiguous Structure-of-Arrays (SoA) device kernels and topology-specialized sparse LU solvers, running 4.1–7.0× faster than ngspice-45 at half the memory while computing exact 1× LᵀUᵀ discrete adjoint gradients (∂V/∂θ) for analog sizing and AI-in-the-loop optimization.

Benchmark (receipt-backed) RustSpice Reference (ngspice-45 / 47) RustSpice delta
Extracted Ibex RC decks (10 decks, 173–5,614 unknowns) 4.1–7.0× faster Faster ngspice-45 solver 1.4–2.1× less peak RSS
Transient accuracy (same 10 RC decks, nominal grid) 10 / 10 PASS Tight reference Closer than default ngspice in 10/10 (6/10 own grid)
Broad ngspice-47 accuracy suite (951 decks) 857 PASS, 0 FAIL ngspice-47 16 documented gaps, 77 info, 1 unverified
Robustness fuzzing 400 random + 200 hostile — Explicit resource caps, zero panics

Receipts and session notes live in Benchmark Report, GPU Batch Report, and RustEDA Benchmarks.

Core Capabilities

  • Zero-copy strict SPICE parser & SSA device IR: Parses standard .op / .dc / .tran decks with expressions, .include, and explicit memory/time caps; lowers #[spice_device] models with auto-differentiated analytical Jacobians.
  • SoA SIMD + Cranelift JIT sparse LU: Conflict-free gather tables (CscGatherTable), deterministic f64 residual verification, adaptive transient integration with breakpoint tracking, and topology-specialized unrolled LU factorization.
  • Single-pass discrete adjoint sensitivities: Computes exact parameter gradients ∂V/∂θ via one LᵀUᵀ back-solve for circuit sizing, with optional zero-copy DLPack / Python bridge (rustspice-py) kept outside core Rust crates.
  • Platform-native backends: Deterministic pure-Rust cpu_ref first, plus optional native CUDA (SIMT / Tile) and Apple Metal (df64) batch DC kernels validated against cpu_ref.

Quick Start

# Build the CLI (or via superproject: ./dev build RustSpice --release)
cargo build --release -p rustspice-cli

# Run a CMOS ring oscillator transient simulation
target/release/rustspice run examples/cmos_ring_oscillator.sp --backend cpu

# Compute discrete adjoint sensitivities
target/release/rustspice adjoint examples/cmos_ring_oscillator.sp --target-node out

See Architecture, Benchmark Report, and GPU Batch Report.

Scope & Current Limits

  • Device models: Supports resistors, capacitors, inductors, independent/controlled sources, diodes, and Level-1 MOS. BJT, JFET, MESFET, BSIM4, and IHP PSP103 compact models are not yet supported (so Ibex comparisons cover extracted RC networks, not full transistor-level Ibex).
  • Session scope: Some single-host RC medians in the 2026-11-13 campaign carried noisy flags; detailed session metadata is retained in Development Status.
  • Core independence: rustspice-core and rustspice-solver never depend on Python or PyTorch (rustspice-py is a separate optional adapter crate).

License

Apache-2.0 — see LICENSE.

About

RustEDA circuit simulation: SoA device evaluation, topology-specialized sparse solvers and discrete adjoint sensitivity.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages