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

effects: define Core.Compiler.infer_effects #44822

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aviatesk
Copy link
Sponsor Member

@aviatesk aviatesk commented Apr 1, 2022

This new reflection utility is similar to Core.Compiler.return_type but
for the effect analysis. It comes with its own tfunc and similar compiler
optimizations so that we can fold inferred effects at compiler time when
possible (albeit it is as unreliable as Core.Compiler.return_type).

For now Core.Compiler.infer_effects is folded at compile time only when
all the input arguments are fully known.

@aviatesk aviatesk requested review from tkf and vtjnash April 1, 2022 10:13
@aviatesk aviatesk force-pushed the avi/infer_effects branch 2 times, most recently from 0d2c6b8 to 1604714 Compare April 4, 2022 09:49
Comment on lines +2076 to +2081
if !isempty(sv.pclimitations)
# conservatively express uncertainty of this result
return CallMeta(Effects, false)
end
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Are there any other cases where we need to take some uncertainty into account?
I think the current implementation is okay as we exclude case when any of input arguments isn't fully known.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

The case that are uncertain are known to be uncomputable presently (possibly always / fundamentally?), which is why this is a bad candidate for an inference tfunc, but a good candidate for a special-inliner.

This new reflection utility is similar to `Core.Compiler.return_type` but
for the effect analysis. It comes with its own tfunc and similar compiler
optimizations so that we can fold inferred effects at compiler time when
possible (albeit it is as unreliable as `Core.Compiler.return_type`).
@KristofferC
Copy link
Sponsor Member

I think this has been added already now:

julia> Core.Compiler.infer_effects
infer_effects (generic function with 2 methods)

@KristofferC KristofferC closed this May 4, 2023
@vtjnash vtjnash reopened this May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants