Skip to content

Commit e545d17

Browse files
committed
Update PI interface use and fix spurious includes
Signed-off-by: James Brodman <[email protected]>
1 parent 21b59c1 commit e545d17

File tree

4 files changed

+32
-36
lines changed

4 files changed

+32
-36
lines changed

sycl/include/CL/sycl/detail/pi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
// done here, for efficiency and simplicity.
2929
//
3030
#include <CL/opencl.h>
31-
#include <CL/cl_usm_ext.h>
3231
#include <cstdint>
3332

3433
#ifdef __cplusplus

sycl/source/detail/pi_opencl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88
#include "CL/opencl.h"
9-
#include "CL/cl_usm_ext.h"
109
#include <CL/sycl/detail/pi.hpp>
1110
#include <cassert>
1211
#include <cstring>

sycl/source/detail/usm/usm_dispatch.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace usm {
2727
USMDispatcher::USMDispatcher(cl_platform_id platform) {
2828
// TODO: update when platform_impl becomes more PI aware
2929

30-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
30+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
3131
GET_EXTENSION(clHostMemAllocINTEL);
3232
GET_EXTENSION(clDeviceMemAllocINTEL);
3333
GET_EXTENSION(clSharedMemAllocINTEL);
@@ -53,15 +53,15 @@ void *USMDispatcher::hostMemAlloc(pi_context Context,
5353
pi_result *ErrcodeRet) {
5454
void *RetVal = nullptr;
5555

56-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
57-
cl_context CLContext = pi::pi_cast<cl_context>(Context);
56+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
57+
cl_context CLContext = pi::cast<cl_context>(Context);
5858

5959
if (mEmulated) {
6060
RetVal = mEmulator->hostMemAlloc(CLContext, Properties, Size, Alignment,
61-
pi::pi_cast<cl_int *>(ErrcodeRet));
61+
pi::cast<cl_int *>(ErrcodeRet));
6262
} else {
6363
RetVal = pfn_clHostMemAllocINTEL(CLContext, Properties, Size, Alignment,
64-
pi::pi_cast<cl_int *>(ErrcodeRet));
64+
pi::cast<cl_int *>(ErrcodeRet));
6565
}
6666
}
6767

@@ -77,18 +77,18 @@ void *USMDispatcher::deviceMemAlloc(pi_context Context, pi_device Device,
7777
pi_result *ErrcodeRet) {
7878
void *RetVal = nullptr;
7979

80-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
81-
cl_context CLContext = pi::pi_cast<cl_context>(Context);
82-
cl_device_id CLDevice = pi::pi_cast<cl_device_id>(Device);
80+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
81+
cl_context CLContext = pi::cast<cl_context>(Context);
82+
cl_device_id CLDevice = pi::cast<cl_device_id>(Device);
8383

8484
if (mEmulated) {
8585
RetVal = mEmulator->deviceMemAlloc(CLContext, CLDevice, Properties, Size,
8686
Alignment,
87-
pi::pi_cast<cl_int *>(ErrcodeRet));
87+
pi::cast<cl_int *>(ErrcodeRet));
8888
} else {
8989
RetVal = pfn_clDeviceMemAllocINTEL(CLContext, CLDevice, Properties, Size,
9090
Alignment,
91-
pi::pi_cast<cl_int *>(ErrcodeRet));
91+
pi::cast<cl_int *>(ErrcodeRet));
9292
}
9393
}
9494

@@ -104,18 +104,18 @@ void *USMDispatcher::sharedMemAlloc(pi_context Context, pi_device Device,
104104
pi_result *ErrcodeRet) {
105105
void *RetVal = nullptr;
106106

107-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
108-
cl_context CLContext = pi::pi_cast<cl_context>(Context);
109-
cl_device_id CLDevice = pi::pi_cast<cl_device_id>(Device);
107+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
108+
cl_context CLContext = pi::cast<cl_context>(Context);
109+
cl_device_id CLDevice = pi::cast<cl_device_id>(Device);
110110

111111
if (mEmulated) {
112112
RetVal = mEmulator->sharedMemAlloc(CLContext, CLDevice, Properties, Size,
113113
Alignment,
114-
pi::pi_cast<cl_int *>(ErrcodeRet));
114+
pi::cast<cl_int *>(ErrcodeRet));
115115
} else {
116116
RetVal = pfn_clSharedMemAllocINTEL(CLContext, CLDevice, Properties, Size,
117117
Alignment,
118-
pi::pi_cast<cl_int *>(ErrcodeRet));
118+
pi::cast<cl_int *>(ErrcodeRet));
119119
}
120120
}
121121

