-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Specification Version
SYCL 2020 (Revision 10)
Section Number(s)
section 4.12.4. "Rules for parameter passing to kernels"
Bug Description
During a conversation at the Philadelphia F2F, we decided that this statement in that section is not quite right:
If the kernel is a named function object, the
operator()member function (or other member functions that it calls) may reference member variables inside the same named function object. Any such member variables become parameters to the kernel.
This should be changed to say that all member variables of the named function object are kernel arguments. If an implementation can prove that certain member variables are not used in the kernel, then it can avoid passing them. This is essentially dead argument elimination.
During our conversation, we noted that the compiler cannot always prove whether a member variable of the kernel object is used in device code. Consider the case when the operator() calls some SYCL_EXTERNAL member function that is defined in another translation unit. In such a case, the compiler cannot know which member variables are used in the SYCL_EXTERNAL function.