Skip to content

[WIP][SYCL] Replaces some of the CL_* enums with PI_* enums. #1221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
84ddd10
[SYCL] Replaces some of the CL_* enums with PI_* enums.
rbegam Feb 12, 2020
6193e29
[SYCL] Rearranges enum pi_device_info.
rbegam Feb 29, 2020
071df8d
[SYCL] removes unneccessasy comments.
rbegam Feb 29, 2020
b3a9426
[SYCL] Fix mismatch between sub_group headers (#1215)
Pennycook Feb 29, 2020
3da5473
[SYCL] Fix command cleanup invoked from multiple threads (#1214)
sergey-semenov Mar 1, 2020
4b5d25b
[SYCL][NFC] Add clang-format configuration file for SYCL LIT tests (#…
bader Mar 1, 2020
c220eb8
[SYCL] Make context constructors explicit to avoid unintended convers…
jbrodman Mar 2, 2020
3035170
[SYCL] Disable tests which take more than 5 minutes (#1220)
vladimirlaz Mar 2, 2020
aa0619c
[SYCL] Fix check-sycl-deploy target problems (#1165)
Fznamznon Mar 2, 2020
745e759
[SYCL][CUDA] Handle the case of not having any CUDA device (#1212)
fwyzard Mar 2, 2020
b1aa222
[CUDA][PI] clang-format pi.h
bjoernknafla Feb 27, 2020
5e7ea06
[SYCL][CUDA] Fix context creation property parsing
bjoernknafla Feb 27, 2020
d214718
Update sycl/include/CL/sycl/detail/pi.h
rbegam Mar 2, 2020
399acef
Update sycl/include/CL/sycl/detail/pi.h
rbegam Mar 2, 2020
ef68270
[SYCL][CUDA] Fixes context release and unnamed context scope (#1207)
steffenlarsen Mar 2, 2020
a2bf2f1
[SYCL] Replaces some of the CL_* enums with PI_* enums.
rbegam Feb 12, 2020
ec0b39d
[SYCL] Rearranges enum pi_device_info.
rbegam Feb 29, 2020
5bf8bc9
[SYCL] Update sycl/include/CL/sycl/detail/pi.h
rbegam Mar 2, 2020
b6ec999
[SYCL] Resolves conflicts for sycl/include/CL/sycl/detail/pi.h
rbegam Mar 3, 2020
15c44dd
Merge branch 'private/rbegam/sycl-rename' of https://github.com/rbega…
rbegam Mar 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 151 additions & 75 deletions sycl/include/CL/sycl/detail/pi.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class queue {
/// @param Length is a number of bytes in the allocation.
/// @param Advice is a device-defined advice for the specified allocation.
/// @return an event representing advice operation.
event mem_advise(const void *Ptr, size_t Length, int Advice);
event mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice);

/// Provides hints to the runtime library that data should be made available
/// on a device earlier than Unified Shared Memory would normally require it
Expand Down
9 changes: 5 additions & 4 deletions sycl/source/detail/error_handling/enqueue_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ bool handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,

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

if (CompileWGSize[0] != 0) {
// OpenCL 1.x && 2.0:
Expand Down Expand Up @@ -90,10 +90,11 @@ bool handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,
// PI_INVALID_WORK_GROUP_SIZE if local_work_size is specified and the
// total number of work-items in the work-group computed as
// local_work_size[0] * ... * local_work_size[work_dim – 1] is greater
// than the value specified by PI_KERNEL_GROUP_INFO_SIZE in table 5.21.
// than the value specified by PI_KERNEL_GROUP_INFO_WORK_GROUP_SIZE in
// table 5.21.
size_t KernelWGSize = 0;
Plugin.call<PiApiKind::piKernelGetGroupInfo>(
Kernel, Device, PI_KERNEL_GROUP_INFO_SIZE, sizeof(size_t),
Kernel, Device, PI_KERNEL_GROUP_INFO_WORK_GROUP_SIZE, sizeof(size_t),
&KernelWGSize, nullptr);
const size_t TotalNumberOfWIs =
NDRDesc.LocalSize[0] * NDRDesc.LocalSize[1] * NDRDesc.LocalSize[2];
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ event_impl::event_impl(RT::PiEvent Event, const context &SyclContext)

RT::PiContext TempContext;
getPlugin().call<PiApiKind::piEventGetInfo>(
MEvent, CL_EVENT_CONTEXT, sizeof(RT::PiContext), &TempContext, nullptr);
MEvent, PI_EVENT_INFO_CONTEXT, sizeof(RT::PiContext), &TempContext, nullptr);
if (MContext->getHandleRef() != TempContext) {
throw cl::sycl::invalid_parameter_error(
"The syclContext must match the OpenCL context associated with the "
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/event_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ template <info::event Param> struct get_event_info {
static RetType get(RT::PiEvent Event, const plugin &Plugin) {
RetType Result = (RetType)0;
// TODO catch an exception and put it to list of asynchronous exceptions
Plugin.call<PiApiKind::piEventGetInfo>(Event, cl_profiling_info(Param),
Plugin.call<PiApiKind::piEventGetInfo>(Event, pi_event_info(Param),
sizeof(Result), &Result, nullptr);
return Result;
}
Expand Down
8 changes: 4 additions & 4 deletions sycl/source/detail/program_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ program_impl::program_impl(ContextImplPtr Context, RT::PiProgram Program)
: MProgram(Program), MContext(Context), MLinkable(true) {

// TODO handle the case when cl_program build is in progress
cl_uint NumDevices;
pi_uint32 NumDevices;
const detail::plugin &Plugin = getPlugin();
Plugin.call<PiApiKind::piProgramGetInfo>(
Program, PI_PROGRAM_INFO_NUM_DEVICES, sizeof(cl_uint), &NumDevices, nullptr);
Program, PI_PROGRAM_INFO_NUM_DEVICES, sizeof(pi_uint32), &NumDevices, nullptr);
vector_class<RT::PiDevice> PiDevices(NumDevices);
Plugin.call<PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES,
sizeof(RT::PiDevice) * NumDevices,
Expand Down Expand Up @@ -402,10 +402,10 @@ cl_uint program_impl::get_info<info::program::reference_count>() const {
if (is_host()) {
throw invalid_object_error("This instance of program is a host instance");
}
cl_uint Result;
pi_uint32 Result;
const detail::plugin &Plugin = getPlugin();
Plugin.call<PiApiKind::piProgramGetInfo>(MProgram, PI_PROGRAM_INFO_REFERENCE_COUNT,
sizeof(cl_uint), &Result, nullptr);
sizeof(pi_uint32), &Result, nullptr);
return Result;
}

Expand Down
8 changes: 4 additions & 4 deletions sycl/source/detail/program_manager/program_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static RT::PiProgram createBinaryProgram(const ContextImplPtr Context,
// FIXME: we don't yet support multiple devices with a single binary.
const detail::plugin &Plugin = Context->getPlugin();
#ifndef _NDEBUG
cl_uint NumDevices = 0;
pi_uint32 NumDevices = 0;
Plugin.call<PiApiKind::piContextGetInfo>(Context->getHandleRef(),
PI_CONTEXT_INFO_NUM_DEVICES,
sizeof(NumDevices), &NumDevices,
Expand Down Expand Up @@ -435,7 +435,7 @@ ProgramManager::getClProgramFromClKernel(RT::PiKernel Kernel,
RT::PiProgram Program;
const detail::plugin &Plugin = Context->getPlugin();
Plugin.call<PiApiKind::piKernelGetInfo>(
Kernel, PI_KERNEL_INFO_PROGRAM, sizeof(cl_program), &Program, nullptr);
Kernel, PI_KERNEL_INFO_PROGRAM, sizeof(RT::PiProgram), &Program, nullptr);
return Program;
}

Expand All @@ -446,8 +446,8 @@ string_class ProgramManager::getProgramBuildLog(const RT::PiProgram &Program,
Plugin.call<PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES, 0,
nullptr, &Size);
vector_class<RT::PiDevice> PIDevices(Size / sizeof(RT::PiDevice));
Plugin.call<PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES, Size,
PIDevices.data(), nullptr);
Plugin.call<PiApiKind::piProgramGetInfo>(Program, PI_PROGRAM_INFO_DEVICES,
Size, PIDevices.data(), nullptr);
string_class Log = "The program was built for " +
std::to_string(PIDevices.size()) + " devices";
for (RT::PiDevice &Device : PIDevices) {
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/queue_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ event queue_impl::memcpy(shared_ptr_class<detail::queue_impl> Impl, void *Dest,
return ResEvent;
}

event queue_impl::mem_advise(const void *Ptr, size_t Length, int Advice) {
event queue_impl::mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice) {
context Context = get_context();
if (Context.is_host()) {
return event();
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class queue_impl {
/// @param Ptr is a USM pointer to the allocation.
/// @param Length is a number of bytes in the allocation.
/// @param Advice is a device-defined advice for the specified allocation.
event mem_advise(const void *Ptr, size_t Length, int Advice);
event mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice);

/// Puts exception to the list of asynchronous ecxeptions.
///
Expand Down
6 changes: 3 additions & 3 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,11 +934,11 @@ cl_int ExecCGCommand::enqueueImp() {
pi_mem MemArg = (pi_mem)AllocaCmd->getMemAllocation();
Plugin.call<PiApiKind::piextKernelSetArgMemObj>(Kernel, Arg.MIndex, &MemArg);
#else
cl_mem MemArg = (cl_mem)AllocaCmd->getMemAllocation();
RT::PiMem MemArg = (RT::PiMem)AllocaCmd->getMemAllocation();
Plugin.call<PiApiKind::piKernelSetArg>(Kernel, Arg.MIndex,
sizeof(cl_mem), &MemArg);
sizeof(RT::PiMem), &MemArg);
Plugin.call<PiApiKind::piKernelSetArg>(Kernel, Arg.MIndex,
sizeof(cl_mem), &MemArg);
sizeof(RT::PiMem), &MemArg);
#endif
break;
}
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ event queue::memcpy(void *dest, const void *src, size_t count) {
return impl->memcpy(impl, dest, src, count);
}

event queue::mem_advise(const void *ptr, size_t length, int advice) {
event queue::mem_advise(const void *ptr, size_t length, pi_mem_advice advice) {
return impl->mem_advise(ptr, length, advice);
}

Expand Down
4 changes: 2 additions & 2 deletions sycl/test/usm/memadvise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main() {
if (s_head == nullptr) {
return -1;
}
q.mem_advise(s_head, sizeof(Node), 42);
q.mem_advise(s_head, sizeof(Node), PI_MEM_ADVICE_SET_READ_MOSTLY);
Node *s_cur = s_head;

for (int i = 0; i < numNodes; i++) {
Expand All @@ -48,7 +48,7 @@ int main() {
if (s_cur->pNext == nullptr) {
return -1;
}
q.mem_advise(s_cur->pNext, sizeof(Node), 42);
q.mem_advise(s_cur->pNext, sizeof(Node), PI_MEM_ADVICE_SET_READ_MOSTLY);
} else {
s_cur->pNext = nullptr;
}
Expand Down