-
Notifications
You must be signed in to change notification settings - Fork 244
Add SPV_INTEL_masked_gather_scatter extension #1580
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
Add SPV_INTEL_masked_gather_scatter extension #1580
Conversation
@asudarsa @vmaksimo @jcranmer-intel please take a look |
Type *BaseTy = | ||
BaseSPVTy->isTypeVector() | ||
? transType( | ||
BaseSPVTy->getVectorComponentType()->getPointerElementType()) |
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.
Can this logic be safely moved inside getPointerElementType?
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.
It's a very good suggestion. But after some considering I'd say: no.
The reasoning, that it's safe to move it now, but I can imagine, that in the future some vendor, which is not aware or interested in our extension, can add another instructions, that are operating over pointers. The change you are suggesting would implicitly allow vector of pointers to be used by those instruction, which is incorrect.
And may be it's already the case.
lib/SPIRV/SPIRVRegularizeLLVM.cpp
Outdated
if (DestTy->getScalarType()->getNonOpaquePointerElementType() != | ||
SrcTy->getScalarType()->getNonOpaquePointerElementType()) { | ||
Type *InterTy = PointerType::getWithSamePointeeType( | ||
cast<PointerType>(DestTy), SrcTy->getPointerAddressSpace()); |
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.
cast PointerType for SrcTy?
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.
Not sure if I get the question/suggestion.
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.
Probably got it and added.
lib/SPIRV/SPIRVWriter.cpp
Outdated
@@ -3824,6 +3843,47 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II, | |||
} | |||
return Op; | |||
} | |||
case Intrinsic::masked_gather: { | |||
if (BM->isAllowedToUseExtension( |
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 do we have to check this again? Is there a possibility that we would not have called transType for FixedVectorType before this?
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.
That's unlikely, but it will explicitly say to the one, who is reading this code next, that these instructions are only supported as a part of the appropriate extension. For the sake of performance I can rewrite these lines in the following way:
if (notSupported)
error_out
return
do_translation
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.
I agree with the argument that it makes the code readable.
Added some comments. Also added a coupe of comments in the doc PR. |
This extension allows TypeVector to have a Physical Pointer Type Component Type and introduces gather/scatter instructions. It will be useful for explicitly vectorized kernels. Spec: intel/llvm#6613 Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
2992af3
to
b6d9830
Compare
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
test/transcoding/SPV_INTEL_masked_gather_scatter/intel-basic-vector-pointers.ll
Show resolved
Hide resolved
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
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.
I haven't looked too closely at the code in lib/SPIRV/libSPIRV, but otherwise, this looks good.
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.
Thanks for addressing the comments. LGTM
#1695) This extension allows TypeVector to have a Physical Pointer Type Component Type and introduces gather/scatter instructions. It will be useful for explicitly vectorized kernels. Spec: intel/llvm#6613 Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
#1691) This extension allows TypeVector to have a Physical Pointer Type Component Type and introduces gather/scatter instructions. It will be useful for explicitly vectorized kernels. Spec: intel/llvm#6613 Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
…#1689) This extension allows TypeVector to have a Physical Pointer Type Component Type and introduces gather/scatter instructions. It will be useful for explicitly vectorized kernels. Spec: intel/llvm#6613 Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
…#1688) This extension allows TypeVector to have a Physical Pointer Type Component Type and introduces gather/scatter instructions. It will be useful for explicitly vectorized kernels. Spec: intel/llvm#6613 Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
#1692) This extension allows TypeVector to have a Physical Pointer Type Component Type and introduces gather/scatter instructions. It will be useful for explicitly vectorized kernels. Spec: intel/llvm#6613 Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
#1690) This extension allows TypeVector to have a Physical Pointer Type Component Type and introduces gather/scatter instructions. It will be useful for explicitly vectorized kernels. Spec: intel/llvm#6613 Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
#1694) This extension allows TypeVector to have a Physical Pointer Type Component Type and introduces gather/scatter instructions. It will be useful for explicitly vectorized kernels. Spec: intel/llvm#6613 Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
#1693) This extension allows TypeVector to have a Physical Pointer Type Component Type and introduces gather/scatter instructions. It will be useful for explicitly vectorized kernels. Spec: intel/llvm#6613 Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
This extension allows TypeVector to have a Physical Pointer Type
Component Type and introduces gather/scatter instructions.
It will be useful for explicitly vectorized kernels.
Spec: intel/llvm#6613
Signed-off-by: Sidorov, Dmitry dmitry.sidorov@intel.com