Repository navigation
v0.2.0
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 setWARPSPEC_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 Nstill fixes the size. --int-bitsaccepts only 1 to 32, matching TLC's 32-bit integers, and--slotsaccepts at most 2^32.- Counterexample steps are named by the bare operator, as TLC prints them (
RMPrepare, notRMPrepare(r1)).--jsonkeeps the full call in each step's newcallfield. - 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(notwarpspec check --lib DIR, which adds a module search directory) use model ABI version 6. Versions 1 to 5 still load, but--dump-dotand--coverageneed version 3 or later. --jsonreports no longer carryunchecked_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 checkcompiles 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]_vconjuncts), including under SYMMETRY, with the same verdicts, counts and lasso counterexamples as the rustc runner. --cpu-backend auto|jit|c|rustc(orWARPSPEC_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, thenclang,gcc,ccorzig cc), and otherwise to the rustc runner, with a note saying why. An explicitjitorcstops 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
--jsonreports them ingpu_ineligible. - If the spec, cfg, modules and flags are unchanged, a cached check skips the generator (
generate cachedin the summary,cache.inputs_hitin--json). - Killing
warpspecnow kills the runner, compiler and generator it started. On Linux this holds underkill -9too.
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_70and 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--gpunow refuses those configs and the default backend checks them on the CPU.--compactand--spillrun on the GPU, and the PTX is cached per model. - NVRTC is needed only for
--simulate, GPUs older thansm_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=1or 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=ptxornvrtcforces one compiler. See Direct PTX and Finding and installing NVRTC. - Apple silicon: on macOS 15 or later,
--gpuand 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,--spilland--simulate, and the fingerprint table grows in place. See Metal and Metal liveness. --frontier Nsizes the GPU frontier buffers. A full buffer stops with a hint to raise it.- The default backend falls back to the CPU, and
--gpurefuses, 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-dotand--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 forjava tlc2.TLCcan 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 checkandwarpspec tlcexit with TLC's codes:Outcome Exit No error 0 Paused by Ctrl-C or SIGTERM under --checkpoint3 An ASSUME that is false, not a Boolean, or raises an error 10 Deadlock 11 An invariant, or a []PPROPERTY, violated12 A temporal PROPERTY, or one that fails in an initial state or on a step ( [][A]_v), violated13 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
Assertin an action exits 75 where TLC exits 14. An error evaluating Init exits 1 where TLC exits 75. An error evaluating a[][A]_vproperty exits 76 where TLC exits 14.--continueexits 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),PrintandPrintTrun during the CPU search, where TLC runs them. Printed lines appear before the result and in--json'sprints. A model that callsTLCSetsearches 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 seededRandomElement, 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
CHOOSEand iteration order match TLC. Evaluation errors such as aCHOOSEwith no match, comparisons across incompatible kinds, an error computing a quantifier's domain, and errors insideENABLEDare raised where TLC raises them.
Language coverage and builtins
warpspec-syntaxis 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. VIEWis 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.cfgand 61x onFastPaxos.cfg. Temporal PROPERTIES under SYMMETRY are checked over every state, which avoids verdicts TLC can get wrong over orbits;--skip-livenesskeeps the reduction for safety. - Wider instance support, including parameterized instances of modules with variables and
LAMBDAsubstitutions. - New data support:
- Sparse sets over universes larger than 4,096 values, sized by a
Cardinality(v) <= kbound. - Set filters, maps and
UNIONover 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.
SelectSeqwith a test that reads state.RECURSIVEoperators evaluated up to 4,096 calls deep.
- Sparse sets over universes larger than 4,096 values, sized by a
[][]Pis 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
--simulatewalks random behaviors, as TLC's-simulatedoes, 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_DEPTHsearches by depth-first iterative deepening, as TLC's-dfiddoes, with matching distinct counts at every depth. See Depth-first iterative deepening.--continuekeeps searching past invariant violations, deadlocks and overflows. It then reports each failure with its count and a shortest trace, and--jsonlists them underviolations. See Continuing past violations.--checkpoint DIRsaves the CPU search at level boundaries, every--checkpoint-intervalseconds (300 by default), and on Ctrl-C or SIGTERM, which exits 3.--recover DIRresumes it to the exact counts and verdict of an uninterrupted run. See Pausing and resuming.--compact BUCKETS --spill DIRmoves 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-rambounds 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 PATHwrites the state graph as Graphviz DOT in the form TLC's-dump dot,actionlabelswrites.--coverageprints TLC-style per-actiondistinct:generatedcounts. See State graph and coverage.--no-deadlockturns 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_tracein--json), using the shortest stem and cycle. - A violated
[][A]_vPROPERTY 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.
- A liveness violation prints its lasso states as TLC does (
--jsonaddsmode,cpu_backend,prints,alias,simulation,coverageandstats.dfid.
Correctness and verification
- Fixed:
\divby 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]evaluateseatkalone, 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), andcargo xtask fuzzplugs 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.shon Linux and macOS:curl -LSfs https://github.com/praveenperera/warpspec/releases/latest/download/install.sh | shOn Windows, use
install.ps1in PowerShell:& ([scriptblock]::Create((irm https://github.com/praveenperera/warpspec/releases/latest/download/install.ps1)))
You can also use
npx warpspecornpm install -g warpspec(newwarpspec-darwin-x64andwarpspec-win32-x64-msvcpackages). -
On Windows the cache defaults to
%LOCALAPPDATA%\warpspec, and bundled modules checked out with CRLF line endings are still recognized.