Skip to content

Change PI_CALL syntax from PI_CALL(pi, ...Args) to PI_CALL(pi)(...Args); #843

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

Merged
merged 12 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions sycl/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BasedOnStyle: LLVM
TypenameMacros: ['PI_CALL' ,'PI_CALL_THROW', 'PI_CALL_NOCHECK']
5 changes: 2 additions & 3 deletions sycl/include/CL/sycl/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ class buffer {
: Range{0} {

size_t BufSize = 0;
PI_CALL(detail::RT::piMemGetInfo,
detail::pi::cast<detail::RT::PiMem>(MemObject), CL_MEM_SIZE,
sizeof(size_t), &BufSize, nullptr);
PI_CALL(piMemGetInfo)(detail::pi::cast<detail::RT::PiMem>(MemObject),
CL_MEM_SIZE, sizeof(size_t), &BufSize, nullptr);

Range[0] = BufSize / sizeof(T);
impl = std::make_shared<detail::buffer_impl<AllocatorT>>(
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/detail/context_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ template <info::context param> struct get_context_info {
static RetType _(RT::PiContext ctx) {
RetType Result = 0;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piContextGetInfo, ctx, pi::cast<pi_context_info>(param),
sizeof(Result), &Result, nullptr);
PI_CALL(piContextGetInfo)(ctx, pi::cast<pi_context_info>(param),
sizeof(Result), &Result, nullptr);
return Result;
}
};
Expand Down
88 changes: 44 additions & 44 deletions sycl/include/CL/sycl/detail/device_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ template <> struct check_fp_support<info::device::double_fp_config> {
template <typename T, info::device param> struct get_device_info {
static T _(RT::PiDevice dev) {
typename sycl_to_pi<T>::type result;
PI_CALL(RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param),
sizeof(result), &result, nullptr);
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param),
sizeof(result), &result, nullptr);
return T(result);
}
};
Expand All @@ -58,8 +58,8 @@ template <typename T, info::device param> struct get_device_info {
template <info::device param> struct get_device_info<platform, param> {
static platform _(RT::PiDevice dev) {
typename sycl_to_pi<platform>::type result;
PI_CALL(RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param),
sizeof(result), &result, nullptr);
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param),
sizeof(result), &result, nullptr);
return createSyclObjFromImpl<platform>(
std::make_shared<platform_impl_pi>(result));
}
Expand All @@ -69,14 +69,14 @@ template <info::device param> struct get_device_info<platform, param> {
template <info::device param> struct get_device_info<string_class, param> {
static string_class _(RT::PiDevice dev) {
size_t resultSize;
PI_CALL(RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param), 0, nullptr,
&resultSize);
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param), 0, nullptr,
&resultSize);
if (resultSize == 0) {
return string_class();
}
unique_ptr_class<char[]> result(new char[resultSize]);
PI_CALL(RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param), resultSize,
result.get(), nullptr);
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param), resultSize,
result.get(), nullptr);

return string_class(result.get());
}
Expand All @@ -91,8 +91,8 @@ template <typename T> struct get_device_info<T, info::device::parent_device> {
template <info::device param> struct get_device_info<id<3>, param> {
static id<3> _(RT::PiDevice dev) {
size_t result[3];
PI_CALL(RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param),
sizeof(result), &result, nullptr);
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param),
sizeof(result), &result, nullptr);
return id<3>(result[0], result[1], result[2]);
}
};
Expand All @@ -109,8 +109,8 @@ struct get_device_info<vector_class<info::fp_config>, param> {
return {};
}
cl_device_fp_config result;
PI_CALL(RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param),
sizeof(result), &result, nullptr);
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param),
sizeof(result), &result, nullptr);
return read_fp_bitfield(result);
}
};
Expand All @@ -121,9 +121,9 @@ struct get_device_info<vector_class<info::fp_config>,
info::device::single_fp_config> {
static vector_class<info::fp_config> _(RT::PiDevice dev) {
cl_device_fp_config result;
PI_CALL(RT::piDeviceGetInfo, dev,
pi::cast<RT::PiDeviceInfo>(info::device::single_fp_config),
sizeof(result), &result, nullptr);
PI_CALL(piDeviceGetInfo)(
dev, pi::cast<RT::PiDeviceInfo>(info::device::single_fp_config),
sizeof(result), &result, nullptr);
return read_fp_bitfield(result);
}
};
Expand All @@ -132,9 +132,9 @@ struct get_device_info<vector_class<info::fp_config>,
template <> struct get_device_info<bool, info::device::queue_profiling> {
static bool _(RT::PiDevice dev) {
cl_command_queue_properties result;
PI_CALL(RT::piDeviceGetInfo, dev,
pi::cast<RT::PiDeviceInfo>(info::device::queue_profiling),
sizeof(result), &result, nullptr);
PI_CALL(piDeviceGetInfo)(
dev, pi::cast<RT::PiDeviceInfo>(info::device::queue_profiling),
sizeof(result), &result, nullptr);
return (result & CL_QUEUE_PROFILING_ENABLE);
}
};
Expand All @@ -145,9 +145,9 @@ struct get_device_info<vector_class<info::execution_capability>,
info::device::execution_capabilities> {
static vector_class<info::execution_capability> _(RT::PiDevice dev) {
cl_device_exec_capabilities result;
PI_CALL(RT::piDeviceGetInfo, dev,
pi::cast<RT::PiDeviceInfo>(info::device::execution_capabilities),
sizeof(result), &result, nullptr);
PI_CALL(piDeviceGetInfo)(
dev, pi::cast<RT::PiDeviceInfo>(info::device::execution_capabilities),
sizeof(result), &result, nullptr);
return read_execution_bitfield(result);
}
};
Expand Down Expand Up @@ -182,16 +182,16 @@ struct get_device_info<vector_class<info::partition_property>,
pi::cast<RT::PiDeviceInfo>(info::device::partition_properties);

