-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
CompilerDevTools: add proof of concept for caching runtime calls #57193
base: master
Are you sure you want to change the base?
Conversation
Some concrete comments, but this is largely what I had in mind, yes. |
After many years of maintaining Cassette I distinctly dislike the approach to propagate the compiler through the IR. That's why in #52964 I approached this from the "what if they compiler was a scoped-value" perspective. I could rebase #52964 if there is interest (beyond myself) in exploring that alternative approach. |
This specific utility is just for testing compiler changes (and exercising the caching and foreign CodeInstance APIs) without prejudice to having, more general mechanism, for compiler switches. |
…egen cache (#57272) Implements a way to add `CodeInstance`s compiled by external interpreters to JIT, such that they become legal targets for `invoke` calls. Based on a design proposed by @Keno, the `AbstractInterpreter` interface is extended to support providing a codegen cache that is filled during inference for future use with `add_codeinsts_to_jit!`. This allows `invoke(f, ::CodeInstance, args...)` to work on external interpreters, which is currently failing on `master` (see #57193). --------- Co-authored-by: Cédric Belmant <[email protected]>
Should be rebasable now that #57272 is merged. |
…ch 'master' of github.com:JuliaLang/julia into compiler-dev-tools
This PR leverages new capabilities that have been implemented in #56660 to also support caching methods for runtime calls under a custom
AbstractInterpreter
.In my understanding, the idea is that when executing code compiled with a custom
AbstractInterpreter
, only methods that can be compiled ahead of execution will be cached, because dynamic calls requiring runtime compilation will not have enough context to know which interpreter and cache to use. They will instead use the native interpreter and cache.This sample package demonstrates a way to ensure that runtime calls go through an entry point (
with_new_compiler
) that provides the context required to use the right cache and interpreter for subsequent compilation.I'd be happy to get feedback on the logic used to redirect runtime calls to
with_new_compiler
. Overloadingoptimize(::SplitCacheInterp)
seemed the most convenient (right after that, theIRCode
gets converted to aCodeInfo
), but perhaps there might be a better place for it.