Skip to content

Commit 303b6ec

Browse files
committed
[SYCL] Replaces some of the CL_* enums with PI_* enums.
Signed-off-by: rbegam <rehana.begam@intel.com>
1 parent 1da6fbe commit 303b6ec

File tree

12 files changed

+358
-266
lines changed

12 files changed

+358
-266
lines changed

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

Lines changed: 327 additions & 236 deletions
Large diffs are not rendered by default.

sycl/include/CL/sycl/queue.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,11 @@ class queue {
286286
/// Provides additional information to the underlying runtime about how
287287
/// different allocations are used.
288288
///
289-
/// \param Ptr is a USM pointer to the allocation.
290-
/// \param Length is a number of bytes in the allocation.
291-
/// \param Advice is a device-defined advice for the specified allocation.
292-
/// \return an event representing advice operation.
293-
event mem_advise(const void *Ptr, size_t Length, int Advice);
289+
/// @param Ptr is a USM pointer to the allocation.
290+
/// @param Length is a number of bytes in the allocation.
291+
/// @param Advice is a device-defined advice for the specified allocation.
292+
/// @return an event representing advice operation.
293+
event mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice);
294294

295295
/// Provides hints to the runtime library that data should be made available
296296
/// on a device earlier than Unified Shared Memory would normally require it

sycl/source/detail/error_handling/enqueue_kernel.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ bool oclHandleInvalidWorkGroupSize(const device_impl &DeviceImpl,
4040

4141
size_t CompileWGSize[3] = {0};
4242
Plugin.call<PiApiKind::piKernelGetGroupInfo>(
43-
Kernel, Device, PI_KERNEL_COMPILE_GROUP_INFO_SIZE, sizeof(size_t) * 3,
44-
CompileWGSize, nullptr);
43+
Kernel, Device, PI_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE,
44+
sizeof(size_t) * 3, CompileWGSize, nullptr);
4545

