-
Notifications
You must be signed in to change notification settings - Fork 44
3813 add selected hooks for INT, BOOL, MAP, LIST #3828
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
Conversation
booster/library/Booster/Builtin.hs
Outdated
intTerm :: Integer -> Term | ||
intTerm = DomainValue SortInt . pack . show | ||
|
||
readIntTerm :: Term -> Maybe Integer | ||
readIntTerm (DomainValue SortInt val) = readMaybe (unpack val) | ||
readIntTerm _other = Nothing |
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.
Obviously these hooks would be faster if we had an internal type holding an Integer
, instead of reading and showing the values for every operation.
Currently the IMP-sum-to-n test is still 30% faster with the LLVM backend than it is without.
A tiny bit of slowdown in KEVM (if not measurement noise)
|
With one more (previously-missing) hook
Results for MX Backend are showing improvements:
(The |
503e19d
to
34a5867
Compare
Update the key-value association of an internal `KMap` with a new value if the key is (syntactically) present (assumes bottom-up evaluation). Otherwise: * If the map has an opaque part, no result is returned; * If the map has unevaluated key data, no result is returned; * Otherwise, the key is certain to be absent in the map. A new association pair is added to the list
34a5867
to
e095e9c
Compare
92e7232
to
e86bae4
Compare
@@ -2,88 +2,6 @@ | |||
{"tag":"simplification","result":{"tag":"success","rule-id":"f310443b160236f56d095576a7500c11d1e98ee7af349b0bbf7a34b5e444d300"},"origin":"booster"} | |||
{"tag":"simplification","result":{"tag":"failure","reason":"RuleNotPreservingDefinedness","rule-id":"3b51b2998e8ebe79b88550ea9d27ca95003744019b16b93d17a55f6f9bcaa12a"},"origin":"booster"} | |||
{"tag":"simplification","result":{"tag":"failure","reason":"RuleNotPreservingDefinedness","rule-id":"1170b8c2f6d770eecb12b2ffb28275ed94ae1451d0ae3f2b42e570cd198099fa"},"origin":"booster"} | |||
{"tag":"simplification","result":{"tag":"failure","reason":"Failed match","rule-id":"c2682318552299808618ea1106c22cf9df82485521eaf5e58844a16e0d4550e4"},"origin":"booster"} |
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.
Am I right to understand that we are evaluating certain things with the hooks, whereas before we attempted to apply rules from domains.md
?
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.
Correct, the hook is tried first (if one exists), and if the hook returns a result, no equations are tried.
|
…k-and-hook-refactoring
readIntTerm :: Term -> Maybe Integer | ||
readIntTerm (DomainValue SortInt val) = readMaybe (unpack val) | ||
readIntTerm _other = Nothing |
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.
definitely not the scope of this PR, but perhaps we should make an issue about making ints an internalised value?
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.
#3848 created to track this
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.
Truly monumental work with all those tests!
Re-tested with latest version of
|
Context: #3813
Adds a number of hooks (as per documentation in https://github.com/runtimeverification/haskell-backend/blob/master/docs/hooks.md) and splits the
Booster.Builtin
module into several parts.Bool
: all hooked operations implementedInt
: selected binary and unary operations and comparisonsList
:get
(indexing) andsize
Map
: all hooked operations exceptremoveAll
andkeys
(which would require using internal sets)