[circt-bmc] Add verif.contract support#9800
Draft
robert-at-pretension-io wants to merge 1 commit intollvm:mainfrom
Draft
[circt-bmc] Add verif.contract support#9800robert-at-pretension-io wants to merge 1 commit intollvm:mainfrom
robert-at-pretension-io wants to merge 1 commit intollvm:mainfrom
Conversation
circt-bmc currently handles verif.formal ops (added in llvm#9145) but not verif.contract ops. Running circt-bmc on a module containing a verif.contract fails at ConvertHWToSMT because the apply-mode hw.module produced by LowerContracts is still present when the HW dialect is marked illegal. This patch adds contract support with two small changes: 1. circt-bmc.cpp: Add LowerContractsPass to the pipeline before LowerTests. LowerContracts splits each contract into a verif.formal check block and an apply-mode hw.module; the existing LowerTests then converts the verif.formal into an hw.module that BMC can target. 2. LowerToBMC.cpp: After absorbing the target hw.module into a verif.bmc op, erase any remaining hw.module/hw.module.extern ops. Without this, the leftover apply-mode modules cause ConvertHWToSMT to fail. Usage: circt-bmc input.mlir --module <Name>_CheckContract_0 -b <bound> --run The check module name is generated by LowerContracts (pattern: <OriginalModule>_CheckContract_<N>).
Member
|
This is cool! Thanks for adding support for this! One thing I want to note is that the goal of contracts is to decouple modules from each other during verification as to enable
So correctly adding support for this would probably also require supporting running verification for each module/formal in parallel such that: if all are unsat -> success; the moment one is sat -> fail and produce witness. This should hopefully allow for much more scalability in the cases where individual modules are instantiated a bunch of times. You might also want to somehow share learned clauses across solver instances if you're taking this route, but that would be another optimization. |
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.
circt-bmc currently handles verif.formal ops (added in #9145) but not verif.contract ops. Running circt-bmc on a module containing a verif.contract fails at ConvertHWToSMT because the apply-mode hw.module produced by LowerContracts is still present when the HW dialect is marked illegal.
This patch adds contract support with two small changes:
Usage: circt-bmc input.mlir --module _CheckContract_0 -b --run
The check module name is generated by LowerContracts (pattern: CheckContract).