From cc89ffe9e5b59a15b8771749ddd8574e7ccc521a Mon Sep 17 00:00:00 2001 From: "Larsen, Steffen" Date: Fri, 17 Jun 2022 05:18:50 -0700 Subject: [PATCH 1/2] [SYCL] Remove runtime library calls to OpenCL This commit removes OpenCL calls from the runtime, replacing them with the corresponding PI calls. This removes the dependency on the OpenCL library from the runtime library. Signed-off-by: Larsen, Steffen --- sycl/source/device.cpp | 2 +- sycl/source/program.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sycl/source/device.cpp b/sycl/source/device.cpp index b63576f630868..5bbbc42106255 100644 --- a/sycl/source/device.cpp +++ b/sycl/source/device.cpp @@ -41,7 +41,7 @@ device::device(cl_device_id DeviceId) { auto Platform = detail::platform_impl::getPlatformFromPiDevice(Device, Plugin); impl = Platform->getOrMakeDeviceImpl(Device, Platform); - clRetainDevice(DeviceId); + Plugin.call(impl->getHandleRef()); } device::device(const device_selector &deviceSelector) { diff --git a/sycl/source/program.cpp b/sycl/source/program.cpp index 6adb31c754195..afe1319016169 100644 --- a/sycl/source/program.cpp +++ b/sycl/source/program.cpp @@ -45,7 +45,8 @@ program::program(const context &context, cl_program clProgram) detail::pi::cast(clProgram))) { // The implementation constructor takes ownership of the native handle so we // must retain it in order to adhere to SYCL 1.2.1 spec (Rev6, section 4.3.1.) - clRetainProgram(clProgram); + impl->getPlugin().call( + impl->getHandleRef()); } backend program::get_backend() const noexcept { return getImplBackend(impl); } From f645b6d01c6deb07b43caf7c13871cfd003a5074 Mon Sep 17 00:00:00 2001 From: "Larsen, Steffen" Date: Fri, 17 Jun 2022 06:40:21 -0700 Subject: [PATCH 2/2] Remove OpenCL ICD from linked libraries Signed-off-by: Larsen, Steffen --- sycl/source/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sycl/source/CMakeLists.txt b/sycl/source/CMakeLists.txt index 5f23d77b1126a..8812c6bb81ef0 100644 --- a/sycl/source/CMakeLists.txt +++ b/sycl/source/CMakeLists.txt @@ -86,7 +86,7 @@ function(add_sycl_rt_library LIB_NAME) ${CMAKE_CURRENT_SOURCE_DIR} "${sycl_inc_dir}" ) - #TODO: Remove dependency on icd loader and opencl headers. + #TODO: Remove dependency on opencl headers. target_link_libraries(${LIB_OBJ_NAME} PRIVATE OpenCL-Headers ) @@ -95,7 +95,6 @@ function(add_sycl_rt_library LIB_NAME) target_link_libraries(${LIB_NAME} PRIVATE - OpenCL-ICD ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} )