Skip to content

Commit 29b516b

Browse files
committed
Change of PI_CALLS into proper format.
Changed the clang-format config file to consider PI_CALL/PI_CALL_THROW/PI_CALL_NOCHECK as typenames instead of being functions. Signed-off-by: Garima Gupta <[email protected]>
1 parent fa380f3 commit 29b516b

26 files changed

+253
-264
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
BasedOnStyle: LLVM
2+
TypenameMacros: ['PI_CALL' ,'PI_CALL_THROW', 'PI_CALL_NOCHECK']

sycl/include/CL/sycl/buffer.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,8 @@ class buffer {
181181
: Range{0} {
182182

183183
size_t BufSize = 0;
184-
PI_CALL(piMemGetInfo)
185-
(detail::pi::cast<detail::RT::PiMem>(MemObject), CL_MEM_SIZE,
186-
sizeof(size_t), &BufSize, nullptr);
184+
PI_CALL(piMemGetInfo)(detail::pi::cast<detail::RT::PiMem>(MemObject),
185+
CL_MEM_SIZE, sizeof(size_t), &BufSize, nullptr);
187186

188187
Range[0] = BufSize / sizeof(T);
189188
impl = std::make_shared<detail::buffer_impl<AllocatorT>>(

sycl/include/CL/sycl/detail/context_info.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ template <info::context param> struct get_context_info {
2222
static RetType _(RT::PiContext ctx) {
2323
RetType Result = 0;
2424
// TODO catch an exception and put it to list of asynchronous exceptions
25-
PI_CALL(piContextGetInfo)
26-
(ctx, pi::cast<pi_context_info>(param), sizeof(Result), &Result, nullptr);
25+
PI_CALL(piContextGetInfo)(ctx, pi::cast<pi_context_info>(param),
26+
sizeof(Result), &Result, nullptr);
2727
return Result;
2828
}
2929
};

sycl/include/CL/sycl/detail/device_info.hpp

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ template <> struct check_fp_support<info::device::double_fp_config> {
4848
template <typename T, info::device param> struct get_device_info {
4949
static T _(RT::PiDevice dev) {
5050
typename sycl_to_pi<T>::type result;
51-
PI_CALL(piDeviceGetInfo)
52-
(dev, pi::cast<RT::PiDeviceInfo>(param), sizeof(result), &result, nullptr);
51+
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param),
52+
sizeof(result), &result, nullptr);
5353
return T(result);
5454
}
5555
};
@@ -58,8 +58,8 @@ template <typename T, info::device param> struct get_device_info {
5858
template <info::device param> struct get_device_info<platform, param> {
5959
static platform _(RT::PiDevice dev) {
6060
typename sycl_to_pi<platform>::type result;
61-
PI_CALL(piDeviceGetInfo)
62-
(dev, pi::cast<RT::PiDeviceInfo>(param), sizeof(result), &result, nullptr);
61+
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param),
62+
sizeof(result), &result, nullptr);
6363
return createSyclObjFromImpl<platform>(
6464
std::make_shared<platform_impl_pi>(result));
6565
}
@@ -69,14 +69,14 @@ template <info::device param> struct get_device_info<platform, param> {
6969
template <info::device param> struct get_device_info<string_class, param> {
7070
static string_class _(RT::PiDevice dev) {
7171
size_t resultSize;
72-
PI_CALL(piDeviceGetInfo)
73-
(dev, pi::cast<RT::PiDeviceInfo>(param), 0, nullptr, &resultSize);
72+
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param), 0, nullptr,
73+
&resultSize);
7474
if (resultSize == 0) {
7575
return string_class();
7676
}
7777
unique_ptr_class<char[]> result(new char[resultSize]);
78-
PI_CALL(piDeviceGetInfo)
79-
(dev, pi::cast<RT::PiDeviceInfo>(param), resultSize, result.get(), nullptr);
78+
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param), resultSize,
79+
result.get(), nullptr);
8080

8181
return string_class(result.get());
8282
}
@@ -91,8 +91,8 @@ template <typename T> struct get_device_info<T, info::device::parent_device> {
9191
template <info::device param> struct get_device_info<id<3>, param> {
9292
static id<3> _(RT::PiDevice dev) {
9393
size_t result[3];
94-
PI_CALL(piDeviceGetInfo)
95-
(dev, pi::cast<RT::PiDeviceInfo>(param), sizeof(result), &result, nullptr);
94+
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param),
95+
sizeof(result), &result, nullptr);
9696
return id<3>(result[0], result[1], result[2]);
9797
}
9898
};
@@ -109,8 +109,8 @@ struct get_device_info<vector_class<info::fp_config>, param> {
109109
return {};
110110
}
111111
cl_device_fp_config result;
112-
PI_CALL(piDeviceGetInfo)
113-
(dev, pi::cast<RT::PiDeviceInfo>(param), sizeof(result), &result, nullptr);
112+
PI_CALL(piDeviceGetInfo)(dev, pi::cast<RT::PiDeviceInfo>(param),
113+
sizeof(result), &result, nullptr);
114114
return read_fp_bitfield(result);
115115
}
116116
};
@@ -121,9 +121,9 @@ struct get_device_info<vector_class<info::fp_config>,
121121
info::device::single_fp_config> {
122122
static vector_class<info::fp_config> _(RT::PiDevice dev) {
123123
cl_device_fp_config result;
124-
PI_CALL(piDeviceGetInfo)
125-
(dev, pi::cast<RT::PiDeviceInfo>(info::device::single_fp_config),
126-
sizeof(result), &result, nullptr);
124+
PI_CALL(piDeviceGetInfo)(
125+
dev, pi::cast<RT::PiDeviceInfo>(info::device::single_fp_config),
126+
sizeof(result), &result, nullptr);
127127
return read_fp_bitfield(result);
128128
}
129129
};
@@ -132,9 +132,9 @@ struct get_device_info<vector_class<info::fp_config>,
132132
template <> struct get_device_info<bool, info::device::queue_profiling> {
133133
static bool _(RT::PiDevice dev) {
134134
cl_command_queue_properties result;
135-
PI_CALL(piDeviceGetInfo)
136-
(dev, pi::cast<RT::PiDeviceInfo>(info::device::queue_profiling),
137-
sizeof(result), &result, nullptr);
135+
PI_CALL(piDeviceGetInfo)(
136+
dev, pi::cast<RT::PiDeviceInfo>(info::device::queue_profiling),
137+
sizeof(result), &result, nullptr);
138138
return (result & CL_QUEUE_PROFILING_ENABLE);
139139
}
140140
};
@@ -145,9 +145,9 @@ struct get_device_info<vector_class<info::execution_capability>,
145145
info::device::execution_capabilities> {
146146
static vector_class<info::execution_capability> _(RT::PiDevice dev) {
147147
cl_device_exec_capabilities result;
148-
PI_CALL(piDeviceGetInfo)
149-
(dev, pi::cast<RT::PiDeviceInfo>(info::device::execution_capabilities),
150-
sizeof(result), &result, nullptr);
148+
PI_CALL(piDeviceGetInfo)(
149+
dev, pi::cast<RT::PiDeviceInfo>(info::device::execution_capabilities),
150+
sizeof(result), &result, nullptr);
151151
return read_execution_bitfield(result);
152152
}
153153
};
@@ -190,8 +190,8 @@ struct get_device_info<vector_class<info::partition_property>,
190190
}
191191
unique_ptr_class<cl_device_partition_property[]> arrayResult(
192192
new cl_device_partition_property[arrayLength]);
193-
PI_CALL(piDeviceGetInfo)
194-
(dev, info_partition, resultSize, arrayResult.get(), nullptr);
193+
PI_CALL(piDeviceGetInfo)(dev, info_partition, resultSize, arrayResult.get(),
194+
nullptr);
195195

