Skip to content

Commit 952d324

Browse files
Change default solver to CaDiCal (rust-lang#2654)
By default, Kani will now run CBMC with CaDiCaL, since this solver has outperformed Minisat in most of our benchmarks. User's should still be able to select Minisat (or a different solver) either by using `#[solver]` harness attribute or by passing `--solver=<SOLVER>` command line option. Co-authored-by: Zyad Hassan <[email protected]>
1 parent 0d0b234 commit 952d324

File tree

7 files changed

+30
-7
lines changed

7 files changed

+30
-7
lines changed

.github/workflows/kani.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ jobs:
9393

9494
- name: Execute Kani performance tests
9595
run: ./scripts/kani-perf.sh
96+
env:
97+
RUST_TEST_THREADS: 1
9698

9799
bookrunner:
98100
runs-on: ubuntu-20.04

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ This file contains notable changes (e.g. breaking changes, major changes, etc.)
44

55
This file was introduced starting Kani 0.23.0, so it only contains changes from version 0.23.0 onwards.
66

7+
## [0.34.0]
8+
9+
### Breaking Changes
10+
* Change default solver to CaDiCaL by @celinval in https://github.com/model-checking/kani/pull/2557
11+
By default, Kani will now run CBMC with CaDiCaL, since this solver has outperformed Minisat in most of our benchmarks.
12+
User's should still be able to select Minisat (or a different solver) either by using `#[solver]` harness attribute,
13+
or by passing `--solver=<SOLVER>` command line option.
14+
15+
## What's Changed
16+
17+
**Full Changelog**: https://github.com/model-checking/kani/compare/kani-0.33.0...kani-0.34.0
18+
719
## [0.33.0]
820

921
## What's Changed

docs/src/reference/attributes.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ VERIFICATION:- SUCCESSFUL
203203
This may change the verification time required to verify a harness.
204204

205205
At present, `<solver>` can be one of:
206-
- `minisat` (default): [MiniSat](http://minisat.se/).
207-
- `cadical`: [CaDiCaL](https://github.com/arminbiere/cadical).
206+
- `minisat`: [MiniSat](http://minisat.se/).
207+
- `cadical` (default): [CaDiCaL](https://github.com/arminbiere/cadical).
208208
- `kissat`: [kissat](https://github.com/arminbiere/kissat).
209209
- `bin="<SAT_SOLVER_BINARY>"`: A custom solver binary, `"<SAT_SOLVER_BINARY>"`, that must be in path.
210210

@@ -226,6 +226,11 @@ fn check() {
226226

227227
Changing the solver may result in different verification times depending on the harness.
228228

229+
Note that the default solver may vary depending on Kani's version.
230+
We highly recommend users to annotate their harnesses if the choice of solver
231+
has a major impact on performance, even if the solver used is the current
232+
default one.
233+
229234
## `#[kani::stub(<original>, <replacement>)]`
230235

231236
**Replaces the function/method with name <original> with the function/method with name <replacement> during compilation**

kani-driver/src/args/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ pub struct VerificationArgs {
208208
#[arg(long, requires("harnesses"))]
209209
pub unwind: Option<u32>,
210210
/// Specify the CBMC solver to use. Overrides the harness `solver` attribute.
211+
/// If no solver is specified (with --solver or harness attribute), Kani will use CaDiCaL.
211212
#[arg(long, value_parser = CbmcSolverValueParser::new(CbmcSolver::VARIANTS))]
212213
pub solver: Option<CbmcSolver>,
213214
/// Pass through directly to CBMC; must be the last flag.

kani-driver/src/call_cbmc.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ use crate::cbmc_output_parser::{
1616
use crate::cbmc_property_renderer::{format_coverage, format_result, kani_cbmc_output_filter};
1717
use crate::session::KaniSession;
1818

19+
/// We will use Cadical by default since it performed better than MiniSAT in our analysis.
20+
/// Note: Kissat was marginally better, but it is an external solver which could be more unstable.
21+
static DEFAULT_SOLVER: CbmcSolver = CbmcSolver::Cadical;
22+
1923
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
2024
pub enum VerificationStatus {
2125
Success,
@@ -206,8 +210,7 @@ impl KaniSession {
206210
} else if let Some(solver) = harness_solver {
207211
solver
208212
} else {
209-
// Nothing to do
210-
return Ok(());
213+
&DEFAULT_SOLVER
211214
};
212215

213216
match solver {

tests/ui/concrete-playback/message-order/expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Concrete playback unit test for `dummy`:
66
#[test]
77
fn kani_concrete_playback_dummy
88
let concrete_vals: Vec<Vec<u8>> = vec![
9-
// 32778
10-
vec![10, 128, 0, 0],
9+
// 10
10+
vec![10, 0, 0, 0],
1111
];
1212
kani::concrete_playback_run(concrete_vals, dummy);
1313
}

tests/ui/concrete-playback/message-order/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
#[kani::proof]
77
fn dummy() {
8-
kani::cover!(kani::any::<u32>() != 10);
8+
kani::cover!(kani::any::<u32>() == 10);
99
}

0 commit comments

Comments
 (0)