Skip to content

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 04 Dec 00:41
· 53 commits to master since this release
a896e72

Most checks no longer need a Rust toolchain. CPU checks compile the model in-process with Cranelift, NVIDIA GPU checks need only the driver, and Apple silicon Macs check on the GPU through Metal. This release also adds TLC's command line (warpspec tlc) and exit codes, a pure-Rust front end that matches SANY, and most of TLC's other search modes: simulation, depth-first iterative deepening, -continue, checkpoints, state-graph dumps and coverage. New prebuilt binaries cover Intel Macs and Windows x64.

Breaking changes

  • Exit codes now follow TLC wherever TLC defines one. A PROPERTY that fails in an initial state or on a step ([][A]_v) exits 13, as TLC files it with liveness; 0.1.0 exited 12. A spec SANY rejects, or a missing spec file, exits 150, and a cfg TLC rejects exits 151; both used to exit 1. The full table is under TLC compatibility below.
  • The default CPU backend is now the Cranelift JIT, not a runner compiled with rustc. Pass --cpu-backend rustc (or set WARPSPEC_CPU_BACKEND=rustc) for the old path.
  • NVIDIA GPU checks no longer compile Rust kernels. warpspec writes the kernels as PTX itself and uses NVRTC only when needed (see below).
  • Without --slots, CPU runs size the fingerprint table themselves. The table starts at 2^20 slots (8 MiB), grows as it fills and spills to disk past a memory budget; 0.1.0 always reserved 2^27 slots (1 GiB). --slots N still fixes the size.
  • --int-bits accepts only 1 to 32, matching TLC's 32-bit integers, and --slots accepts at most 2^32.
  • Counterexample steps are named by the bare operator, as TLC prints them (RMPrepare, not RMPrepare(r1)). --json keeps the full call in each step's new call field.
  • Inputs TLC rejects are now rejected too: cfg substitutions of a variable or of an undefined name, substitution chains and cycles, and INSTANCEs that leave a constant or variable unsubstituted or substitute one twice.
  • Model libraries loaded with the runner's gen-cpu-bfs --lib PATH (not warpspec check --lib DIR, which adds a module search directory) use model ABI version 6. Versions 1 to 5 still load, but --dump-dot and --coverage need version 3 or later.
  • --json reports no longer carry unchecked_assumptions. An ASSUME the generator cannot evaluate now stops the check (exit 1) instead of passing with a warning.

Zero-toolchain execution and backends

  • warpspec check compiles a CPU check's model in-process with Cranelift, with no cargo, rustc or C compiler involved. A small spec's first check into an empty cache takes about 0.1 s (it took about 7 s with rustc), and a warm check of a small spec starts in about 10 ms. Search speed is within about 10% of a rustc build.
  • The JIT runs every CPU search mode and counterexample traces. It also runs the liveness pass (PROPERTY, WF, SF, ~>, initial-state and [][A]_v conjuncts), including under SYMMETRY, with the same verdicts, counts and lasso counterexamples as the rustc runner.
  • --cpu-backend auto|jit|c|rustc (or WARPSPEC_CPU_BACKEND) picks the compiler. auto, the default, tries the JIT first. A model the JIT cannot compile goes to a C compiler if one is on the machine (optional; WARPSPEC_CC, then clang, gcc, cc or zig cc), and otherwise to the rustc runner, with a note saying why. An explicit jit or c stops with the reason instead.
  • A few models still need the rustc runner. These are models with a VIEW, a state wider than 64 words, or liveness atoms the lowering cannot translate. With no cargo on PATH, such a check stops and explains why it needs Rust.
  • A checkpoint saved under one CPU backend resumes under any other.
  • When a check cannot use the GPU, stderr lists every reason with how to fix it, naming the variable, PROPERTY or flag and its location, and --json reports them in gpu_ineligible.
  • If the spec, cfg, modules and flags are unchanged, a cached check skips the generator (generate cached in the summary, cache.inputs_hit in --json).
  • Killing warpspec now kills the runner, compiler and generator it started. On Linux this holds under kill -9 too.

