Skip to main content

bosdi — Batched OSDI

CI License: MIT Python 3.13 Platform: Linux | macOS | Windows Status: Experimental

Experimental — bosdi is under active development. The OSDI binary evaluation path is stable and well-tested, but the Verilog-A to JAX lowering compiler (bosdi.va) is in alpha and its API may change without notice. The VA lowering depends on a custom fork of OpenVAF that exposes the compiler's intermediate representation; this fork is not yet merged upstream.

Evaluate OSDI device models (Verilog-A compiled to .osdi binaries) in batched parallel via JAX.

Two evaluation paths

bosdi provides two ways to evaluate Verilog-A compact models inside JAX:

OSDI binary path (stable)

Loads a pre-compiled .osdi binary and evaluates N device instances in parallel via Rayon inside a JAX XLA custom call. The OSDI ABI provides analytical Jacobians with respect to node voltages only (conductances dI/dV, capacitances dQ/dV). A @custom_jvp rule makes jax.grad() work through node voltages — but not through model parameters or state.

from osdi_loader import load_osdi_model
from osdi_jax import osdi_eval

model = load_osdi_model("path/to/device.osdi")
N = 1024
voltages = jnp.zeros((N, model.num_nodes), dtype=jnp.float64)
params = jnp.full((N, model.num_params), jnp.nan, dtype=jnp.float64)
old_state = jnp.zeros((N, model.num_states), dtype=jnp.float64)

cur, cond, chg, cap, new_state = osdi_eval(model.id, voltages, params, old_state)

# jax.grad works through node voltages
grad_fn = jax.grad(lambda v: osdi_eval(model.id, v, params, old_state)[0].sum())

VA to JAX lowering (alpha)

Compiles Verilog-A source directly into pure JAX/Python, producing a function that is fully differentiable through all inputs — voltages, parameters, and temperature. This enables parameter optimization, sensitivity analysis, and end-to-end gradient-based design flows that the OSDI path cannot support.

Requires openvaf-r (a custom OpenVAF fork).

python -m bosdi.va device.va

When to use which

OSDI binary VA to JAX
Use case Circuit simulation (Newton solve) Parameter fitting, sensitivity analysis, inverse design
Differentiable w.r.t. Node voltages only Voltages, parameters, and temperature
Performance Fast — Rayon-parallel C/Rust, batched XLA FFI Pure Python/JAX — slower per-eval, but composable with jax.jit/jax.vmap
Maturity Stable Alpha
Dependencies None beyond bosdi openvaf-r fork

The OSDI path treats the compiled model as a black box and extracts only what the ABI exposes: currents, charges, and their Jacobians w.r.t. node voltages. This is exactly what a Newton solver needs, but the parameter axis is opaque to JAX — you cannot backpropagate through it.

The VA to JAX path exists to remove that limitation. By lowering the Verilog-A source into native JAX operations, every computation becomes visible to JAX's autodiff, making the model fully differentiable. This is what enables gradient-based parameter extraction, design-space exploration, and end-to-end optimization of circuits where device parameters are the degrees of freedom.

Architecture

OSDI path:
  Python: osdi_eval()  →  JAX XLA custom call
    →  C++ (nanobind/XLA FFI): unpack buffers
      →  Rust (Rayon): evaluate N devices in parallel
        →  OSDI binary: currents, conductances, charges, capacitances

VA path:
  Verilog-A source  →  openvaf-r (MIR dump)
    →  bosdi.va lowering + SCCP optimization
      →  Pure JAX/Python function (fully differentiable)

Installation

git clone https://github.com/gdsfactory/bosdi && cd bosdi
pixi run build

Using pip

pip install bosdi

Build & test

pixi run build   # compile Rust static lib + C++ extension
pixi run test    # run pytest suite

# single test
pixi run pytest tests/test_osdi.py::test_resistor_dc_evaluation -v

OSDI outputs

The OSDI path returns per-device arrays shaped by model.num_nodes (terminals + internal nodes + branch-current auxiliaries):

Output Shape Description
cur [N, num_nodes] Resistive current residual at each unknown
cond [N, num_nodes²] G = ∂cur/∂V Jacobian (flattened row-major)
chg [N, num_nodes] Charge residual at each unknown
cap [N, num_nodes²] C = ∂chg/∂V Jacobian (flattened row-major)