4646
if (CompileWGSize[0] != 0) {
4747
// OpenCL 1.x && 2.0:
@@ -90,10 +90,11 @@ bool oclHandleInvalidWorkGroupSize(const device_impl &DeviceImpl,
9090
// PI_INVALID_WORK_GROUP_SIZE if local_work_size is specified and the
9191
// total number of work-items in the work-group computed as
9292
// local_work_size[0] * ... * local_work_size[work_dim – 1] is greater
93-
// than the value specified by PI_KERNEL_GROUP_INFO_SIZE in table 5.21.
93+
// than the value specified by PI_KERNEL_GROUP_INFO_WORK_GROUP_SIZE in
94+
// table 5.21.
9495
size_t KernelWGSize = 0;
9596
Plugin.call<PiApiKind::piKernelGetGroupInfo>(
96-
Kernel, Device, PI_KERNEL_GROUP_INFO_SIZE, sizeof(size_t),
97+
Kernel, Device, PI_KERNEL_GROUP_INFO_WORK_GROUP_SIZE, sizeof(size_t),
9798
&KernelWGSize, nullptr);
9899
const size_t TotalNumberOfWIs =
99100
NDRDesc.LocalSize[0] * NDRDesc.LocalSize[1] * NDRDesc.LocalSize[2];

sycl/source/detail/event_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ event_impl::event_impl(RT::PiEvent Event, const context &SyclContext)
8585

8686
RT::PiContext TempContext;
8787
getPlugin().call<PiApiKind::piEventGetInfo>(
88-
MEvent, CL_EVENT_CONTEXT, sizeof(RT::PiContext), &TempContext, nullptr);
88+
MEvent, PI_EVENT_INFO_CONTEXT, sizeof(RT::PiContext), &TempContext, nullptr);
8989
if (MContext->getHandleRef() != TempContext) {
9090
throw cl::sycl::invalid_parameter_error(
9191
"The syclContext must match the OpenCL context associated with the "

sycl/source/detail/event_info.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ template <info::event Param> struct get_event_info {
3636
static RetType get(RT::PiEvent Event, const plugin &Plugin) {
3737
RetType Result = (RetType)0;
3838
// TODO catch an exception and put it to list of asynchronous exceptions
39-
Plugin.call<PiApiKind::piEventGetInfo>(Event, cl_profiling_info(Param),
39+
Plugin.call<PiApiKind::piEventGetInfo>(Event, pi_event_info(Param),
4040
sizeof(Result), &Result, nullptr);
4141
return Result;
4242
}

sycl/source/detail/program_impl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ program_impl::program_impl(ContextImplPtr Context, RT::PiProgram Program)
8484
: MProgram(Program), MContext(Context), MLinkable(true) {
8585

8686
// TODO handle the case when cl_program build is in progress
87-
cl_uint NumDevices;
87+
pi_uint32 NumDevices;
8888
const detail::plugin &Plugin = getPlugin();
8989
Plugin.call<PiApiKind::piProgramGetInfo>(
90-
Program, PI_PROGRAM_INFO_NUM_DEVICES, sizeof(cl_uint), &NumDevices, nullptr);
90+
Program, PI_PROGRAM_INFO_NUM_DEVICES, sizeof(pi_uint32), &NumDevices, nullptr);
9191
vector_class<RT::PiDevice> PiDevices(NumDevices);
9292
Plugin.call<PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES,
9393
sizeof(RT::PiDevice) * NumDevices,
@@ -411,10 +411,10 @@ cl_uint program_impl::get_info<info::program::reference_count>() const {
411411
throw invalid_object_error("This instance of program is a host instance",
412412
PI_INVALID_PROGRAM);
413413
}
414-
cl_uint Result;
414+
pi_uint32 Result;
415415
const detail::plugin &Plugin = getPlugin();
416416
Plugin.call<PiApiKind::piProgramGetInfo>(MProgram, PI_PROGRAM_INFO_REFERENCE_COUNT,
417-
sizeof(cl_uint), &Result, nullptr);
417+
sizeof(pi_uint32), &Result, nullptr);
418418
return Result;
419419
}
420420

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static RT::PiProgram createBinaryProgram(const ContextImplPtr Context,
7070
// FIXME: we don't yet support multiple devices with a single binary.
7171
const detail::plugin &Plugin = Context->getPlugin();
7272
#ifndef _NDEBUG
73-
cl_uint NumDevices = 0;
73+
pi_uint32 NumDevices = 0;
7474
Plugin.call<PiApiKind::piContextGetInfo>(Context->getHandleRef(),
7575
PI_CONTEXT_INFO_NUM_DEVICES,
7676
sizeof(NumDevices), &NumDevices,
@@ -438,7 +438,7 @@ ProgramManager::getClProgramFromClKernel(RT::PiKernel Kernel,
438438
RT::PiProgram Program;
439439
const detail::plugin &Plugin = Context->getPlugin();
440440
Plugin.call<PiApiKind::piKernelGetInfo>(
441-
Kernel, PI_KERNEL_INFO_PROGRAM, sizeof(cl_program), &Program, nullptr);
441+
Kernel, PI_KERNEL_INFO_PROGRAM, sizeof(RT::PiProgram), &Program, nullptr);
442442
return Program;
443443
}
444444

@@ -449,8 +449,8 @@ string_class ProgramManager::getProgramBuildLog(const RT::PiProgram &Program,
449449
Plugin.call<PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES, 0,
450450
nullptr, &Size);
451451
vector_class<RT::PiDevice> PIDevices(Size / sizeof(RT::PiDevice));
452-
Plugin.call<PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES, Size,
453-
PIDevices.data(), nullptr);
452+
Plugin.call<PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES,
453+
Size, PIDevices.data(), nullptr);
454454
string_class Log = "The program was built for " +
455455
std::to_string(PIDevices.size()) + " devices";
456456
for (RT::PiDevice &Device : PIDevices) {

sycl/source/detail/queue_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ event queue_impl::memcpy(shared_ptr_class<detail::queue_impl> Impl, void *Dest,
6969
return ResEvent;
7070
}
7171

72-
event queue_impl::mem_advise(const void *Ptr, size_t Length, int Advice) {
72+
event queue_impl::mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice) {
7373
context Context = get_context();
7474
if (Context.is_host()) {
7575
return event();

sycl/source/detail/queue_impl.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,10 @@ class queue_impl {
333333
/// Provides additional information to the underlying runtime about how
334334
/// different allocations are used.
335335
///
336-
/// \param Ptr is a USM pointer to the allocation.
337-
/// \param Length is a number of bytes in the allocation.
338-
/// \param Advice is a device-defined advice for the specified allocation.
339-
event mem_advise(const void *Ptr, size_t Length, int Advice);
336+
/// @param Ptr is a USM pointer to the allocation.
337+
/// @param Length is a number of bytes in the allocation.
338+
/// @param Advice is a device-defined advice for the specified allocation.
339+
event mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice);
340340

341341
/// Puts exception to the list of asynchronous ecxeptions.
342342
///

sycl/source/detail/scheduler/commands.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,11 +1643,11 @@ cl_int ExecCGCommand::enqueueImp() {
16431643
pi_mem MemArg = (pi_mem)AllocaCmd->getMemAllocation();
16441644
Plugin.call<PiApiKind::piextKernelSetArgMemObj>(Kernel, Arg.MIndex, &MemArg);
16451645
#else
1646-
cl_mem MemArg = (cl_mem)AllocaCmd->getMemAllocation();
1646+
RT::PiMem MemArg = (RT::PiMem)AllocaCmd->getMemAllocation();
16471647
Plugin.call<PiApiKind::piKernelSetArg>(Kernel, Arg.MIndex,
1648-
sizeof(cl_mem), &MemArg);
1648+
sizeof(RT::PiMem), &MemArg);
16491649
Plugin.call<PiApiKind::piKernelSetArg>(Kernel, Arg.MIndex,
1650-
sizeof(cl_mem), &MemArg);
1650+
sizeof(RT::PiMem), &MemArg);
16511651
#endif
16521652
break;
16531653
}

0 commit comments

Comments
 (0)