-
-
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
Lowering of NTuple{4, VecElement{UInt8}}
#18445
Comments
|
You can use the SIMD package to do this: using SIMD
f(x) = x % Vec{4,Int8}
@code_llvm f(Vec{4,Int16}(1)) Unfortunately, SIMD currently scalarizes the code. Please open a bug report (or pull request...) if you are interested in improving this. |
My goal is to give us a bit better support for SIMD in base Julia and to On Sun, 11 Sep 2016, 11:06 Erik Schnetter, [email protected] wrote:
|
How onerous would it be to make separate vector versions of all of the relevant Intrinsics? I'm not completely opposed to making the existing intrinsics accept both |
@vtjnash Isn't that exactly what the SIMD package already does? Before I implemented it, there was a discussion, and the conclusion was that new intrinsics were not necessary, and using If there is a reason why intrinsics are to be preferred, e.g. if they are faster, then we should go that route. In this case, it would make sense to move the SIMD package into |
As far as I know the string from of I personally think that having a great support story for SIMD types in Julia is important and it should have full language support. As you can see in #18470 the changes to base are not as bad as I thought (except the runtime-intrinsics) and |
The big unknown issue with SIMD operations is how to represent vectors of booleans. Julia represents The solution adopted by OpenCL (and many other packages) is to have several boolean types, essentially one boolean type for each integer or floating point size: I'm bringing this up here since this is one of the big missing pieces in the SIMD package, and given that this is a large-ish change, it also deserves some discussion before going into Base Julia. However, given the state of Julia's and LLVM's optimizers, I don't see a way around introducing multiple boolean types if one wants to write efficient predicated SIMD code. |
The select instruction in LLVM is |
If you store booleans in In |
Thanks for the explanation, that explains why I was seeing scalarized assembly for extracting a bitvector. |
I was looking into getting Julia to emit the LLVM IR for a truncation between vector types.
which should correspond to the Julia code:
I traced it down to
staticeval_bitstype
julia/src/intrinsics.cpp
Line 388 in fa4c02c
and it seems that
jl_is_bitstype
is false for Tuples of VecElement (because nfields != 0).So my question is should
jl_is_bitstype
be true forNTuple{N, VecElement}
? Since they lower to the vector types in llvm that seems not unreasonable, or should we special case it forstaticeval_bitstype
?The text was updated successfully, but these errors were encountered: