Pass --compact-trace to CBMC for concrete playback - #4680
Open
tautschnig wants to merge 1 commit into
Open
Conversation
Concrete playback disables --slice-formula (traces from sliced formulas contain arbitrary values, model-checking#1288) and requests a full trace. On contract-heavy harnesses the resulting JSON trace is dominated by the values of hidden instrumentation steps: for the write_bytes harness from model-checking/verify-rust-std the trace weighs 427 MB, of which Kani consumes only the kani::any_raw_* return-value assignments (57 KB) - everything else is built, serialized and parsed for nothing, accounting for more than half of the end-to-end playback time. Pass --compact-trace in playback mode: CBMC's compact trace drops hidden steps and actual-parameter assignments while retaining regular assignments - a strict superset of what the playback parser reads. With a CBMC that honors the option in JSON mode, the trace shrinks to 3 MB and end-to-end playback time halves (46s to 23s), producing an identical generated unit test. The CBMC-side change is diffblue/cbmc#9135; CBMC versions that do not honor --compact-trace with --json-ui accept and ignore the option, so this change is compatible with the currently pinned CBMC and becomes effective once the CBMC pin reaches a release containing that fix. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This change optimizes Kani’s concrete playback workflow by reducing the size (and parsing cost) of CBMC JSON traces, which in turn improves end-to-end playback performance on contract-heavy harnesses.
Changes:
- In concrete playback mode, pass
--compact-traceto CBMC alongside--traceto drop hidden/instrumentation-heavy steps from the trace while retaining the assignments concrete playback consumes. - Document the rationale and compatibility expectations with CBMC versions that accept but may ignore
--compact-traceunder--json-ui.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Concrete playback disables --slice-formula (traces from sliced formulas contain arbitrary values, #1288) and requests a full trace. On contract-heavy harnesses the resulting JSON trace is dominated by the values of hidden instrumentation steps: for the write_bytes harness from model-checking/verify-rust-std the trace weighs 427 MB, of which Kani consumes only the kani::any_raw_* return-value assignments (57 KB)
Pass --compact-trace in playback mode: CBMC's compact trace drops hidden steps and actual-parameter assignments while retaining regular assignments - a strict superset of what the playback parser reads. With a CBMC that honors the option in JSON mode, the trace shrinks to 3 MB and end-to-end playback time halves (46s to 23s), producing an identical generated unit test. The CBMC-side change is diffblue/cbmc#9135; CBMC versions that do not honor --compact-trace with --json-ui accept and ignore the option, so this change is compatible with the currently pinned CBMC and becomes effective once the CBMC pin reaches a release containing that fix.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.