-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Union handling of ifelse
#26134
Comments
ifelse
The overflow check isn't causing any problem. With the |
In general, you should probably stick to using actual conditionals ( |
I would prefer not deleting `ifelse` it's semantics make it important in
GPU code and for SIMD usage (although in both contexts it is more likely to
be called `select`)
…On Tue, Feb 20, 2018, 20:41 Jameson Nash ***@***.***> wrote:
but not when it is of a different type
In general, you should probably stick to using actual conditionals (?:),
ifelse is likely to continue to always play second-fiddle. #25934
<#25934> will probably help, but
after Keno's PR, I strongly suspect we should just delete this intrinsic
and define it simply as ifelse(b, x, y) = b ? x : y.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#26134 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAI3alBm1EvHhEPqr0Pm4McdcB5im8JNks5tW3Q9gaJpZM4SMupS>
.
|
Is LLVM not smart enough? |
@vtjnash, but are there cases where LLVM wouldn't change |
Note that I believe the hardest (and sometimes impossible) thing for the compiler to prove is that it is safe/beneficial for the two cases be eagerly evaluated. As long as it's clear to LLVM that it's a branch that has no sideeffect, I think it should be pretty trivial for it to do the transformation and any cases where it fails to do so will probably be a LLVM bug that shouldn't be too hard to fix. (edit: in another word, my "Is LLVM not smart enough?" was a serious question about the state of the GPU backend). It's worth noting that the eager evaluation semantics is actually not provided by |
In the following example, SIMD is enabled when
x
is of the element type ofA
(hereInt8
), but not when it is of a different type (e.g.Int
). I imagine this can be due to overflow checks, but the compiler should ideally be able to check this before entering the loop. This also happens whenx
is hardcoded as a constant inside the function body instead of being passed as an argument, in which case the check could happen statically.The text was updated successfully, but these errors were encountered: