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
PLT-834 Experiment: refactor CEK machine for adding a stepper #4909
Conversation
/benchmark plutus-benchmark:validation |
c21409b
to
619d1ee
Compare
/benchmark plutus-benchmark:validation |
The automatic benchmarking is still broken. I'll run the benchmarks manually on the benchmarking machine and paste the results in here. |
Oh.
|
I tried again and got similar results. |
That's more or less what I'd expect! |
Shower thoughts. We really need to get rid of the creation of the state objects. I don't think there's any way GHC is going to be clever enough to eliminate those, the place where they're destructed is just way too far from where they're constructed. I think that means that instead we probably need to do something with continuations:
So
|
Oh no. |
plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/Cek/Internal.hs
Show resolved
Hide resolved
No, we just need to recurse in the worker of the production machine and not recurse in the worker of the debugging machine. Something along these lines (pseudocode, doesn't type check, omitting all frames etc business for clarity): enterComputeCek debug term = computeCekStep term where
computeCek = if debug then computeCekDebug else computeCekStep
{-# NOINLINE computeCek #-} -- Making sure the `if` is only evaluated once.
computeCekDebug term = pure $ Computing term
computeCekStep (Force _ body) = computeCek body
<other_clauses> Here you'll still return a It's probably still going to be a bit slower (not by 10x for sure, though), because this alignment likely breaks compilation to join points, but then you can do the class with a type-level |
Sneaky, yes indeed that would probably work. I was trying to abstract out the recursion, which would probably work worse anyway. |
So I'm not sure we can say that we're sharing the code in this way. We still need to abstract out the "steps" for the debugging machine. It's basically a case match with a way of returning the same type at the end ( |
We still need
Performance. |
My understanding of what Roman is proposing is that it would not duplicate the logic for the steps. We would be sharing most of the code. |
I think we went the other way for now, we can resurrect this if we need it. |
This branch refactors the CEK machine such that we can add a stepper to it easier. It's for benchmarking purposes. Do not merge.
Pre-submit checklist: