-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLT-8659 UPLC term order evaluator takes into account builtin argumen…
…t saturation (#5850) * UPLC term order evaluator takes into account builtin argument saturation * Use factual builtin arity when doing CSE * Changelog entry
- Loading branch information
Showing
34 changed files
with
410 additions
and
359 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-10.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 282508764 | ||
| mem: 856552}) | ||
({cpu: 281818764 | ||
| mem: 853552}) |
4 changes: 2 additions & 2 deletions
4
plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-100.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 23474602554 | ||
| mem: 69678832}) | ||
({cpu: 23467702554 | ||
| mem: 69648832}) |
4 changes: 2 additions & 2 deletions
4
plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-5.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 85015834 | ||
| mem: 263092}) | ||
({cpu: 84670834 | ||
| mem: 261592}) |
4 changes: 2 additions & 2 deletions
4
plutus-benchmark/lists/test/Lookup/9.6/match-builtin-list-50.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 5996604004 | ||
| mem: 17844232}) | ||
({cpu: 5993154004 | ||
| mem: 17829232}) |
4 changes: 2 additions & 2 deletions
4
plutus-benchmark/lists/test/Lookup/9.6/match-scott-list-10.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 188350620 | ||
| mem: 557080}) | ||
({cpu: 187660620 | ||
| mem: 554080}) |
4 changes: 2 additions & 2 deletions
4
plutus-benchmark/lists/test/Lookup/9.6/match-scott-list-100.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 14193534300 | ||
| mem: 39720400}) | ||
({cpu: 14186634300 | ||
| mem: 39690400}) |
4 changes: 2 additions & 2 deletions
4
plutus-benchmark/lists/test/Lookup/9.6/match-scott-list-5.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 61018710 | ||
| mem: 188240}) | ||
({cpu: 60673710 | ||
| mem: 186740}) |
4 changes: 2 additions & 2 deletions
4
plutus-benchmark/lists/test/Lookup/9.6/match-scott-list-50.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 3672944700 | ||
| mem: 10355000}) | ||
({cpu: 3669494700 | ||
| mem: 10340000}) |
4 changes: 2 additions & 2 deletions
4
...antics/9.6/18cefc240debc0fcab14efdd451adfd02793093efe7bc76d6322aed6ddb582ad.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 951958685 | ||
| mem: 3466381}) | ||
({cpu: 951682685 | ||
| mem: 3465181}) |
4 changes: 2 additions & 2 deletions
4
...antics/9.6/82213dfdb6a812b40446438767c61a388d2c0cfd0cbf7fd4a372b0dc59fa17e1.budget.golden
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
({cpu: 1499682480 | ||
| mem: 4967076}) | ||
({cpu: 1499268480 | ||
| mem: 4965276}) |
3 changes: 3 additions & 0 deletions
3
plutus-core/changelog.d/20240326_133744_Yuriy.Lazaryev_term_eval_order_builtin.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Changed | ||
|
||
- Partially applied builtins are estimated to be pure and work-free to better inform other optimizations, e.g. common subexpression elimination. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,36 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
module PlutusCore.Compiler ( | ||
compileTerm | ||
, compileProgram | ||
, CompilationOpts (..) | ||
, coSimplifyOpts | ||
, defaultCompilationOpts | ||
) where | ||
module PlutusCore.Compiler | ||
( module Opts | ||
, compileTerm | ||
, compileProgram | ||
) where | ||
|
||
import PlutusCore.Compiler.Erase | ||
import PlutusCore.Compiler.Types | ||
import PlutusCore.Core | ||
import PlutusCore.Name.Unique | ||
import PlutusCore.Rename | ||
import UntypedPlutusCore.Core qualified as UPLC | ||
import UntypedPlutusCore.Core.Type qualified as UPLC | ||
import UntypedPlutusCore.Simplify qualified as UPLC | ||
|
||
import Control.Lens | ||
import Control.Monad.Reader | ||
|
||
newtype CompilationOpts name a = CompilationOpts { _coSimplifyOpts :: UPLC.SimplifyOpts name a } | ||
deriving stock (Show) | ||
|
||
makeLenses ''CompilationOpts | ||
|
||
defaultCompilationOpts :: CompilationOpts name a | ||
defaultCompilationOpts = CompilationOpts { _coSimplifyOpts = UPLC.defaultSimplifyOpts } | ||
import Control.Lens (view) | ||
import Control.Monad.Reader (MonadReader) | ||
import PlutusCore.Compiler.Opts as Opts | ||
|
||
-- | Compile a PLC term to UPLC, and optimize it. | ||
compileTerm | ||
:: (Compiling m uni fun name a, MonadReader (CompilationOpts name a) m) | ||
=> Term tyname name uni fun a | ||
-> m (UPLC.Term name uni fun a) | ||
:: (Compiling m uni fun name a, MonadReader (CompilationOpts name fun a) m) | ||
=> Term tyname name uni fun a | ||
-> m (UPLC.Term name uni fun a) | ||
compileTerm t = do | ||
simplOpts <- asks _coSimplifyOpts | ||
let erased = eraseTerm t | ||
renamed <- rename erased | ||
UPLC.simplifyTerm simplOpts renamed | ||
simplOpts <- view coSimplifyOpts | ||
builtinSemanticsVariant <- view coBuiltinSemanticsVariant | ||
let erased = eraseTerm t | ||
renamed <- rename erased | ||
UPLC.simplifyTerm simplOpts builtinSemanticsVariant renamed | ||
|
||
-- | Compile a PLC program to UPLC, and optimize it. | ||
compileProgram | ||
:: (Compiling m uni fun name a, MonadReader (CompilationOpts name a) m) | ||
=> Program tyname name uni fun a | ||
-> m (UPLC.Program name uni fun a) | ||
:: (Compiling m uni fun name a, MonadReader (CompilationOpts name fun a) m) | ||
=> Program tyname name uni fun a | ||
-> m (UPLC.Program name uni fun a) | ||
compileProgram (Program a v t) = UPLC.Program a v <$> compileTerm t |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module PlutusCore.Compiler.Opts | ||
( CompilationOpts (..) | ||
, coSimplifyOpts | ||
, coBuiltinSemanticsVariant | ||
, defaultCompilationOpts | ||
) where | ||
|
||
import Control.Lens (makeLenses) | ||
import Data.Default.Class (Default (def)) | ||
import PlutusCore.Builtin.Meaning (BuiltinSemanticsVariant) | ||
import UntypedPlutusCore.Simplify.Opts (SimplifyOpts, defaultSimplifyOpts) | ||
|
||
data CompilationOpts name fun a = CompilationOpts | ||
{ _coSimplifyOpts :: SimplifyOpts name a | ||
, _coBuiltinSemanticsVariant :: BuiltinSemanticsVariant fun | ||
} | ||
|
||
$(makeLenses ''CompilationOpts) | ||
|
||
defaultCompilationOpts :: (Default (BuiltinSemanticsVariant fun)) => CompilationOpts name fun a | ||
defaultCompilationOpts = | ||
CompilationOpts | ||
{ _coSimplifyOpts = defaultSimplifyOpts | ||
, _coBuiltinSemanticsVariant = def | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
7185604
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.
Possible performance regression was detected for benchmark 'Plutus Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
1.05
.validation-decode-pubkey-1
171
μs162.3
μs1.05
validation-decode-token-account-2
211.8
μs199.8
μs1.06
validation-decode-uniswap-1
249.7
μs223.7
μs1.12
This comment was automatically generated by workflow using github-action-benchmark.
CC: @input-output-hk/plutus-core