NVIDIA direct PTX and Apple silicon Metal

  • NVIDIA: warpspec writes the model's CUDA kernels as PTX in pure Rust, and the NVIDIA driver compiles them, so a GPU check needs only the driver. This covers sm_70 and newer, including states wider than 64 bits and Windows. Against NVRTC-compiled kernels, the search ran 1.6 to 1.8 times faster on PaxosCommit and LamportMutex, and within 6% on EWD998. The LamportMutex and EWD998 runs predate the GPU's refusal of CONSTRAINT checks on pruned states, so --gpu now refuses those configs and the default backend checks them on the CPU. --compact and --spill run on the GPU, and the PTX is cached per model.
  • NVRTC is needed only for --simulate, GPUs older than sm_70, and models the PTX emitter refuses. If no toolkit, Python wheel or cached copy is found, warpspec install-nvrtc, --install-nvrtc, WARPSPEC_INSTALL_NVRTC=1 or a yes at an interactive prompt downloads NVIDIA's redistributable NVRTC (13.5.37 or 12.9.86, whichever compiles for the GPU), checked against pinned SHA-256s. warpspec itself ships nothing of NVIDIA's. WARPSPEC_CUDA_BACKEND=ptx or nvrtc forces one compiler. See Direct PTX and Finding and installing NVRTC.
  • Apple silicon: on macOS 15 or later, --gpu and the default backend lower the model to Metal and search it in-process, with no Rust toolchain or Xcode. Metal checks safety and liveness (PROPERTY, WF/SF) and prints invariant, deadlock and lasso counterexamples from the GPU. It also runs --compact, --spill and --simulate, and the fingerprint table grows in place. See Metal and Metal liveness.
  • --frontier N sizes the GPU frontier buffers. A full buffer stops with a hint to raise it.
  • The default backend falls back to the CPU, and --gpu refuses, for anything the GPU does not run. That includes liveness PROPERTIES on NVIDIA, a VIEW, CONSTRAINT checks on pruned states, TLC's runtime operators, --no-deadlock, --continue, --dfid, --checkpoint, --dump-dot and --coverage. On NVIDIA, counterexample traces are rebuilt on the CPU. See When a check cannot use the GPU.

TLC compatibility and warpspec tlc

  • warpspec tlc [-option] Spec[.tla] takes TLC's command line, so scripts written for java tlc2.TLC can run warpspec instead. It reads TLC's search, checkpoint and output options and prints TLC's messages in TLC's order, framed with TLC's message codes under -tool. Options that only tune TLC are accepted with a warning, and options whose output warpspec cannot produce are refused by name.

  • warpspec check and warpspec tlc exit with TLC's codes:

    Outcome Exit
    No error 0
    Paused by Ctrl-C or SIGTERM under --checkpoint 3
    An ASSUME that is false, not a Boolean, or raises an error 10
    Deadlock 11
    An invariant, or a []P PROPERTY, violated 12
    A temporal PROPERTY, or one that fails in an initial state or on a step ([][A]_v), violated 13
    An error evaluating an action or computing a successor 75
    An error evaluating an invariant 76
    A spec SANY rejects, or a missing spec file 150
    A cfg TLC rejects 151
    Anything else that stops the check (usage, unsupported construct, capacity) 1

    Four differences from TLC remain. A failed Assert in an action exits 75 where TLC exits 14. An error evaluating Init exits 1 where TLC exits 75. An error evaluating a [][A]_v property exits 76 where TLC exits 14. --continue exits with its highest-ranked failure's code where TLC exits 0. See Exit codes and TLC's command line.

  • TLC's TLCGet("level"), TLCGet(i), TLCSet(i, v), Print and PrintT run during the CPU search, where TLC runs them. Printed lines appear before the result and in --json's prints. A model that calls TLCSet searches on one worker. Combinations whose effects TLC orders around a CONSTRAINT or ACTION_CONSTRAINT in a way warpspec cannot match are refused, naming the operator. See Runtime builtins.

  • The Java-implemented operators of TLC and the CommunityModules are evaluated in ASSUMEs and constant definitions instead of being refused. This covers ToString, SortSeq, IOEnv, the JSON and CSV operators and a seeded RandomElement, among others. A call that depends on the state is refused, with its location.

  • Counterexamples print through the cfg's ALIAS, as in TLC, in text and --json. See ALIAS.

  • False ASSUMEs are reported in TLC's words. ASSUMEs that fail an Assert, raise an error or are not Boolean exit 10 instead of being left unchecked.

  • Values are ordered as TLC orders them, so CHOOSE and iteration order match TLC. Evaluation errors such as a CHOOSE with no match, comparisons across incompatible kinds, an error computing a quantifier's domain, and errors inside ENABLED are raised where TLC raises them.

