-
Notifications
You must be signed in to change notification settings - Fork 223
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 check to early exit when OpenCL builtin is not found in the map #2525
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Arvind Sudarsanam <[email protected]>
The fix of the issue is likely a little bigger than "atomic". The changes covers "atomic" prefix but there are other prefixes in |
Hi @bwlodarcz Thanks much for the feedback. Sincerely |
The transBuiltin(...) function already has the check to see if the function we are looking at has a valid OCL builtin (See
This check was missing in transAtomicBuiltin(...) and this PR adds that check. I do not see any other site where this check is required. So, I think this PR can be submitted as is. Thanks for all the feedback. |
@asudarsa Unfortunately the change doesn't work/is not enough. Let's replace
Standard llvm-as followed by llvm-spirv sequence to reproduce. |
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.
Described in previous comment.
Several user defined/declared functions were being identified as 'possible' OpenCL builtins as they had prefixes (e.g. atomic_) similar to OpenCL builtin function names. However, they were not present in the OCLSPIRVBuiltinMap.
One of the OCLToSPIRV utility functions calls OCLSPIRVBuiltinMap::map function on such user defined functions and this results in a crash.
The correct way to do this will be to check if the OCL function name key is present in the map and exit early if not.
This PR does that.
Thanks