-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL] Start fully-qualifying our inline kernel names in forward decl… #4220
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] Start fully-qualifying our inline kernel names in forward decl… #4220
Conversation
…arations. This has the ability to make a number easy-to-make mistakes no longer issues when using named kernels. This causes us to differentiate the inline-named kernels when they are in different namespaces, which will hopefully make running into duplicate-kernel-name issues more difficult.
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.
Change looks ok to me. Just had a couple of questions to clarify kernel naming requirements.
Which were? |
That's strange. My inline comments disappeared..... |
// and | ||
// namespace N2 { void foo() { kernel<class K>(...); }} | ||
// to co-exist, despite technically being against the SYCL rules. | ||
// See SYCLKernelNameTypePrinter for the corresponding part that prints |
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 you point me to where this 'technically violates SYCL rules'? Also, what happens when the declarations are in the same namespace but the context is technically different? For e.g.
// namespace N1 { void foo() { kernel<class K>(...); }}
// and
// namespace N1 { void bar() { kernel<class K>(...); }}
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 is supposed to be part of this line:
The kernel name must be forward declarable at namespace scope (including global namespace scope) and may not be forward declared other than at namespace scope. If it isn’t forward declared but is specified as a template argument in a kernel invoking interface, as described in Section 4.9.4.2, then it may not conflict with a name in any enclosing namespace scope.
here: https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:naming.kernels
That at least prohibits your example (since they are the same name in the same enclosing namespace), but I don't know what prevents something like:
namespace N1 { void foo() { kernel<class K>(...); }}
namespace N2 { void foo() { kernel<class K>(...); }}
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.
@AlexeySachkov : Can you help with the above standards interpretation there?
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.
Ok. Thank you for clarification
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.
Some small nits from me, but otherwise LG.
Co-authored-by: Aaron Ballman <[email protected]>
Co-authored-by: Aaron Ballman <[email protected]>
@bader : Looks like the Lit_With_Cuda bot is out of disk space? |
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
Also, I've restarted the |
…arations.
This has the ability to make a number easy-to-make mistakes no longer
issues when using named kernels. This causes us to differentiate the
inline-named kernels when they are in different namespaces, which will
hopefully make running into duplicate-kernel-name issues more difficult.