-
Notifications
You must be signed in to change notification settings - Fork 68
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
Types in the std
namespace do not need to be prohibited as kernel names due to forward declaration requirements
#629
Comments
There is a wider concern here. The current specification appears to prohibit entities from the
Should implementations therefore reject the following program because it uses
|
IIRC Codeplay used to use the name for tables its compiler generated (but they'd know for sure). I think I'd rather we go in the direction of forward declared without a definition (although it may be too late for this, and I don't think this is worth breaking code over). After all, it's just supposed to be a unique name. That covers things like I don't expect compilers will be required to warn on this. |
@nliber, I can't speak for Codeplay, but DPC++and the Intel compiler currently implement the integration header approach and thus depend on forward declaration injection; at least for support of third party host compilers.
I don't see what that would help. It seems that would require programmers to invent more kernel names than they need to now.
I'm working on implementing warnings for invalid kernel name types in general right now. The current user experience provided by DPC++ and the Intel compiler when invalid kernel name types are used is ... not easy to explain. https://godbolt.org/z/K7Ev948bE. |
I agree that it would be good to clarify this language about legal kernel type-names. The term "forward declarable" has never seemed very precise to me. Instead, I wonder if we can make a list of legal types, similar to what we did for the Intel extension sycl_ext_oneapi_free_function_kernels. I agree with @tahonermann's comment above about |
I wasn't going to bring up the free function kernel proposal, but since @gmlueck now has, well, I'll widen the scope a bit more. Parameters of free function kernels also need to be forward declarable for implementations that use the integration header technique. If entities in the |
SYCL 2020 section 5.2, "Naming of kernels" includes the following note:
It is correct that C++ programs are prohibited from adding declarations in the
std
namespace ([namespace.std]), but that does not imply that an existing type in thestd
namespace cannot be used as a kernel name.The requirement for forward declarable types is presumably intended to accommodate implementations like DPC++ that use the integration header technique to make kernel details discovered during device compilation available during host compilation. In that case, the integration header is a detail of the implementation and not subject to the prohibition on adding declarations to the
std
namespace (an argument can be made that the SYCL library implementation is distinct from the C++ implementation and is therefore not exempt from thestd
namespace rule, but DPC++ at least does not require that distinction).To be clear, I don't think there are any benefits to be gained by allowing types declared in the
std
namespace to be used as kernel names; I just disagree with the explanation in the referenced note and would prefer to see the note replaced with a normative requirement that simply prohibits the use of types (directly or indirectly) declared in thestd
namespace from being used as kernel names.The text was updated successfully, but these errors were encountered: