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

[Builtins] Add 'MakeBuiltinMeaning' and type errors doctests #4649

Merged
merged 1 commit into from
May 26, 2022

Conversation

effectfully
Copy link
Contributor

This polishes the PlutusCore.Builtin.Meaning module and adds another tool to PlutusCore.Builtin.Debug allowing us to debug the whole BuiltinMeaning inference pipeline.

@effectfully effectfully requested review from michaelpj and zliu41 May 24, 2022 22:55
@effectfully effectfully force-pushed the effectfully/builtins/add-MakeBuiltinMeaning branch from 8b7de14 to 1fa9f51 Compare May 24, 2022 22:57
@effectfully
Copy link
Contributor Author

Sorry, don't review yet, I need to fix something.

@effectfully effectfully force-pushed the effectfully/builtins/add-MakeBuiltinMeaning branch from 1fa9f51 to 108bac9 Compare May 24, 2022 23:45
@effectfully
Copy link
Contributor Author

/benchmark plutus-benchmark:validation

@iohk-devops
Copy link

Comparing benchmark results of 'plutus-benchmark:validation' on '207a979bd' (base) and '108bac959' (PR)

Results table
Script 207a979 108bac9 Change
auction_1-1 202.3 μs 198.8 μs -1.7%
auction_1-2 817.7 μs 814.4 μs -0.4%
auction_1-3 806.8 μs 802.1 μs -0.6%
auction_1-4 260.1 μs 254.2 μs -2.3%
auction_2-1 203.4 μs 198.9 μs -2.2%
auction_2-2 813.9 μs 810.5 μs -0.4%
auction_2-3 1.035 ms 1.030 ms -0.5%
auction_2-4 799.0 μs 801.4 μs +0.3%
auction_2-5 258.1 μs 254.0 μs -1.6%
crowdfunding-success-1 236.2 μs 233.0 μs -1.4%
crowdfunding-success-2 236.2 μs 233.4 μs -1.2%
crowdfunding-success-3 235.0 μs 233.3 μs -0.7%
currency-1 298.2 μs 296.2 μs -0.7%
escrow-redeem_1-1 424.7 μs 425.1 μs +0.1%
escrow-redeem_1-2 427.5 μs 425.4 μs -0.5%
escrow-redeem_2-1 500.8 μs 501.0 μs +0.0%
escrow-redeem_2-2 502.1 μs 500.6 μs -0.3%
escrow-redeem_2-3 502.2 μs 500.9 μs -0.3%
escrow-refund-1 177.7 μs 176.2 μs -0.8%
future-increase-margin-1 298.6 μs 297.8 μs -0.3%
future-increase-margin-2 674.7 μs 673.9 μs -0.1%
future-increase-margin-3 676.2 μs 673.8 μs -0.4%
future-increase-margin-4 632.8 μs 633.6 μs +0.1%
future-increase-margin-5 1.002 ms 1.006 ms +0.4%
future-pay-out-1 298.2 μs 296.8 μs -0.5%
future-pay-out-2 673.4 μs 672.7 μs -0.1%
future-pay-out-3 674.5 μs 673.1 μs -0.2%
future-pay-out-4 998.4 μs 1.002 ms +0.4%
future-settle-early-1 297.8 μs 296.0 μs -0.6%
future-settle-early-2 673.7 μs 670.7 μs -0.4%
future-settle-early-3 671.8 μs 671.4 μs -0.1%
future-settle-early-4 762.3 μs 765.4 μs +0.4%
game-sm-success_1-1 482.5 μs 481.4 μs -0.2%
game-sm-success_1-2 219.1 μs 217.0 μs -1.0%
game-sm-success_1-3 801.7 μs 803.5 μs +0.2%
game-sm-success_1-4 231.1 μs 228.3 μs -1.2%
game-sm-success_2-1 482.3 μs 480.4 μs -0.4%
game-sm-success_2-2 219.0 μs 217.5 μs -0.7%
game-sm-success_2-3 803.2 μs 801.4 μs -0.2%
game-sm-success_2-4 231.9 μs 227.1 μs -2.1%
game-sm-success_2-5 807.1 μs 800.2 μs -0.9%
game-sm-success_2-6 232.4 μs 227.9 μs -1.9%
multisig-sm-1 503.0 μs 498.0 μs -1.0%
multisig-sm-2 486.8 μs 487.3 μs +0.1%
multisig-sm-3 491.8 μs 492.2 μs +0.1%
multisig-sm-4 497.9 μs 499.4 μs +0.3%
multisig-sm-5 710.0 μs 716.6 μs +0.9%
multisig-sm-6 500.4 μs 498.6 μs -0.4%
multisig-sm-7 486.1 μs 485.2 μs -0.2%
multisig-sm-8 489.4 μs 490.0 μs +0.1%
multisig-sm-9 497.4 μs 495.4 μs -0.4%
multisig-sm-10 711.8 μs 711.5 μs -0.0%
ping-pong-1 408.1 μs 406.4 μs -0.4%
ping-pong-2 407.7 μs 405.9 μs -0.4%
ping-pong_2-1 237.3 μs 236.0 μs -0.5%
prism-1 183.1 μs 180.3 μs -1.5%
prism-2 521.8 μs 517.0 μs -0.9%
prism-3 440.7 μs 435.9 μs -1.1%
pubkey-1 156.2 μs 153.8 μs -1.5%
stablecoin_1-1 1.102 ms 1.103 ms +0.1%
stablecoin_1-2 215.2 μs 212.0 μs -1.5%
stablecoin_1-3 1.255 ms 1.256 ms +0.1%
stablecoin_1-4 228.1 μs 226.4 μs -0.7%
stablecoin_1-5 1.565 ms 1.587 ms +1.4%
stablecoin_1-6 282.0 μs 279.4 μs -0.9%
stablecoin_2-1 1.099 ms 1.107 ms +0.7%
stablecoin_2-2 214.5 μs 213.3 μs -0.6%
stablecoin_2-3 1.255 ms 1.265 ms +0.8%
stablecoin_2-4 228.7 μs 226.4 μs -1.0%
token-account-1 223.0 μs 221.4 μs -0.7%
token-account-2 397.1 μs 393.8 μs -0.8%
uniswap-1 508.1 μs 505.6 μs -0.5%
uniswap-2 260.0 μs 257.8 μs -0.8%
uniswap-3 2.036 ms 2.031 ms -0.2%
uniswap-4 378.2 μs 370.4 μs -2.1%
uniswap-5 1.402 ms 1.392 ms -0.7%
uniswap-6 364.6 μs 356.7 μs -2.2%
vesting-1 428.2 μs 427.5 μs -0.2%

