-
Notifications
You must be signed in to change notification settings - Fork 76
Add pono backend to chisel formal for bmc #702
Conversation
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.
This looks really good!
The last remaining step is to add the pono
backend to the CI tests. There are two files you need to modify:
case Some(unknown) => throw new RuntimeException(s"Unknown formal engine: $unknown") chiseltest/.github/workflows/test.yml
Line 131 in b2d8908
backend: [z3, cvc4, btormc, bitwuzla]
In both places, please add pono
to the list of backends.
e6b73ae
to
74365bb
Compare
Looks like now a couple of tests are failing. You can run the tests locally by launching
|
I've noticed the tests are failing - pono seems to be acting very weirdly... I've rerun one of the tests on the .btor file for
It's found that the the property is unsatisfiable for each step but somehow returns unknown. This seems like a bug in pono (though I'm a bit wary of saying that). When running with the induction engine (thanks for the testing tip and the positive feedback, I'm newish to scala and only use it for chisel) |
It might be worth investigating why it returns that. It is possible that they return unknown because checking that the property holds for |
Another thing to be aware of: Last time I checked, which is now about 3 years ago, At least that was the idea. Looking at the code it seems like I never actually implemented that part of the system: https://github.com/ucb-bar/maltese-smt/blob/497f7ba057609bf637de6e4fa2de2a80826c0a0f/src/maltese/mc/TransitionSystem.scala#L88 |
Your former suggestion seems to be the case - it returns UNKNOWN for bmc: https://github.com/stanford-centaur/pono/blob/master/engines/bmc.cpp#L53-L77 I verified that this is the offending function by adding a print before the return. I think I'll need to add a function for the |
No worries. Take your time please and let me know if there are any other things I can help with. Thanks! |
Another thought: If the difference between |
I've managed to fix most of the tests by allowing pono to return 255 but some tests are failing assertions because they don't fail at the right step: https://github.com/ucb-bar/chiseltest/blob/main/src/test/scala/chiseltest/formal/UndefinedValuesTests.scala#L21. |
BMC should always fail at the exact same step, no matter which engine we are using. If pono fails at a different step than btormc, then that could mean that there is a bug in pono. It might be a good idea to get the |
Thanks for the explanation! I've made an issue on pono here: stanford-centaur/pono#320 - unfortunately, it does seem to be producing witnesses of incorrect size (usually one - offs) but it does seem to get to the bad state in the correct step (I think). Looking at the repo, there has been no activity for at least 2 years so I'm doubtful this will be fixed. What are the next steps? I could take a look into pono to see why it isn't producing a witness with an additional step but I don't fancy my chances. |
Unfortunately that might be the next step. You will definitely learn a lot and I assume that the needed change is going to be fairly small. Maybe if you make a PR with that change we can get someone at Stanford to merge it. The alternative would be that if you find that |
Use `--witness` to generate witness output rather than relying on `--vcd`
I've pushed my current changes though not all the tests pass as I've mentioned. I've looked into |
Awesome. Thanks!
Could you elaborate on that? Which test exactly fails and in what manner? |
Apologies for the slow response and also being a little vague.
This is the test I was refering to: https://github.com/ucb-bar/chiseltest/actions/runs/7602647013/job/20703458234?pr=702#step:5:570.
There's also a problem when using shiftregs instead of |
This sounds like a lot of problems and - as you said - I do remember that your initial goal was to add proofs to
You can find some more information on Please let me know how you want to proceed and how I can help you! Thanks for all the work you already have done! |
Yes, unfortunately this seemingly easy task has blown up right in my face. I did indeed only want k induction! I think I'll try to add k-induction support to btormc as that seems to be the easiest way forward. After which I may give custom k-induction a go but it's probably best to go one step at a time. Thanks for all your guidance and support thus far! I'll see what I can do for chiseltest in the coming week(s). |
Sounds great! Please feel free to ask if there is anything blocking you or you get stuck. Feel free to email me as well. |
Closing as we've reached a bit of a dead end - may be worth visiting in future if pono sees any future activity. |
The code is fairly straightforward as much of the existing btor code can be reused. The only real difference between the two btor2 backends is their command line invocation.
From here, it should be trivial to add k-induction as one will only need to change the engine from
bmc
toind
when runningpono
.Testing
I've run the Keepmax tests on the
pono
engine as well asbtormc
and they both succeed. I have also verified that upon editingKeepMax
to fail, a counterexample is generated by both engines.