-
Notifications
You must be signed in to change notification settings - Fork 745
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
[SYCL] Support or diagnose use of namespace std types as kernel type … #1579
Conversation
What does the SYCL standard say about the kernel name? Should we just prohibit any non-class or unnamed types? |
I haven't read the standard in detail, but I found this: |
Copy paste from the spec.
For me It doesn't explicitly say that we cannot use non-class name. |
3f9a10e
to
e4af722
Compare
…names When std::nullptr_t is used as a kernel type, the generated integration header uses 'nullptr_t'. This causes lookup errors. Use 'std::nullptr_t' instead. std::max_align_t is defined (in one implementation) as a typedef of an anonymous struct. This causes errors when attempting to forward declare the type in the integration header. Diagnose such cases earlier. Signed-off-by: Premanand M Rao <premanand.m.rao@intel.com>
e4af722
to
46c54c6
Compare
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 all for quoting the standard, I think this makes for a tougher solution here...
// accessible - contradicts the spec | ||
const bool KernelNameIsMissing = TD->getName().empty(); | ||
if (KernelNameIsMissing) { | ||
const TagDecl *TD = isa<ClassTemplateDecl>(D) |
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 wonder if this needs to be lower-level than this, since would this work with 'int'? Or the other builtin types? I don't think they are tagdecls, but they are probably named decls.
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.
For the fundamental types and other builtin types, we don't even get here. We enter here only for those types for which a forward declaration is necessary.
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 see. @kbobrovs is most familiar with the Int header stuff, so I'll leave the review to him.
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 @erichkeane
Discussion has been moved to Khronos |
Otherwise you can probably address this by metaprogramming. |
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.
LGTM.
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.
This should not be merged. See previous comment.
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 just discussed this in the up-streaming call. The improvements of the diagnostic in this change are useful. Adding extra support for std types is not needed.
@@ -1826,8 +1823,10 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) { | |||
O << "// This is auto-generated SYCL integration header.\n"; | |||
O << "\n"; | |||
|
|||
O << "#include <cstddef>\n"; |
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 don't think we need these changes to the generated header (this and the next change). Because there is no promise that std types work as lambda name.
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.
@premanandrao, could you address this comment, please?
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.
@bader , @jtmott-intel is working on it.
…names
When std::nullptr_t is used as a kernel type, the generated
integration header uses 'nullptr_t'. This causes lookup
errors. Use 'std::nullptr_t' instead.
std::max_align_t is defined (in one implementation) as a typedef
of an anonymous struct. This causes errors when attempting to
forward declare the type in the integration header. Diagnose
such cases earlier.
Signed-off-by: Premanand M Rao premanand.m.rao@intel.com