-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable MIR Linker by default and adjust tests #1785
Enable MIR Linker by default and adjust tests #1785
Conversation
- intrinsics: Use legacy linker for some of them because of not so friendly messages. - performance: A few test are taking too long because of the new symbols being included in the analysis. Keep legacy linker for now. - integ-test: Using --tests with integration tests fail with MIR Linker. - fixme: Enable a few fixme tests and tests that were marked as verify-fail due to missing symbols. These run fine now with the linker.
I'm worried this might be a blocker. How much of a bother is this to fix? Do we need a fully solution to: i.e. Understanding the build graph better in |
Yeah, that's in the top of my list. I'll see if I can get a fix in today. Now that I think about it it would break whenever integration tests exists even without any proof harness. |
I created #1789 to fix the tests issue. Once that gets merged, I'll update the test in this PR to also use the MIR Linker |
kani-driver/src/args.rs
Outdated
/// The MIR Linker affects how Kani prunes the code to be analyzed. It also fixes previous | ||
/// issues with missing `std` function definitions. | ||
/// See <https://model-checking.github.io/kani/rfc/rfcs/0001-mir-linker.html> for more details. | ||
#[structopt(long, conflicts_with("legacy_linker"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we "hide" this option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
//! | ||
//! When enabling "--mir-linker", the error we currently get is: | ||
//! > Failed checks: Called `Option::unwrap()` on a `None` value | ||
//! This happens because of std debug checks. The `is_nonoverlapping` check has a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I wonder if we should just disable debug_assert
in our build of std
for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an interesting idea. It would help with this for now. It would be interesting to see how much more UB checks the std encode as debug_assert()
.
tests/kani/Refs/main.rs
Outdated
//! * working_directory: /Users/dsn/ws/RustToCBMC/src/RustToCBMC/rust-tests/cbmc-reg/Refs | ||
//! * value: 0 | ||
//! | ||
//! Note: This test takes too long with all the std symbols. Use --legacy-linker for now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the comment closer to the flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do. I am actually tempted to remove this random log from the comments. I can make sure the original ticket has it and just point to the ticket for more details. I didn't bother doing this here because I was worried about the size of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do, I don't think the log is that helpful.
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
// kani-flags: --enable-unstable --cbmc-args --unwind 4 --object-bits 9 | ||
// This test is to check if the description for undefined functions has been updated to "Function with missing definition is unreachable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this one doesn't work, shouldn't we keep a test for the property description? IIRC we had difficulty detecting it in the past. Or did this get replaced with a different test and I didn't notice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did keep two test for that. There is one test for the case of an extern
function and one for the --legacy-linker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Hide new arguments from `kani (-h|--help)`. 2. Update `cargo kani --tests` test to use the MIR Linker. 3. Update a few comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I would vote for temporarily disabling std debug_assert since the UX is bad, but I don't think that needs to be folded into this PR, and maybe is something we can slip to the next release.
Description of changes:
Enable
--mir-linker
by default. This change doesn't remove the option yet though to avoid breaking users harnesses. Introduce a--legacy-linker
to allow users to switch to the older linker to overcome performance issues as well as any possible issue with the MIR Linker.Resolved issues:
Resolves #1677
Resolves #1738
Resolves #1720
Related RFC:
#1588
Call-outs:
I had to adjust a bunch of tests for the following reasons:
debug_assert
is disabled in the standard library due to poor assertion messages #1740Testing:
How is this change tested? The regression
Is this a refactor change? No
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.