Skip to content
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

Remove dependency on abcBridge #1320

Merged
merged 33 commits into from
Jun 22, 2021
Merged

Remove dependency on abcBridge #1320

merged 33 commits into from
Jun 22, 2021

Conversation

atomb
Copy link
Contributor

@atomb atomb commented Jun 4, 2021

This PR removes the dependency of SAW on abcBridge. It preserves some of the existing SAW commands by including new features in the aig package for reading and writing AIGER files. For the moment, it does not preserve the cec command, as it wasn't widely used. We could implement it in terms of an external abc invocation if needed, though.

For the moment, this PR does not remove the abcBridge submodule because the build system currently still uses it to build the abc executable, even though it's no longer linked in as a library. Once some of the reusable CI infrastructure for solvers is done, we can use that instead of this submodule.

Closes #975.

@atomb atomb marked this pull request as ready for review June 14, 2021 20:25
@atomb atomb requested review from robdockins and brianhuffman June 14, 2021 20:25
Copy link
Contributor

@brianhuffman brianhuffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but we should also think about what documentation we should add along with it. It looks like multiple commands have switched status along the deprecated/current/experimental axis, so there should probably be at least something in the change log about that.

@@ -1314,7 +1307,7 @@ primitives = Map.fromList
]

, prim "abc" "ProofScript ()"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looks like you removed abc from pretty much all of the example scripts and such. Should this command be Deprecated instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still debating that, honestly. I've tried making abc map to w4_abc_aiger, w4_abc_smtlib2, and w4_abc_verilog, and there are always cases where at least one of the benchmarks that worked well with the old abc doesn't work well with that choice (though all benchmarks seem to work well with at least one prover, either a mode of ABC or Yices). So, does having abc still exist for backward compatibility make sense if it will sometimes work equally well and sometimes not? It's hard to say.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any interest in having the "best" solver for each example discovered automatically eventually? @kquick could be a good future use of the dependency reasoning automation you're working on.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ldettwy this is something that has been discussed but as I currently understand it, the likely approach will probably be to simultaneously submit the formula to multiple solvers and take the first responder. Other than specific functionality areas that may not be supported, it is difficult to predict which solvers will do better for a particular problem so it's unlikely that my constraint solver will be helpful in this regard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Cryptol has any and all solvers and we might want to adopt a similar approach in SAW.

And there are still a bunch of uses of abc in the integration tests, even though I changed a few. Also, many of the external verifications (s2n, AWS-LC, BLS, etc.) use it. So, given that it does still exist in some form, I'm inclined to leave it.

@atomb
Copy link
Contributor Author

atomb commented Jun 15, 2021

Looks good to me, but we should also think about what documentation we should add along with it. It looks like multiple commands have switched status along the deprecated/current/experimental axis, so there should probably be at least something in the change log about that.

Yep, good point! I'll add some change log stuff.

@atomb atomb added the PR: ready to merge Magic flag for pull requests to ask Mergify to merge given an approval and a successful CI run label Jun 17, 2021
Copy link
Contributor

@lisanna-dettwyler lisanna-dettwyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eyes glazed over for most of the haskell changes but everything else looks awesome! Pushed one commit to tweak the github actions checkout for building.

@@ -3,7 +3,7 @@ double_imp <- llvm_extract l "double_imp";
double_ref <- llvm_extract l "double_ref";
let thm = {{ \x -> double_ref x == double_imp x }};

r <- prove abc thm;
r <- prove yices thm;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is anything checking these exercises/tutorials? @benjaminselfridge could we eventually get something like https://github.com/GaloisInc/cryptol/blob/master/cryptol/CheckExercises.hs implemented for this if not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, there's an integration test that pulls them in. That's how I discovered that this would be a lot faster with Yices. :)

git submodule update --init
git -C deps/abcBridge submodule update --init
with:
submodules: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the original intent was to checkout only the abcBridge dependency and not the entire set of submodules, @ldettwy .

Aaron Tomb added 16 commits June 22, 2021 13:10
This introduces a `w4_abc_aiger` command that invokes ABC as an
external process on a generated AIGER file. Also makes `abc` a synonym
for `w4_abc_aiger`, so that it behaves similarly to how it did with
the `abcBridge`-based `abc` command (specifically, using the same
bit-blasting approach from the `aig` library).

Introducing this command required some refactoring to the types of many
of the prover interfaces, making functions that were in `IO` be in
`TopLevel`, instead. This generally seems to be a simplification.
@atomb atomb merged commit 99cb73a into master Jun 22, 2021
@atomb atomb deleted the at-remove-abc branch June 22, 2021 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: ready to merge Magic flag for pull requests to ask Mergify to merge given an approval and a successful CI run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove linked-in ABC
5 participants