@effectfully
Copy link
Contributor Author

^ looks like a tiny speedup, but I don't see why this PR would give us a speedup, so must be noise.

Ready for review.

@effectfully effectfully requested review from michaelpj and zliu41 May 25, 2022 07:58
-- <interactive>:1:1: error:
-- • A built-in function must take at least one type or term argument
-- ‘Bool’ is a built-in type so you can embed any of its values as a constant
-- If you still want a built-in function, add a dummy ‘()’ argument
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be nice to turn those into actual doctests, but that's definitely not for now.

-- Are you trying to define a polymorphic built-in function over a polymorphic type?
-- In that case you need to wrap all polymorphic built-in types having type variables
-- in them with either ‘SomeConstant’ or ‘Opaque’ depending on whether its the type
-- of an argument or the type of the result, respectively
Copy link
Member

Choose a reason for hiding this comment

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

This sounds like the distinction between SomeConstant and Opaque is that one is for argument and the other is for result, but that's not the case, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not the case, but previously it was the case that if you were dealing with a polymorphic built-in type, you had to always use SomeConstant for the argument and Opaque for the result for efficiency reasons. I'm not sure if there's any difference now that we've done so much work on making sure everything related to builtins is properly inlined. I will check that separately. Created PLT-290.

@effectfully effectfully merged commit e419a28 into master May 26, 2022
@effectfully effectfully deleted the effectfully/builtins/add-MakeBuiltinMeaning branch May 26, 2022 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants