-
Notifications
You must be signed in to change notification settings - Fork 73
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
Emit vector constant for vector index #921
base: main
Are you sure you want to change the base?
Conversation
…a previously vectorized dtype.
9b6a609
to
141d9d7
Compare
loopy/target/opencl.py
Outdated
# is the number of elements in the vector which is the same as in src. | ||
# https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_C.html#explicit-casts | ||
if self.codegen_state.target.is_vector_dtype(actual_type) or \ | ||
actual_type.dtype.kind == "b": |
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.
What is this bool
handling doing here?
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.
The type, actual_type
is computed using the expression before the vector literal is inserted. I think the better solution would be to update the type inference system to use the vectorized version of the expression instead.
loopy/target/opencl.py
Outdated
vector_type = self.codegen_state.target.vector_dtype(index_type, | ||
length) | ||
conditional_needed_loopy_type = to_loopy_type(vector_type) | ||
except UnvectorizableError: |
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.
Why are we suppressing exceptions here in the first place?
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.
We know that VectorizabilityChecker
has succeeded at least once before. However, it is unclear that it will pass for the current expression which may be for a different part of the code. So out of caution, I thought it would be best to rerun the VectorizabilityChecker
. If the VectorizabilityChecker
succeeds then we need to ensure the proper typing of the vector conditional. If it fails, then the expression is not a vector and so we just handle the case like normal.
Fixes #870.