Pass jnp.nan for any parameter to use its Verilog-A default. Parameters can be addressed by name via model.param_names. See tests/test_bsim4_model_card.py for a full example.

Further reading

  • OSDI technical reference — parameter handling, model introspection, output layout, host-simulator integration (companion method vs MNA/DAE), and debug utilities

Limitations

  • Platform: Linux, macOS, and Windows; Python 3.11+; OSDI 0.4 ABI only. .osdi binaries are platform-specific — compile from .va sources via openvaf-r on each target
  • OSDI differentiability: jax.grad() works through node voltages only, not model parameters — use the VA path for parameter gradients
  • Stateful models (num_states > 0): evaluation is skipped and outputs are zeroed
  • VA lowering (alpha): user-defined analog function calls and noise contributions are not yet supported

Metadata

Release files for bosdi 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bosdi 0.1.6
File Size Uploaded
bosdi-0.1.6.tar.gz 243.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for bosdi 0.1.6
File
bosdi-0.1.6-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
bosdi-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
bosdi-0.1.6-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
bosdi-0.1.6-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
bosdi-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
bosdi-0.1.6-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details

Total release size: 8.7 MB

Release files / bosdi-0.1.6.tar.gz

Download URL bosdi-0.1.6.tar.gz
Size 243.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7a63606796355eaa11c4f2cc052611a458b17156bf928a1a0771f4c51858caba
BLAKE2b-256 checksum
How to use checksums
d84d3c9e3a3d461884774dcd2091dfa9d9da080a3724c00ca6a800212d664c71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / bosdi-0.1.6-cp313-cp313-win_amd64.whl

Download URL bosdi-0.1.6-cp313-cp313-win_amd64.whl
Size 365.2 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
091765e0e08ffa1ec2201bce62bdd755950bba96cbe29c42ee93899b172d5265
BLAKE2b-256 checksum
How to use checksums
07d9cac2d893407340f6db4470994dc9b4a3d2f54084d40e9719354421acf599
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / bosdi-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL bosdi-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl
Size 3.0 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
23f2d552eb253a9d6e55303446ce4241679bcc4eb0c6393109e70f40fb94dee5
BLAKE2b-256 checksum
How to use checksums
0c28ec4d9ca61f0f8902d551ccd13f8cbd5788198d0b1f0b80ae8ec3a4daf2b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / bosdi-0.1.6-cp313-cp313-macosx_11_0_arm64.whl

Download URL bosdi-0.1.6-cp313-cp313-macosx_11_0_arm64.whl
Size 861.9 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f217a59a6b1908cd54b69f4efd3f7bfd31f0d49d0626847a173ffc7626f2b7f9
BLAKE2b-256 checksum
How to use checksums
c96d89243f0d8a656b58c6b8b6eba337ec59a6ce139433868a46acd5774a23c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / bosdi-0.1.6-cp312-cp312-win_amd64.whl

Download URL bosdi-0.1.6-cp312-cp312-win_amd64.whl
Size 365.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
44b5cf07bf3059673a69f0f6750bc044eb3902a6beb78c737f9ea38449027bf0
BLAKE2b-256 checksum
How to use checksums
350a77b16c9b9fefb6433e90a8cd3f52b1d05ebc55d8ab15bc511a25cf9ea4fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / bosdi-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL bosdi-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl
Size 3.0 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e2badeaa05e9d66bc27f1c7aeb81d524bb69d770f73778328332cd295a39d854
BLAKE2b-256 checksum
How to use checksums
598ea75446930195fd41a7db27f602116fb96581525fde2c26a3880643250402
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / bosdi-0.1.6-cp312-cp312-macosx_11_0_arm64.whl

Download URL bosdi-0.1.6-cp312-cp312-macosx_11_0_arm64.whl
Size 861.8 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e6d417820424d43ca562c25caa4a308759c7594a7d6e1ac0e0902968efa94d42
BLAKE2b-256 checksum
How to use checksums
1ce722a82e3b28cea14d02ce2bfca3b11cc2bff426f7880be15046d5a574639e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.8

7 release files

This release

0.1.6 This release

7 release files

0.1.5

5 release files

0.1.3

7 release files

0.1.2

5 release files

0.1.1

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page