Skip to content

Commit c94338a

Browse files
author
Fábio Mestre
committed
[SYCL][OpenCL] Fix issues after rebase and format cmakefile
1 parent 59857f1 commit c94338a

File tree

6 files changed

+91
-57
lines changed

6 files changed

+91
-57
lines changed

sycl/plugins/opencl/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ add_sycl_plugin(opencl
3737
"../unified_runtime/ur/adapters/opencl/queue.cpp"
3838
"../unified_runtime/ur/adapters/opencl/command_buffer.hpp"
3939
"../unified_runtime/ur/adapters/opencl/command_buffer.cpp"
40+
"../unified_runtime/ur/adapters/opencl/usm_p2p.cpp"
4041
# ---
4142
"${sycl_inc_dir}/sycl/detail/pi.h"
4243
"pi_opencl.cpp"

sycl/plugins/opencl/pi_opencl.cpp

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,10 @@
1616

1717
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
1818

19+
#include <cstring>
1920
#include <pi_opencl.hpp>
20-
#include <sycl/detail/cl.h>
21-
#include <sycl/detail/iostream_proxy.hpp>
2221
#include <sycl/detail/pi.h>
2322

24-
#include <algorithm>
25-
#include <cassert>
26-
#include <cstring>
27-
#include <limits>
28-
#include <map>
29-
#include <memory>
30-
#include <mutex>
31-
#include <sstream>
32-
#include <string>
33-
#include <string_view>
34-
#include <vector>
35-
36-
// Want all the needed casts be explicit, do not define conversion operators.
37-
template <class To, class From> To cast(From value) {
38-
// TODO: see if more sanity checks are possible.
39-
static_assert(sizeof(From) == sizeof(To), "cast failed size check");
40-
return (To)(value);
41-
}
42-
4323
extern "C" {
4424

4525
pi_result piextUSMImport(const void *ptr, size_t size, pi_context context) {
@@ -214,12 +194,14 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
214194
pi2ur::piextCommandBufferMemBufferCopy)
215195
_PI_CL(piextCommandBufferMemBufferCopyRect,
216196
pi2ur::piextCommandBufferMemBufferCopyRect)
217-
_PI_CL(piextCommandBufferMemBufferRead, piextCommandBufferMemBufferRead)
197+
_PI_CL(piextCommandBufferMemBufferRead,
198+
pi2ur::piextCommandBufferMemBufferRead)
218199
_PI_CL(piextCommandBufferMemBufferReadRect,
219-
piextCommandBufferMemBufferReadRect)
220-
_PI_CL(piextCommandBufferMemBufferWrite, piextCommandBufferMemBufferWrite)
200+
pi2ur::piextCommandBufferMemBufferReadRect)
201+
_PI_CL(piextCommandBufferMemBufferWrite,
202+
pi2ur::piextCommandBufferMemBufferWrite)
221203
_PI_CL(piextCommandBufferMemBufferWriteRect,
222-
piextCommandBufferMemBufferWriteRect)
204+
pi2ur::piextCommandBufferMemBufferWriteRect)
223205
_PI_CL(piextEnqueueCommandBuffer, pi2ur::piextEnqueueCommandBuffer)
224206
// Kernel
225207
_PI_CL(piextKernelSetArgMemObj, pi2ur::piextKernelSetArgMemObj)
@@ -228,6 +210,10 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
228210
_PI_CL(piTearDown, pi2ur::piTearDown)
229211
_PI_CL(piGetDeviceAndHostTimer, pi2ur::piGetDeviceAndHostTimer)
230212
_PI_CL(piPluginGetBackendOption, pi2ur::piPluginGetBackendOption)
213+
// Peer to Peer
214+
_PI_CL(piextEnablePeerAccess, pi2ur::piextEnablePeerAccess)
215+
_PI_CL(piextDisablePeerAccess, pi2ur::piextDisablePeerAccess)
216+
_PI_CL(piextPeerAccessGetInfo, pi2ur::piextPeerAccessGetInfo)
231217

232218
#undef _PI_CL
233219