196196
vector_class<info::partition_property> result;
197197
for (size_t i = 0; i < arrayLength - 1; ++i) {
@@ -207,9 +207,10 @@ struct get_device_info<vector_class<info::partition_affinity_domain>,
207207
info::device::partition_affinity_domains> {
208208
static vector_class<info::partition_affinity_domain> _(RT::PiDevice dev) {
209209
cl_device_affinity_domain result;
210-
PI_CALL(piDeviceGetInfo)
211-
(dev, pi::cast<RT::PiDeviceInfo>(info::device::partition_affinity_domains),
212-
sizeof(result), &result, nullptr);
210+
PI_CALL(piDeviceGetInfo)(
211+
dev,
212+
pi::cast<RT::PiDeviceInfo>(info::device::partition_affinity_domains),
213+
sizeof(result), &result, nullptr);
213214
return read_domain_bitfield(result);
214215
}
215216
};
@@ -221,18 +222,18 @@ struct get_device_info<info::partition_affinity_domain,
221222
info::device::partition_type_affinity_domain> {
222223
static info::partition_affinity_domain _(RT::PiDevice dev) {
223224
size_t resultSize;
224-
PI_CALL(piDeviceGetInfo)
225-
(dev,
226-
pi::cast<RT::PiDeviceInfo>(info::device::partition_type_affinity_domain),
227-
0, nullptr, &resultSize);
225+
PI_CALL(piDeviceGetInfo)(dev,
226+
pi::cast<RT::PiDeviceInfo>(
227+
info::device::partition_type_affinity_domain),
228+
0, nullptr, &resultSize);
228229
if (resultSize != 1) {
229230
return info::partition_affinity_domain::not_applicable;
230231
}
231232
cl_device_partition_property result;
232-
PI_CALL(piDeviceGetInfo)
233-
(dev,
234-
pi::cast<RT::PiDeviceInfo>(info::device::partition_type_affinity_domain),
235-
sizeof(result), &result, nullptr);
233+
PI_CALL(piDeviceGetInfo)(dev,
234+
pi::cast<RT::PiDeviceInfo>(
235+
info::device::partition_type_affinity_domain),
236+
sizeof(result), &result, nullptr);
236237
if (result == CL_DEVICE_AFFINITY_DOMAIN_NUMA ||
237238
result == CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE ||
238239
result == CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE ||
@@ -251,18 +252,17 @@ struct get_device_info<info::partition_property,
251252
info::device::partition_type_property> {
252253
static info::partition_property _(RT::PiDevice dev) {
253254
size_t resultSize;
254-
PI_CALL(piDeviceGetInfo)
255-
(dev, PI_DEVICE_INFO_PARTITION_TYPE, 0, nullptr, &resultSize);
255+
PI_CALL(piDeviceGetInfo)(dev, PI_DEVICE_INFO_PARTITION_TYPE, 0, nullptr,
256+
&resultSize);
256257
if (!resultSize)
257258
return info::partition_property::no_partition;
258259

259260
size_t arrayLength = resultSize / sizeof(cl_device_partition_property);
260261

261262
unique_ptr_class<cl_device_partition_property[]> arrayResult(
262263
new cl_device_partition_property[arrayLength]);
263-
PI_CALL(piDeviceGetInfo)
264-
(dev, PI_DEVICE_INFO_PARTITION_TYPE, resultSize, arrayResult.get(),
265-
nullptr);
264+
PI_CALL(piDeviceGetInfo)(dev, PI_DEVICE_INFO_PARTITION_TYPE, resultSize,
265+
arrayResult.get(), nullptr);
266266
if (!arrayResult[0])
267267
return info::partition_property::no_partition;
268268
return info::partition_property(arrayResult[0]);
@@ -273,14 +273,14 @@ template <>
273273
struct get_device_info<vector_class<size_t>, info::device::sub_group_sizes> {
274274
static vector_class<size_t> _(RT::PiDevice dev) {
275275
size_t resultSize = 0;
276-
PI_CALL(piDeviceGetInfo)
277-
(dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes), 0, nullptr,
278-
&resultSize);
276+
PI_CALL(piDeviceGetInfo)(
277+
dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes), 0,
278+
nullptr, &resultSize);
279279

280280
vector_class<size_t> result(resultSize / sizeof(size_t));
281-
PI_CALL(piDeviceGetInfo)
282-
(dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes), resultSize,
283-
result.data(), nullptr);
281+
PI_CALL(piDeviceGetInfo)(
282+
dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
283+
resultSize, result.data(), nullptr);
284284
return result;
285285
}
286286
};

sycl/include/CL/sycl/detail/event_info.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ template <info::event_profiling Param> struct get_event_profiling_info {
2222
static RetType _(RT::PiEvent Event) {
2323
RetType Result = 0;
2424
// TODO catch an exception and put it to list of asynchronous exceptions
25-
PI_CALL(piEventGetProfilingInfo)
26-
(Event, cl_profiling_info(Param), sizeof(Result), &Result, nullptr);
25+
PI_CALL(piEventGetProfilingInfo)(Event, cl_profiling_info(Param),
26+
sizeof(Result), &Result, nullptr);
2727
return Result;
2828
}
2929
};
@@ -34,8 +34,8 @@ template <info::event Param> struct get_event_info {
3434
static RetType _(RT::PiEvent Event) {
3535
RetType Result = (RetType)0;
3636
// TODO catch an exception and put it to list of asynchronous exceptions
37-
PI_CALL(piEventGetInfo)
38-
(Event, cl_profiling_info(Param), sizeof(Result), &Result, nullptr);
37+
PI_CALL(piEventGetInfo)(Event, cl_profiling_info(Param), sizeof(Result),
38+
&Result, nullptr);
3939
return Result;
4040
}
4141
};

sycl/include/CL/sycl/detail/image_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ class image_impl final : public SYCLMemObjT<AllocatorT> {
232232
: BaseT(MemObject, SyclContext, std::move(AvailableEvent)),
233233
MRange(InitializedVal<Dimensions, range>::template get<0>()) {
234234
RT::PiMem Mem = pi::cast<RT::PiMem>(BaseT::MInteropMemObject);
235-
PI_CALL(piMemGetInfo)
236-
(Mem, CL_MEM_SIZE, sizeof(size_t), &(BaseT::MSizeInBytes), nullptr);
235+
PI_CALL(piMemGetInfo)(Mem, CL_MEM_SIZE, sizeof(size_t),
236+
&(BaseT::MSizeInBytes), nullptr);
237237

238238
RT::PiMemImageFormat Format;
239239
getImageInfo(PI_IMAGE_INFO_FORMAT, Format);

sycl/include/CL/sycl/detail/kernel_info.hpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ template <info::kernel Param> struct get_kernel_info<string_class, Param> {
2424
static string_class _(RT::PiKernel Kernel) {
2525
size_t ResultSize;
2626
// TODO catch an exception and put it to list of asynchronous exceptions
27-
PI_CALL(piKernelGetInfo)
28-
(Kernel, cl_kernel_info(Param), 0, nullptr, &ResultSize);
27+
PI_CALL(piKernelGetInfo)(Kernel, cl_kernel_info(Param), 0, nullptr,
28+
&ResultSize);
2929
if (ResultSize == 0) {
3030
return "";
3131
}
3232
vector_class<char> Result(ResultSize);
3333
// TODO catch an exception and put it to list of asynchronous exceptions
34-
PI_CALL(piKernelGetInfo)
35-
(Kernel, cl_kernel_info(Param), ResultSize, Result.data(), nullptr);
34+
PI_CALL(piKernelGetInfo)(Kernel, cl_kernel_info(Param), ResultSize,
35+
Result.data(), nullptr);
3636
return string_class(Result.data());
3737
}
3838
};
@@ -41,8 +41,8 @@ template <info::kernel Param> struct get_kernel_info<cl_uint, Param> {
4141
static cl_uint _(RT::PiKernel Kernel) {
4242
cl_uint Result;
4343
// TODO catch an exception and put it to list of asynchronous exceptions
44-
PI_CALL(piKernelGetInfo)
45-
(Kernel, cl_kernel_info(Param), sizeof(cl_uint), &Result, nullptr);
44+
PI_CALL(piKernelGetInfo)(Kernel, cl_kernel_info(Param), sizeof(cl_uint),
45+
&Result, nullptr);
4646
return Result;
4747
}
4848
};
@@ -54,9 +54,9 @@ struct get_kernel_work_group_info {
5454
static T _(RT::PiKernel Kernel, RT::PiDevice Device) {
5555
T Result;
5656
// TODO catch an exception and put it to list of asynchronous exceptions
57-
PI_CALL(piKernelGetGroupInfo)
58-
(Kernel, Device, cl_kernel_work_group_info(Param), sizeof(T), &Result,
59-
nullptr);
57+
PI_CALL(piKernelGetGroupInfo)(Kernel, Device,
58+
cl_kernel_work_group_info(Param), sizeof(T),
59+
&Result, nullptr);
6060
return Result;
6161
}
6262
};
@@ -66,9 +66,9 @@ struct get_kernel_work_group_info<cl::sycl::range<3>, Param> {
6666
static cl::sycl::range<3> _(RT::PiKernel Kernel, RT::PiDevice Device) {
6767
size_t Result[3];
6868
// TODO catch an exception and put it to list of asynchronous exceptions
69-
PI_CALL(piKernelGetGroupInfo)
70-
(Kernel, Device, cl_kernel_work_group_info(Param), sizeof(size_t) * 3,
71-
Result, nullptr);
69+
PI_CALL(piKernelGetGroupInfo)(Kernel, Device,
70+
cl_kernel_work_group_info(Param),
71+
sizeof(size_t) * 3, Result, nullptr);
7272
return cl::sycl::range<3>(Result[0], Result[1], Result[2]);
7373
}
7474
};
@@ -109,9 +109,9 @@ struct get_kernel_sub_group_info {
109109
static TOut _(RT::PiKernel Kernel, RT::PiDevice Device) {
110110
TOut Result;
111111
// TODO catch an exception and put it to list of asynchronous exceptions
112-
PI_CALL(piKernelGetSubGroupInfo)
113-
(Kernel, Device, cl_kernel_sub_group_info(Param), 0, nullptr, sizeof(TOut),
114-
&Result, nullptr);
112+
PI_CALL(piKernelGetSubGroupInfo)(Kernel, Device,
113+
cl_kernel_sub_group_info(Param), 0,
114+
nullptr, sizeof(TOut), &Result, nullptr);
115115
return Result;
116116
}
117117
};
@@ -121,9 +121,9 @@ struct get_kernel_sub_group_info_with_input {
121121
static TOut _(RT::PiKernel Kernel, RT::PiDevice Device, TIn In) {
122122
TOut Result;
123123
// TODO catch an exception and put it to list of asynchronous exceptions
124-
PI_CALL(piKernelGetSubGroupInfo)
125-
(Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(TIn), &In,
126-
sizeof(TOut), &Result, nullptr);
124+
PI_CALL(piKernelGetSubGroupInfo)(
125+
Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(TIn), &In,
126+
sizeof(TOut), &Result, nullptr);
127127
return Result;
128128
}
129129
};
@@ -135,9 +135,9 @@ struct get_kernel_sub_group_info_with_input<cl::sycl::range<3>, Param,
135135
size_t In) {
136136
size_t Result[3];
137137
// TODO catch an exception and put it to list of asynchronous exceptions
138-
PI_CALL(piKernelGetSubGroupInfo)
139-
(Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(size_t), &In,
140-
sizeof(size_t) * 3, Result, nullptr);
138+
PI_CALL(piKernelGetSubGroupInfo)(
139+
Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(size_t), &In,
140+
sizeof(size_t) * 3, Result, nullptr);
141141
return cl::sycl::range<3>(Result[0], Result[1], Result[2]);
142142
}
143143
};
@@ -150,9 +150,9 @@ struct get_kernel_sub_group_info_with_input<size_t, Param,
150150
size_t Input[3] = {In[0], In[1], In[2]};
151151
size_t Result;
152152
// TODO catch an exception and put it to list of asynchronous exceptions
153-
PI_CALL(piKernelGetSubGroupInfo)
154-
(Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(size_t) * 3, Input,
155-
sizeof(size_t), &Result, nullptr);
153+
PI_CALL(piKernelGetSubGroupInfo)(
154+
Kernel, Device, cl_kernel_sub_group_info(Param), sizeof(size_t) * 3,
155+
Input, sizeof(size_t), &Result, nullptr);
156156
return Result;
157157
}
158158
};

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -917,18 +917,17 @@ pi_result piEnqueueMemUnmap(
917917
#define STRING_HELPER(a) #a
918918
#define STRINGIZE(a,b) STRING_HELPER(a.b)
919919

920-
struct _pi_plugin{
920+
struct _pi_plugin {
921921
// PI version supported by host passed to the plugin. The Plugin
922922
// checks and writes the appropriate Function Pointers in
923923
// PiFunctionTable.
924924
// TODO: Work on version fields and their handshaking mechanism.
925-
// Some choices are:
925+
// Some choices are:
926926
// - Use of integers to keep major and minor version.
927927
// - Keeping char* Versions.
928928
const char PiVersion[4] = STRINGIZE(_PI_H_VERSION_MAJOR,_PI_H_VERSION_MINOR);
929929
// Plugin edits this.
930-
char PluginVersion[4] =
931-
STRINGIZE(_PI_H_VERSION_MAJOR,_PI_H_VERSION_MINOR);
930+
char PluginVersion[4] = STRINGIZE(_PI_H_VERSION_MAJOR, _PI_H_VERSION_MINOR);
932931
char *Targets;
933932
struct FunctionPointers {
934933
#define _PI_API(api) decltype(::api) *api;

0 commit comments

Comments
 (0)