Skip to content

Commit 90e8b5e

Browse files
[SYCL] Remove runtime library calls to OpenCL (#6321)
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 <[email protected]>
1 parent 77bb972 commit 90e8b5e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

sycl/source/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function(add_sycl_rt_library LIB_NAME)
8686
${CMAKE_CURRENT_SOURCE_DIR}
8787
"${sycl_inc_dir}"
8888
)
89-
#TODO: Remove dependency on icd loader and opencl headers.
89+
#TODO: Remove dependency on opencl headers.
9090
target_link_libraries(${LIB_OBJ_NAME}
9191
PRIVATE OpenCL-Headers
9292
)
@@ -95,7 +95,6 @@ function(add_sycl_rt_library LIB_NAME)
9595

9696
target_link_libraries(${LIB_NAME}
9797
PRIVATE
98-
OpenCL-ICD
9998
${CMAKE_DL_LIBS}
10099
${CMAKE_THREAD_LIBS_INIT}
101100
)

sycl/source/device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ device::device(cl_device_id DeviceId) {
4141
auto Platform =
4242
detail::platform_impl::getPlatformFromPiDevice(Device, Plugin);
4343
impl = Platform->getOrMakeDeviceImpl(Device, Platform);
44-
clRetainDevice(DeviceId);
44+
Plugin.call<detail::PiApiKind::piDeviceRetain>(impl->getHandleRef());
4545
}
4646

4747
device::device(const device_selector &deviceSelector) {

sycl/source/program.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ program::program(const context &context, cl_program clProgram)
4545
detail::pi::cast<pi_native_handle>(clProgram))) {
4646
// The implementation constructor takes ownership of the native handle so we
4747
// must retain it in order to adhere to SYCL 1.2.1 spec (Rev6, section 4.3.1.)
48-
clRetainProgram(clProgram);
48+
impl->getPlugin().call<detail::PiApiKind::piProgramRetain>(
49+
impl->getHandleRef());
4950
}
5051

5152
backend program::get_backend() const noexcept { return getImplBackend(impl); }

0 commit comments

Comments
 (0)