@@ -128,8 +128,8 @@ void *USMDispatcher::sharedMemAlloc(pi_context Context, pi_device Device,
128128
pi_result USMDispatcher::memFree(pi_context Context, void *Ptr) {
129129
pi_result RetVal = PI_INVALID_OPERATION;
130130

131-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
132-
cl_context CLContext = pi::pi_cast<cl_context>(Context);
131+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
132+
cl_context CLContext = pi::cast<cl_context>(Context);
133133

134134
if (mEmulated) {
135135
RetVal = PI_CALL_RESULT(mEmulator->memFree(CLContext, Ptr));
@@ -146,8 +146,8 @@ pi_result USMDispatcher::setKernelArgMemPointer(pi_kernel Kernel,
146146
const void *ArgValue) {
147147
pi_result RetVal = PI_INVALID_OPERATION;
148148

149-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
150-
cl_kernel CLKernel = pi::pi_cast<cl_kernel>(Kernel);
149+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
150+
cl_kernel CLKernel = pi::cast<cl_kernel>(Kernel);
151151

152152
if (mEmulated) {
153153
RetVal = PI_CALL_RESULT(
@@ -162,9 +162,9 @@ pi_result USMDispatcher::setKernelArgMemPointer(pi_kernel Kernel,
162162
}
163163

164164
void USMDispatcher::setKernelIndirectAccess(pi_kernel Kernel, pi_queue Queue) {
165-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
166-
cl_kernel CLKernel = pi::pi_cast<cl_kernel>(Kernel);
167-
cl_command_queue CLQueue = pi::pi_cast<cl_command_queue>(Queue);
165+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
166+
cl_kernel CLKernel = pi::cast<cl_kernel>(Kernel);
167+
cl_command_queue CLQueue = pi::cast<cl_command_queue>(Queue);
168168
cl_bool TrueVal = CL_TRUE;
169169

170170
if (mEmulated) {
@@ -199,8 +199,8 @@ pi_result USMDispatcher::enqueueMemset(pi_queue Queue, void *Ptr,
199199
pi_event *Event) {
200200
pi_result RetVal = PI_INVALID_OPERATION;
201201

202-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
203-
cl_command_queue CLQueue = pi::pi_cast<cl_command_queue>(Queue);
202+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
203+
cl_command_queue CLQueue = pi::cast<cl_command_queue>(Queue);
204204

205205
// Is there a better way to convert pi_event * to cl_event *?
206206

@@ -230,8 +230,8 @@ pi_result USMDispatcher::enqueueMemcpy(pi_queue Queue, pi_bool Blocking,
230230
pi_event *Event) {
231231
pi_result RetVal = PI_INVALID_OPERATION;
232232

233-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
234-
cl_command_queue CLQueue = pi::pi_cast<cl_command_queue>(Queue);
233+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
234+
cl_command_queue CLQueue = pi::cast<cl_command_queue>(Queue);
235235

236236
if (mEmulated) {
237237
RetVal = PI_CALL_RESULT(clEnqueueSVMMemcpy(
@@ -257,8 +257,8 @@ pi_result USMDispatcher::enqueueMigrateMem(pi_queue Queue, const void *Ptr,
257257
pi_event *Event) {
258258
pi_result RetVal = PI_INVALID_OPERATION;
259259

260-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
261-
cl_command_queue CLQueue = pi::pi_cast<cl_command_queue>(Queue);
260+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
261+
cl_command_queue CLQueue = pi::cast<cl_command_queue>(Queue);
262262

263263
if (mEmulated) {
264264
// We could check for OpenCL 2.1 and call the SVM migrate
@@ -286,8 +286,8 @@ pi_result USMDispatcher::enqueueMemAdvise(pi_queue Queue, void *Ptr,
286286
pi_event *Event) {
287287
pi_result RetVal = PI_INVALID_OPERATION;
288288

289-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
290-
cl_command_queue CLQueue = pi::pi_cast<cl_command_queue>(Queue);
289+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
290+
cl_command_queue CLQueue = pi::cast<cl_command_queue>(Queue);
291291

292292
if (mEmulated) {
293293
// TODO: What should we do here?
@@ -316,8 +316,8 @@ pi_result USMDispatcher::getMemAllocInfo(pi_context Context, const void *Ptr,
316316
size_t *ParamValueSizeRet) {
317317
pi_result RetVal = PI_INVALID_OPERATION;
318318

319-
if (pi::piUseBackend(pi::PiBackend::SYCL_BE_PI_OPENCL)) {
320-
cl_context CLContext = pi::pi_cast<cl_context>(Context);
319+
if (pi::useBackend(pi::Backend::SYCL_BE_PI_OPENCL)) {
320+
cl_context CLContext = pi::cast<cl_context>(Context);
321321

322322
if (mEmulated) {
323323
// TODO: What should we do here?

sycl/test/usm/findplatforms.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8-
#include <iostream>
9-
108
bool findPlatformAndDevice(cl_device_type deviceType,
119
cl_platform_id &platformOut, cl_device_id &deviceOut) {
1210
cl_uint numPlatforms;

0 commit comments

Comments
 (0)