-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Fix nothrow modeling of have_fma #43785
Conversation
Allows functions that make use of fma to be considered ConstAPI (so long has both have_fma branches return the same constant).
2036259
to
6c1eda3
Compare
intrinsic_effect_free_if_nothrow(f) = f === Intrinsics.pointerref || | ||
f === Intrinsics.have_fma || is_pure_intrinsic_infer(f) |
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.
intrinsic_effect_free_if_nothrow(f) = f === Intrinsics.pointerref || | |
f === Intrinsics.have_fma || is_pure_intrinsic_infer(f) | |
intrinsic_effect_free_if_nothrow(f) = | |
f === Intrinsics.pointerref || | |
# in order to allow FMA multiversioning, we exclude `have_fma` from `is_pure_intrinsic_infer` | |
# because it shouldn't be constant folded at inference time, but we still mark it here | |
# so that we allow a call with `have_fma` to use the constant calling convention | |
# when both branches have the same constant value. | |
f === Intrinsics.have_fma || | |
is_pure_intrinsic_infer(f) |
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.
Multiversioning is one of the issues, but it's not exclusive. Everything here that reads implicit runtime state needs to be excluded. If it is not guaranteed to always return bitwise egal output given bitwise egal input, it must be excluded from is_pure_intrinsic_infer
. I'm working on a PR to make the effect free code a little more principled, so I'll fold the documentation comment in there.
Allows functions that make use of fma to be considered ConstAPI (so long has both have_fma branches return the same constant).
Allows functions that make use of fma to be considered ConstAPI (so long has both have_fma branches return the same constant).
Allows functions that make use of fma to be considered ConstAPI (so long has both have_fma branches return the same constant).
Allows functions that make use of fma to be considered ConstAPI (so long has both have_fma branches return the same constant).
Allows functions that make use of fma to be considered ConstAPI
(so long has both have_fma branches return the same constant).
cc @ianatol