-
Notifications
You must be signed in to change notification settings - Fork 298
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
[HWToSMT] ArrayCreateOp and ArrayGetOp support #7666
base: main
Are you sure you want to change the base?
Conversation
Thank you for quickly working on adding this! Using array theory sounds interesting but IIRC array theory is fairly expensive compared to bitvector. I think there are several other representations and I'm curious if ordinary dataflow representation might make sense.
I created larger test case for (1) and (2) representation (https://gist.github.com/uenoku/7fcf89f676ff3d586204669c044ea924) and ran LEC against the module itself. LEC didn't finish for (1) within 2 minutes whereas it finished less than a second for (2). |
Thanks for this very cool performance analysis! There are definitely a lot of representations we can try and benchmark against each other. Staying within BV theory also has the advantage that we can use SMT solvers optimized for BV only and don't support array theory. There are two things about your concat+shru+extract version I'd like to point out:
Furthermore, we should be careful with benchmarking the approaches by just comparing the same circuit with itself. |
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.
i1 element types are the most convenient for this representation. For wider integers we'd additionally need a bitvector multiplication.
Yeah, that's a great point. I agree that using array theory is good for non-i1 integer arrays.
Out-of-bounds accesses are not handled correctly.
Yeah but can't we insert smt.ite
for this representation as well while lowering hw.array_get
?
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 think starting from simple solution is always great so lowering it to ArrayStore and ArraySelect look good to me! Maybe we can do something complicated in the future when array-theory does not scale well 😃
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! Very cool performance analysis @uenoku, agreed that it's worth getting this in for now and potentially moving to something more performant later!
Resolves #7664