topos 0.13.1

An autodiff compiler stack in Rust.
Documentation
# Continuous integration: the same gates used locally before every
# commit — formatting, lints as errors across all targets (which also
# compile the benchmarks), and the test suite including doctests. The
# test steps name their targets: `--all-targets` implies `--benches`,
# which would execute every Criterion binary in test mode regardless
# of the targets' `test = false`.
name: CI

on:
  push:
    branches: [master]
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo fmt --check
      - run: cargo clippy --all-targets -- -D warnings
      - run: cargo test --lib --tests --examples
      # Named targets omit doctests, so they get their own run.
      - run: cargo test --doc
      # The simd and cuda backends are real on Linux — simd executes
      # its grid here, and cuda (no GPU on this runner) proves its
      # decline paths and skip guards live, falling through to simd.
      - run: cargo test --lib --tests --examples --features cuda,simd
      - run: cargo test --doc --features cuda,simd
      # The Apple backend features compile to safe stubs off macOS;
      # this keeps the stubs honest.
      - run: cargo clippy --all-targets --all-features -- -D warnings

  # The declared floor is a contract, so it is tested as one: the
  # default gate on exactly the `rust-version` toolchain. Backend
  # features may need newer toolchains and are not part of the floor.
  msrv:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@1.88
      - uses: Swatinem/rust-cache@v2
      - run: cargo test --lib --tests --examples
      - run: cargo test --doc

  # The Apple backends are real only on macOS; this job runs the
  # accelerate and metal grids, determinism, end-to-end training,
  # and the triple-feature chain order on Apple hardware. The
  # macos-26 image exposes the paravirtualized GPU (macos-14
  # reported no Metal device); the GPU tests skip cleanly wherever
  # the device is missing.
  check-macos:
    runs-on: macos-26
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - uses: Swatinem/rust-cache@v2
      - run: cargo clippy --all-targets --features accelerate,metal,simd -- -D warnings
      - run: cargo test --lib --tests --examples --features accelerate,metal,simd
      - run: cargo test --doc --features accelerate,metal,simd

  # Emission conformance runs for real: without a toolchain the
  # round-trip and execution tests pass vacuously, so this job
  # installs `jax` (whose bundled MLIR bindings carry the StableHLO
  # parser and reference interpreter) and points the suite's two
  # evaluator seams at the tools scripts. Every emitted module must
  # parse through an external parser and execute to the plan's own
  # results within the envelope.
  conformance:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install jax
      - run: cargo test emission
        env:
          TOPOS_STABLEHLO_VALIDATOR: python3 tools/validate-stablehlo.py
          TOPOS_STABLEHLO_EVALUATOR: python3 tools/eval-stablehlo.py