size_t resultSize;
PI_CALL(RT::piDeviceGetInfo, dev, info_partition, 0, nullptr, &resultSize);
PI_CALL(piDeviceGetInfo)(dev, info_partition, 0, nullptr, &resultSize);

size_t arrayLength = resultSize / sizeof(cl_device_partition_property);
if (arrayLength == 0) {
return {};
}
unique_ptr_class<cl_device_partition_property[]> arrayResult(
new cl_device_partition_property[arrayLength]);
PI_CALL(RT::piDeviceGetInfo, dev, info_partition, resultSize, arrayResult.get(),
nullptr);
PI_CALL(piDeviceGetInfo)(dev, info_partition, resultSize, arrayResult.get(),
nullptr);

vector_class<info::partition_property> result;
for (size_t i = 0; i < arrayLength - 1; ++i) {
Expand All @@ -207,8 +207,8 @@ struct get_device_info<vector_class<info::partition_affinity_domain>,
info::device::partition_affinity_domains> {
static vector_class<info::partition_affinity_domain> _(RT::PiDevice dev) {
cl_device_affinity_domain result;
PI_CALL(
RT::piDeviceGetInfo, dev,
PI_CALL(piDeviceGetInfo)(
dev,
pi::cast<RT::PiDeviceInfo>(info::device::partition_affinity_domains),
sizeof(result), &result, nullptr);
return read_domain_bitfield(result);
Expand All @@ -222,18 +222,18 @@ struct get_device_info<info::partition_affinity_domain,
info::device::partition_type_affinity_domain> {
static info::partition_affinity_domain _(RT::PiDevice dev) {
size_t resultSize;
PI_CALL(RT::piDeviceGetInfo, dev,
pi::cast<RT::PiDeviceInfo>(
info::device::partition_type_affinity_domain),
0, nullptr, &resultSize);
PI_CALL(piDeviceGetInfo)(dev,
pi::cast<RT::PiDeviceInfo>(
info::device::partition_type_affinity_domain),
0, nullptr, &resultSize);
if (resultSize != 1) {
return info::partition_affinity_domain::not_applicable;
}
cl_device_partition_property result;
PI_CALL(RT::piDeviceGetInfo, dev,
pi::cast<RT::PiDeviceInfo>(
info::device::partition_type_affinity_domain),
sizeof(result), &result, nullptr);
PI_CALL(piDeviceGetInfo)(dev,
pi::cast<RT::PiDeviceInfo>(
info::device::partition_type_affinity_domain),
sizeof(result), &result, nullptr);
if (result == CL_DEVICE_AFFINITY_DOMAIN_NUMA ||
result == CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE ||
result == CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE ||
Expand All @@ -252,17 +252,17 @@ struct get_device_info<info::partition_property,
info::device::partition_type_property> {
static info::partition_property _(RT::PiDevice dev) {
size_t resultSize;
PI_CALL(RT::piDeviceGetInfo, dev, PI_DEVICE_INFO_PARTITION_TYPE, 0, nullptr,
&resultSize);
PI_CALL(piDeviceGetInfo)(dev, PI_DEVICE_INFO_PARTITION_TYPE, 0, nullptr,
&resultSize);
if (!resultSize)
return info::partition_property::no_partition;

size_t arrayLength = resultSize / sizeof(cl_device_partition_property);

unique_ptr_class<cl_device_partition_property[]> arrayResult(
new cl_device_partition_property[arrayLength]);
PI_CALL(RT::piDeviceGetInfo, dev, PI_DEVICE_INFO_PARTITION_TYPE, resultSize,
arrayResult.get(), nullptr);
PI_CALL(piDeviceGetInfo)(dev, PI_DEVICE_INFO_PARTITION_TYPE, resultSize,
arrayResult.get(), nullptr);
if (!arrayResult[0])
return info::partition_property::no_partition;
return info::partition_property(arrayResult[0]);
Expand All @@ -273,14 +273,14 @@ template <>
struct get_device_info<vector_class<size_t>, info::device::sub_group_sizes> {
static vector_class<size_t> _(RT::PiDevice dev) {
size_t resultSize = 0;
PI_CALL(RT::piDeviceGetInfo, dev,
pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes), 0,
nullptr, &resultSize);
PI_CALL(piDeviceGetInfo)(
dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes), 0,
nullptr, &resultSize);

vector_class<size_t> result(resultSize / sizeof(size_t));
PI_CALL(RT::piDeviceGetInfo, dev,
pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
resultSize, result.data(), nullptr);
PI_CALL(piDeviceGetInfo)(
dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
resultSize, result.data(), nullptr);
return result;
}
};
Expand Down
8 changes: 4 additions & 4 deletions sycl/include/CL/sycl/detail/event_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ template <info::event_profiling Param> struct get_event_profiling_info {
static RetType _(RT::PiEvent Event) {
RetType Result = 0;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piEventGetProfilingInfo,
Event, cl_profiling_info(Param), sizeof(Result), &Result, nullptr);
PI_CALL(piEventGetProfilingInfo)(Event, cl_profiling_info(Param),
sizeof(Result), &Result, nullptr);
return Result;
}
};
Expand All @@ -34,8 +34,8 @@ template <info::event Param> struct get_event_info {
static RetType _(RT::PiEvent Event) {
RetType Result = (RetType)0;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piEventGetInfo,
Event, cl_profiling_info(Param), sizeof(Result), &Result, nullptr);
PI_CALL(piEventGetInfo)(Event, cl_profiling_info(Param), sizeof(Result),
&Result, nullptr);
return Result;
}
};
Expand Down
6 changes: 3 additions & 3 deletions sycl/include/CL/sycl/detail/image_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ class image_impl final : public SYCLMemObjT<AllocatorT> {
: BaseT(MemObject, SyclContext, std::move(AvailableEvent)),
MRange(InitializedVal<Dimensions, range>::template get<0>()) {
RT::PiMem Mem = pi::cast<RT::PiMem>(BaseT::MInteropMemObject);
PI_CALL(RT::piMemGetInfo, Mem, CL_MEM_SIZE, sizeof(size_t),
&(BaseT::MSizeInBytes), nullptr);
PI_CALL(piMemGetInfo)(Mem, CL_MEM_SIZE, sizeof(size_t),
&(BaseT::MSizeInBytes), nullptr);

RT::PiMemImageFormat Format;
getImageInfo(PI_IMAGE_INFO_FORMAT, Format);
Expand Down Expand Up @@ -348,7 +348,7 @@ class image_impl final : public SYCLMemObjT<AllocatorT> {
private:
template <typename T> void getImageInfo(RT::PiMemImageInfo Info, T &Dest) {
RT::PiMem Mem = pi::cast<RT::PiMem>(BaseT::MInteropMemObject);
PI_CALL(RT::piMemImageGetInfo, Mem, Info, sizeof(T), &Dest, nullptr);
PI_CALL(piMemImageGetInfo)(Mem, Info, sizeof(T), &Dest, nullptr);
}

template <info::device Param>
Expand Down
3 changes: 1 addition & 2 deletions sycl/include/CL/sycl/detail/kernel_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ class kernel_impl {
cl_kernel get() const {
if (is_host())
throw invalid_object_error("This instance of kernel is a host instance");

PI_CALL(RT::piKernelRetain, MKernel);
PI_CALL(piKernelRetain)(MKernel);
return pi::cast<cl_kernel>(MKernel);
}

Expand Down
40 changes: 20 additions & 20 deletions sycl/include/CL/sycl/detail/kernel_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ template <info::kernel Param> struct get_kernel_info<string_class, Param> {
static string_class _(RT::PiKernel Kernel) {
size_t ResultSize;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piKernelGetInfo,
Kernel, cl_kernel_info(Param), 0, nullptr, &ResultSize);
PI_CALL(piKernelGetInfo)(Kernel, cl_kernel_info(Param), 0, nullptr,
&ResultSize);
if (ResultSize == 0) {
return "";
}
vector_class<char> Result(ResultSize);
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piKernelGetInfo,
Kernel, cl_kernel_info(Param), ResultSize, Result.data(), nullptr);
PI_CALL(piKernelGetInfo)(Kernel, cl_kernel_info(Param), ResultSize,
Result.data(), nullptr);
return string_class(Result.data());
}
};
Expand All @@ -41,8 +41,8 @@ template <info::kernel Param> struct get_kernel_info<cl_uint, Param> {
static cl_uint _(RT::PiKernel Kernel) {
cl_uint Result;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piKernelGetInfo,
Kernel, cl_kernel_info(Param), sizeof(cl_uint), &Result, nullptr);
PI_CALL(piKernelGetInfo)(Kernel, cl_kernel_info(Param), sizeof(cl_uint),
&Result, nullptr);
return Result;
}
};
Expand All @@ -54,9 +54,9 @@ struct get_kernel_work_group_info {
static T _(RT::PiKernel Kernel, RT::PiDevice Device) {
T Result;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piKernelGetGroupInfo,
Kernel, Device, cl_kernel_work_group_info(Param),
sizeof(T), &Result, nullptr);
PI_CALL(piKernelGetGroupInfo)(Kernel, Device,
cl_kernel_work_group_info(Param), sizeof(T),
&Result, nullptr);
return Result;
}
};
Expand All @@ -66,9 +66,9 @@ struct get_kernel_work_group_info<cl::sycl::range<3>, Param> {
static cl::sycl::range<3> _(RT::PiKernel Kernel, RT::PiDevice Device) {
size_t Result[3];
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piKernelGetGroupInfo,
Kernel, Device, cl_kernel_work_group_info(Param),
sizeof(size_t) * 3, Result, nullptr);
PI_CALL(piKernelGetGroupInfo)(Kernel, Device,
cl_kernel_work_group_info(Param),
sizeof(size_t) * 3, Result, nullptr);
return cl::sycl::range<3>(Result[0], Result[1], Result[2]);
}
};
Expand Down Expand Up @@ -109,9 +109,9 @@ struct get_kernel_sub_group_info {
static TOut _(RT::PiKernel Kernel, RT::PiDevice Device) {
TOut Result;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piKernelGetSubGroupInfo,
Kernel, Device, cl_kernel_sub_group_info(Param), 0, nullptr,
sizeof(TOut), &Result, nullptr);
PI_CALL(piKernelGetSubGroupInfo)(Kernel, Device,
cl_kernel_sub_group_info(Param), 0,
nullptr, sizeof(TOut), &Result, nullptr);
return Result;
}
};
Expand All @@ -121,7 +121,7 @@ struct get_kernel_sub_group_info_with_input {
static TOut _(RT::PiKernel Kernel, RT::PiDevice Device, TIn In) {
TOut Result;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piKernelGetSubGroupInfo,
PI_CALL(piKernelGetSubGroupInfo)(
Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(TIn), &In,
sizeof(TOut), &Result, nullptr);
return Result;
Expand All @@ -135,9 +135,9 @@ struct get_kernel_sub_group_info_with_input<cl::sycl::range<3>, Param,
size_t In) {
size_t Result[3];
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piKernelGetSubGroupInfo,
Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(size_t),
&In, sizeof(size_t) * 3, Result, nullptr);
PI_CALL(piKernelGetSubGroupInfo)(
Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(size_t), &In,
sizeof(size_t) * 3, Result, nullptr);
return cl::sycl::range<3>(Result[0], Result[1], Result[2]);
}
};
Expand All @@ -150,7 +150,7 @@ struct get_kernel_sub_group_info_with_input<size_t, Param,
size_t Input[3] = {In[0], In[1], In[2]};
size_t Result;
// TODO catch an exception and put it to list of asynchronous exceptions
PI_CALL(RT::piKernelGetSubGroupInfo,
PI_CALL(piKernelGetSubGroupInfo)(
Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(size_t) * 3,
Input, sizeof(size_t), &Result, nullptr);
return Result;
Expand Down
Loading