-
Notifications
You must be signed in to change notification settings - Fork 212
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 OCL builtins translation in case SPV_KHR_untyped_pointers is enabled #2723
base: main
Are you sure you want to change the base?
Conversation
This change allows to preserve the correct builtin mangling in reverse translation.
@@ -2003,6 +2003,12 @@ class SPIRVExtInst : public SPIRVFunctionCallGeneric<OpExtInst, 5> { | |||
} | |||
return VArgs; | |||
} | |||
SPIRVValue *getArg(SPIRVWord I) { |
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 think this should be renamed getArgValue to be consistent with the pre-existing getArgValues which returns a vector pointers. Also, consider implementing getArgValues with getArgValue.
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc | ||
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM | ||
|
||
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_KHR_untyped_pointers |
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.
How did you pick this file to do additional testing with SPV_KHR_untyped_pointers?
Please add a comment explaining why this additional testing was added.
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.
Actually I'm just running all the tests with the extension enabled and trying to understand where the real fixes should be made, or where we just need to update Checks.
This one is testing OCL builtin so I've checked if we are working fine with them when the extension enabled (turned out that not).
Will add the comment about additional testing though.
@@ -4757,6 +4757,17 @@ Instruction *SPIRVToLLVM::transOCLBuiltinFromExtInst(SPIRVExtInst *BC, | |||
"Not OpenCL extended instruction"); | |||
|
|||
std::vector<Type *> ArgTypes = transTypeVector(BC->getArgTypes(), true); | |||
for (unsigned I = 0; I < ArgTypes.size(); I++) { |
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.
Does function transBuiltinFromInst() also need this special handling? It also calls transTypeVector() and gets a mangled name. Consider putting this special processing within transTypeVector().
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.
My experiments show that e.g. for OpEnqueKernel
we don't meet untyped variables in arguments, but the mangling is still wrong - should be fixed elsewhere.
It's still possible to unify this fix inside transTypeVector()
, but not sure if it'd be used by transBuiltinFromInst()
.
This change allows to preserve the correct builtin mangling in reverse translation.