-
Notifications
You must be signed in to change notification settings - Fork 773
[Attr] Extend uses of elementtype attribute #6397
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
Conversation
This adds a clang option `-element-type-attrs`, which enables emission of elementtype attribute for non-builtin functions. The attribute is attached to function definition in addition to call instructions. Right now clang emits elementtype attribute for pointer and OpenCL built-in types, which are lowered to LLVM pointers to opaque types.
@jcranmer-intel, here is the POC for the compile adding elementtype attribute for function parameters. This version adds the attribute only for OpenCL built-in types and pointer types. I assume for reference or indirectly passed objects the type get be obtained using other attributes. NOTE: my refactoring of type conversion for OpenCL types broke a couple of OpenCL lit tests. I'll take a look a bit later. |
I've tried some test changes with this run, but I have noticed a few issues. For example, one test generated this:
So there's still something off with the uniquing, even with the latest change. |
@jcranmer-intel, thanks for reporting. Could you share the name of the test if possible, so can I run it to validate the fix, please? |
SYCL/Basic/image/image_sample.cpp is the test I think I was seeing that particular line on. |
Should be fixed now. I didn't expect this problem to hit that early. :) |
@jcranmer-intel, does it work better now? If we decide to go with this direction, do we need to put new restrictions for using elementtype attribute or just remove any checks from the verifier? I can create a review request in llorg if there are objections on the direction from the community. |
There's still a clutch of errors I see with regards to other OpenCL types (pipe tests are the next set of ones I see, IIRC)--it feels like it's going to be a game of whack-a-mole to truly hit all of the different OpenCL types. To date, I've prioritized getting the Based on the responses to the RFC, I expect there to be resistance to adding this elementtype support to LLVM upstream without solid evidence that it's really necessary. I'm currently thinking that switching to sized opaque types would work better, which means the |
AFAIK, pipes are the only types I left w/o an attribute, but I did this intentionally because I didn't know that you are running the test suite covering pipes. I assumed you are running a few selected cases to validate the approach w/o full coverage. There are also OpenCL blocks, but we don't use them for SYCL.
You suggest we abandon this patch and implement sized opaque types instead. Did I get it right? |
I don't think we need this change, so I'm closing it. |
This adds a clang option
-element-type-attrs
, which enables emissionof elementtype attribute for non-builtin functions. The attribute is
attached to function definition in addition to call instructions.
Right now clang emits elementtype attribute for pointers and OpenCL
built-in types, which are lowered to LLVM pointers to opaque types.