-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][CUDA] Add missing dependency on OpenCL headers #1260
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][CUDA] Add missing dependency on OpenCL headers #1260
Conversation
Signed-off-by: Andrea Bocci <[email protected]>
fa348dc
to
5f9f469
Compare
Hopefully fixes #1211. |
Tagging @Ruyk, @bjoernknafla, @steffenlarsen. |
Here's the dependency chain I see:
So, the CUDA plugin depends on the |
This looks like a bug to me. CUDA plugin should include PI declarations, which are independent from OpenCL. |
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'm okay with the fix, but we need to think about removing the PI dependency on OpenCL headers.
The PI declarations are mostly independent from OpenCL, except for a mapping from the PI descriptors to the corresponding OpenCL ones, e.g. mapping between typedef enum : pi_uint64 {
PI_DEVICE_TYPE_CPU = CL_DEVICE_TYPE_CPU,
PI_DEVICE_TYPE_GPU = CL_DEVICE_TYPE_GPU,
PI_DEVICE_TYPE_ACC = CL_DEVICE_TYPE_ACCELERATOR
} _pi_device_type; |
There are also various places in the SYCL RT that simply assume CL types, such as the interop functions, so the opencl-headers are required to build the project anyway. |
Things like this are plug-in specific and should reside in plug-in specific headers:
We should use only CUDA plug-in on platform and this plug-in should not include OpenCL headers. This will resolve the problem.
No for this patch. I already approved it. |
I don't see any change in the graph, either. However without this change, running
and so on - which I assume comes from picking up the CUDA OpenCL headers. With this change, the same command results in
In the second case, |
Created #1265 to keep track of the opencl-header dependency issue. |
That is my concern, that maybe is just delaying the point where the dependency is required and just so happen to work. But, if it is solving #1211 , then it should be fine. |
@@ -21,6 +21,10 @@ add_library(pi_cuda SHARED | |||
"pi_cuda.cpp" | |||
) | |||
|
|||
add_dependencies(pi_cuda | |||
ocl-headers | |||
) |
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.
Another solution could be to make the llvm/sycl/CMakeLists.txt OpenCL-Headers
library (used below) dependent on the custom target ocl-headers
- though without testing I am not 100% sure if that would resolve this issue, too.
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.
It might not.
Basically we need to make sure that ocl-headers target to "built" before we start compilation of CUDA plug-in.
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.
To chime in, a bit late...
This was indeed the correct solution in my mind. Setting dependencies on interface libraries (which OpenCL-Headers
is) is not possible. CMake just silently doesn't do anything for the dependency in that case. (I've been bit by this before...)
This should fix the build process, where
make sycl-toolchain -j
would sometimes fail due topi_cuda
andocl-headers
building in parallel.