Language coverage and builtins

  • warpspec-syntax is a pure-Rust TLA+ parser and semantic checker ported from SANY. It accepts and rejects what SANY does, including user-defined operators, indentation-sensitive /\ and \/ lists, proofs, unicode and modules declared after the root in the same file. Its verdicts agree with SANY on 873 modules. The generator now uses it, so a spec SANY rejects is reported with SANY's message and location, and the TLAPS proof modules are built in. See docs/syntax.md.
  • The cfg reader matches TLC's and goes further. It reads operator tables (F(1, 2) = 7), negative integers, tuples and module-scoped values (X = [M]v). POSTCONDITION is refused.
  • VIEW is supported for safety checking, with fingerprints taken over the view as in TLC.
  • SYMMETRY covers sequences of records, nested values and variant records. Canonicalization is much faster, for example 12x on SimplifiedFastPaxos/Paxos.cfg and 61x on FastPaxos.cfg. Temporal PROPERTIES under SYMMETRY are checked over every state, which avoids verdicts TLC can get wrong over orbits; --skip-liveness keeps the reduction for safety.
  • Wider instance support, including parameterized instances of modules with variables and LAMBDA substitutions.
  • New data support:
    • Sparse sets over universes larger than 4,096 values, sized by a Cardinality(v) <= k bound.
    • Set filters, maps and UNION over runtime sets.
    • Functions whose domain changes at run time, such as bags and zero-based sequences.
    • Records whose fields differ by kind.
    • Sequences up to 128 bits wide.
    • Constant sets larger than 4,096 values.
    • SelectSeq with a test that reads state.
    • RECURSIVE operators evaluated up to 4,096 calls deep.
  • [][]P is checked as []P.
  • Of the 191 exhaustive tlaplus/Examples models, 153 now generate. 149 of those match TLC's counts or violation (136 exact counts and 13 violations), and none differs; the other 4 have no comparable TLC result. See docs/benchmarks.md.

Search modes, spilling and checkpointing

  • --simulate walks random behaviors, as TLC's -simulate does, with --num-traces (default 10,000), --depth (default 100) and --seed. A seed gives the same behaviors on the CPU, Metal and NVIDIA. See Simulation.
  • --dfid MAX_DEPTH searches by depth-first iterative deepening, as TLC's -dfid does, with matching distinct counts at every depth. See Depth-first iterative deepening.
  • --continue keeps searching past invariant violations, deadlocks and overflows. It then reports each failure with its count and a shortest trace, and --json lists them under violations. See Continuing past violations.
  • --checkpoint DIR saves the CPU search at level boundaries, every --checkpoint-interval seconds (300 by default), and on Ctrl-C or SIGTERM, which exits 3. --recover DIR resumes it to the exact counts and verdict of an uninterrupted run. See Pausing and resuming.
  • --compact BUCKETS --spill DIR moves the visited set and frontier into host memory and then files once they outgrow the compact table or GPU memory, with exact counts, on the CPU, Metal and NVIDIA. --spill-ram bounds host memory; it defaults to half of available memory, within a container's cgroup limit on Linux. See Spilling to host memory and disk.
  • --dump-dot PATH writes the state graph as Graphviz DOT in the form TLC's -dump dot,actionlabels writes. --coverage prints TLC-style per-action distinct:generated counts. See State graph and coverage.
  • --no-deadlock turns deadlock checking off at run time and reuses the cached model.
  • Counterexamples now cover more cases:
    • A liveness violation prints its lasso states as TLC does (lasso_trace in --json), using the shortest stem and cycle.
    • A violated [][A]_v PROPERTY prints a shortest behavior through the failing step.
    • Errors evaluating an invariant (76) or computing a successor (75) print the trace that leads to them.
  • --json adds mode, cpu_backend, prints, alias, simulation, coverage and stats.dfid.

Correctness and verification

  • Fixed:
    • \div by a negative divisor now floors, as TLC does.
    • A negative constant before an operation such as (-1) + (IF ...) is no longer evaluated as the negation of the whole sum.
    • A state past an invariant's integer bound now reports the invariant violated (12), not an encoding overflow (75).
    • CONSTRAINT and ACTION_CONSTRAINT now behave as in TLC: invariants and properties are also checked on the states and steps they prune, and several constraints are evaluated in cfg order.
    • [x \in S |-> e][k] evaluates e at k alone, so an error at another key no longer stops the run.
  • Every counterexample can be checked against TLC with cargo xtask verify validate-traces, which replays each trace step by step with TLC as an independent oracle.
  • Differential fuzzing against TLC runs nightly (cargo xtask fuzz diff), and cargo xtask fuzz plugs warpspec into FuzzTLA. See docs/fuzzing.md.
  • A cross-backend differential test holds the Cranelift, C, Metal and CUDA lowerings to rustc's results bit for bit, under UBSan and ASan.
  • Chaos, metamorphic, stress and sanitizer suites cover table sizing, spilling and thread counts, and CI runs on every pull request.

Packaging and platforms

  • Prebuilt binaries ship for Linux x64 and arm64 (glibc 2.28 or newer), macOS on Apple silicon and Intel (new), and Windows x64 (new).

  • Install with install.sh on Linux and macOS:

    curl -LSfs https://github.com/praveenperera/warpspec/releases/latest/download/install.sh | sh

    On Windows, use install.ps1 in PowerShell:

    & ([scriptblock]::Create((irm https://github.com/praveenperera/warpspec/releases/latest/download/install.ps1)))

    You can also use npx warpspec or npm install -g warpspec (new warpspec-darwin-x64 and warpspec-win32-x64-msvc packages).

  • On Windows the cache defaults to %LOCALAPPDATA%\warpspec, and bundled modules checked out with CRLF line endings are still recognized.