sycl/plugins/unified_runtime/CMakeLists.txt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -254,34 +254,34 @@ if ("opencl" IN_LIST SYCL_ENABLE_PLUGINS)
254254
# Build OpenCL adapter
255255
add_sycl_library("ur_adapter_opencl" SHARED
256256
SOURCES
257-
"ur/ur.hpp"
258-
"ur/ur.cpp"
259-
"ur/adapters/opencl/command_buffer.hpp"
260-
"ur/adapters/opencl/command_buffer.cpp"
261-
"ur/adapters/opencl/common.cpp"
262-
"ur/adapters/opencl/common.hpp"
263-
"ur/adapters/opencl/context.cpp"
264-
"ur/adapters/opencl/context.hpp"
265-
"ur/adapters/opencl/device.cpp"
266-
"ur/adapters/opencl/device.hpp"
267-
"ur/adapters/opencl/enqueue.cpp"
268-
"ur/adapters/opencl/event.cpp"
269-
"ur/adapters/opencl/kernel.cpp"
270-
"ur/adapters/opencl/memory.cpp"
271-
"ur/adapters/opencl/platform.cpp"
272-
"ur/adapters/opencl/platform.hpp"
273-
"ur/adapters/opencl/program.cpp"
274-
"ur/adapters/opencl/queue.cpp"
275-
"ur/adapters/opencl/sampler.cpp"
276-
"ur/adapters/opencl/ur_interface_loader.cpp"
277-
"ur/adapters/opencl/usm.cpp"
278-
257+
"ur/ur.hpp"
258+
"ur/ur.cpp"
259+
"ur/adapters/opencl/command_buffer.hpp"
260+
"ur/adapters/opencl/command_buffer.cpp"
261+
"ur/adapters/opencl/common.cpp"
262+
"ur/adapters/opencl/common.hpp"
263+
"ur/adapters/opencl/context.cpp"
264+
"ur/adapters/opencl/context.hpp"
265+
"ur/adapters/opencl/device.cpp"
266+
"ur/adapters/opencl/device.hpp"
267+
"ur/adapters/opencl/enqueue.cpp"
268+
"ur/adapters/opencl/event.cpp"
269+
"ur/adapters/opencl/kernel.cpp"
270+
"ur/adapters/opencl/memory.cpp"
271+
"ur/adapters/opencl/platform.cpp"
272+
"ur/adapters/opencl/platform.hpp"
273+
"ur/adapters/opencl/program.cpp"
274+
"ur/adapters/opencl/queue.cpp"
275+
"ur/adapters/opencl/sampler.cpp"
276+
"ur/adapters/opencl/ur_interface_loader.cpp"
277+
"ur/adapters/opencl/usm.cpp"
278+
"ur/adapters/opencl/usm_p2p.cpp"
279279
INCLUDE_DIRS
280-
${sycl_inc_dir}
280+
${sycl_inc_dir}
281281
LIBRARIES
282-
UnifiedRuntime-Headers
283-
Threads::Threads
284-
OpenCL-ICD
282+
UnifiedRuntime-Headers
283+
Threads::Threads
284+
OpenCL-ICD
285285
)
286286

287287
set_target_properties("ur_adapter_opencl" PROPERTIES

sycl/plugins/unified_runtime/ur/adapters/opencl/queue.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueCreate(
7373
cl_command_queue_properties CLProperties =
7474
convertURQueuePropertiesToCL(pProperties);
7575

76-
// Check that unexpected bits are not set.
77-
assert(!(CLProperties & ~(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE |
78-
CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE |
79-
CL_QUEUE_ON_DEVICE_DEFAULT)));
80-
8176
// Properties supported by OpenCL backend.
82-
cl_command_queue_properties SupportByOpenCL =
77+
const cl_command_queue_properties SupportByOpenCL =
8378
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE |
8479
CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT;
8580

sycl/plugins/unified_runtime/ur/adapters/opencl/ur_interface_loader.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,19 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable(
283283
return retVal;
284284
}
285285

286+
UR_DLLEXPORT ur_result_t UR_APICALL urGetUsmP2PExpProcAddrTable(
287+
ur_api_version_t version, ur_usm_p2p_exp_dditable_t *pDdiTable) {
288+
auto retVal = validateProcInputs(version, pDdiTable);
289+
if (UR_RESULT_SUCCESS != retVal) {
290+
return retVal;
291+
}
292+
pDdiTable->pfnEnablePeerAccessExp = urUsmP2PEnablePeerAccessExp;
293+
pDdiTable->pfnDisablePeerAccessExp = urUsmP2PDisablePeerAccessExp;
294+
pDdiTable->pfnPeerAccessGetInfoExp = urUsmP2PPeerAccessGetInfoExp;
295+
296+
return retVal;
297+
}
298+
286299
#if defined(__cplusplus)
287300
} // extern "C"
288301
#endif
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//===--------- usm_p2p.cpp - OpenCL Adapter-------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===---------------------------------------------------------------===//
8+
9+
#include "common.hpp"
10+
11+
UR_APIEXPORT ur_result_t UR_APICALL
12+
urUsmP2PEnablePeerAccessExp([[maybe_unused]] ur_device_handle_t commandDevice,
13+
[[maybe_unused]] ur_device_handle_t peerDevice) {
14+
15+
cl_adapter::die(
16+
"Experimental P2P feature is not implemented for OpenCL adapter.");
17+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
18+
}
19+
20+
UR_APIEXPORT ur_result_t UR_APICALL
21+
urUsmP2PDisablePeerAccessExp([[maybe_unused]] ur_device_handle_t commandDevice,
22+
[[maybe_unused]] ur_device_handle_t peerDevice) {
23+
24+
cl_adapter::die(
25+
"Experimental P2P feature is not implemented for OpenCL adapter.");
26+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
27+
}
28+
29+
UR_APIEXPORT ur_result_t UR_APICALL urUsmP2PPeerAccessGetInfoExp(
30+
[[maybe_unused]] ur_device_handle_t commandDevice,
31+
[[maybe_unused]] ur_device_handle_t peerDevice,
32+
[[maybe_unused]] ur_exp_peer_info_t propName,
33+
[[maybe_unused]] size_t propSize, [[maybe_unused]] void *pPropValue,
34+
[[maybe_unused]] size_t *pPropSizeRet) {
35+
36+
cl_adapter::die(
37+
"Experimental P2P feature is not implemented for OpenCL adapter.");
38+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
39+
}

0 commit comments

Comments
 (0)