opaque_closure: Allow opting out of PartialOpaque#54734
Merged
Conversation
`PartialOpaque` is a powerful mechanism to recover some amount of identity from opaque closure for inlining and other optimizations. However, there are two downsides: 1. It causes additional inference work, which is unnecessary if you already know that you don't want the identity-based optimization. 2. We (currently) disallow :new_opaque_closure in code returned from generated functions, because we cannot ensure that the identity of any resulting PartialOpaque will be stable. This somewhat defeats the purpose of having the opaque closure be, well, opaque. This PR adds an additional argument to `new_opaque_closure` that decides whether or not inference is allowed to form `PartialOpaque` for this `:new_opaque_closure`. If not, it is also permitted to run during precompile.
vtjnash
reviewed
Jun 8, 2024
Member
vtjnash
left a comment
There was a problem hiding this comment.
SGTM. I didn't look at everything, but couldn't think of any reason it would be problematic either.
3 tasks
serenity4
added a commit
to serenity4/Diffractor.jl
that referenced
this pull request
Feb 21, 2025
serenity4
added a commit
to serenity4/Diffractor.jl
that referenced
this pull request
Feb 21, 2025
Keno
pushed a commit
to JuliaDiff/Diffractor.jl
that referenced
this pull request
Mar 3, 2025
* Adapt to JuliaLang/julia#56509 * Adapt to JuliaLang/julia#54734 * Use StmtRange explicitly * Adapt to JuliaLang/julia#57230 * Reuse Cthulhu code structure for Compiler cache/finish overrides * Adapt to JuliaLang/julia#57475 * Adapt to JuliaLang/julia#55976 * Adapt to JuliaLang/julia#54734 * Use CC instead of .Compiler * Implement ir.argtypes[1] fix from JuliaLang/julia#54458 * Comment out failing tests To highlight which are broken, should probably be fixed before merging * Treat `getproperty(::Module, ::Symbol)` like GlobalRefs * Uncomment passing tests, explicitly mark others as broken * Evaluate GlobalRef only if binding is defined * Use `rrule` for getproperty(::Module, ::Symbol) * Bump compat bound for StructArrays * Raise compat bound for Cthulhu * Revert `isconst` change now that it is fixed * Adapt to `finishinfer!` signature change --------- Co-authored-by: Cédric Belmant <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PartialOpaqueis a powerful mechanism to recover some amount of identity from opaque closure for inlining and other optimizations. However, there are two downsides:This PR adds an additional argument to
new_opaque_closurethat decides whether or not inference is allowed to formPartialOpaquefor this:new_opaque_closure. If not, it is also permitted to run during precompile.