@@ -48,19 +48,18 @@ template <> struct check_fp_support<info::device::double_fp_config> {
48
48
template <typename T, info::device param> struct get_device_info {
49
49
static T _ (RT::PiDevice dev) {
50
50
typename sycl_to_pi<T>::type result;
51
- PI_CALL (RT::piDeviceGetInfo (
52
- dev, pi::cast<RT::PiDeviceInfo>(param), sizeof (result), &result, NULL ) );
51
+ PI_CALL (RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param),
52
+ sizeof (result), &result, nullptr );
53
53
return T (result);
54
54
}
55
55
};
56
56
57
57
// Specialization for platform
58
- template <info::device param>
59
- struct get_device_info <platform, param> {
58
+ template <info::device param> struct get_device_info <platform, param> {
60
59
static platform _ (RT::PiDevice dev) {
61
60
typename sycl_to_pi<platform>::type result;
62
- PI_CALL (RT::piDeviceGetInfo (
63
- dev, pi::cast<RT::PiDeviceInfo>(param), sizeof (result), &result, NULL ) );
61
+ PI_CALL (RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param),
62
+ sizeof (result), &result, nullptr );
64
63
return createSyclObjFromImpl<platform>(
65
64
std::make_shared<platform_impl_pi>(result));
66
65
}
@@ -70,32 +69,30 @@ struct get_device_info<platform, param> {
70
69
template <info::device param> struct get_device_info <string_class, param> {
71
70
static string_class _ (RT::PiDevice dev) {
72
71
size_t resultSize;
73
- PI_CALL (RT::piDeviceGetInfo (
74
- dev, pi::cast<RT::PiDeviceInfo>(param), 0 , NULL , &resultSize) );
72
+ PI_CALL (RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param), 0 , nullptr ,
73
+ &resultSize);
75
74
if (resultSize == 0 ) {
76
75
return string_class ();
77
76
}
78
77
unique_ptr_class<char []> result (new char [resultSize]);
79
- PI_CALL (RT::piDeviceGetInfo (
80
- dev, pi::cast<RT::PiDeviceInfo>(param),
81
- resultSize, result.get (), NULL ));
78
+ PI_CALL (RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param), resultSize,
79
+ result.get (), nullptr );
82
80
83
81
return string_class (result.get ());
84
82
}
85
83
};
86
84
87
85
// Specialization for parent device
88
- template <typename T>
89
- struct get_device_info <T, info::device::parent_device> {
86
+ template <typename T> struct get_device_info <T, info::device::parent_device> {
90
87
static T _ (RT::PiDevice dev);
91
88
};
92
89
93
90
// Specialization for id return type
94
91
template <info::device param> struct get_device_info <id<3 >, param> {
95
92
static id<3 > _ (RT::PiDevice dev) {
96
93
size_t result[3 ];
97
- PI_CALL (RT::piDeviceGetInfo (
98
- dev, pi::cast<RT::PiDeviceInfo>(param), sizeof (result), &result, NULL ) );
94
+ PI_CALL (RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param),
95
+ sizeof (result), &result, nullptr );
99
96
return id<3 >(result[0 ], result[1 ], result[2 ]);
100
97
}
101
98
};
@@ -112,21 +109,21 @@ struct get_device_info<vector_class<info::fp_config>, param> {
112
109
return {};
113
110
}
114
111
cl_device_fp_config result;
115
- PI_CALL (RT::piDeviceGetInfo (
116
- dev, pi::cast<RT::PiDeviceInfo>(param), sizeof (result), &result, NULL ) );
112
+ PI_CALL (RT::piDeviceGetInfo, dev, pi::cast<RT::PiDeviceInfo>(param),
113
+ sizeof (result), &result, nullptr );
117
114
return read_fp_bitfield (result);
118
115
}
119
116
};
120
117
121
118
// Specialization for single_fp_config, no type support check required
122
119
template <>
123
120
struct get_device_info <vector_class<info::fp_config>,
124
- info::device::single_fp_config> {
121
+ info::device::single_fp_config> {
125
122
static vector_class<info::fp_config> _ (RT::PiDevice dev) {
126
123
cl_device_fp_config result;
127
- PI_CALL (RT::piDeviceGetInfo (
128
- dev, pi::cast<RT::PiDeviceInfo>(info::device::single_fp_config),
129
- sizeof (result), &result, NULL ) );
124
+ PI_CALL (RT::piDeviceGetInfo, dev,
125
+ pi::cast<RT::PiDeviceInfo>(info::device::single_fp_config),
126
+ sizeof (result), &result, nullptr );
130
127
return read_fp_bitfield (result);
131
128
}
132
129
};
@@ -135,9 +132,9 @@ struct get_device_info<vector_class<info::fp_config>,
135
132
template <> struct get_device_info <bool , info::device::queue_profiling> {
136
133
static bool _ (RT::PiDevice dev) {
137
134
cl_command_queue_properties result;
138
- PI_CALL (RT::piDeviceGetInfo (
139
- dev, pi::cast<RT::PiDeviceInfo>(info::device::queue_profiling),
140
- sizeof (result), &result, NULL ) );
135
+ PI_CALL (RT::piDeviceGetInfo, dev,
136
+ pi::cast<RT::PiDeviceInfo>(info::device::queue_profiling),
137
+ sizeof (result), &result, nullptr );
141
138
return (result & CL_QUEUE_PROFILING_ENABLE);
142
139
}
143
140
};
@@ -148,9 +145,9 @@ struct get_device_info<vector_class<info::execution_capability>,
148
145
info::device::execution_capabilities> {
149
146
static vector_class<info::execution_capability> _ (RT::PiDevice dev) {
150
147
cl_device_exec_capabilities result;
151
- PI_CALL (RT::piDeviceGetInfo (
152
- dev, pi::cast<RT::PiDeviceInfo>(info::device::execution_capabilities),
153
- sizeof (result), &result, NULL ) );
148
+ PI_CALL (RT::piDeviceGetInfo, dev,
149
+ pi::cast<RT::PiDeviceInfo>(info::device::execution_capabilities),
150
+ sizeof (result), &result, nullptr );
154
151
return read_execution_bitfield (result);
155
152
}
156
153
};
@@ -168,8 +165,7 @@ struct get_device_info<vector_class<string_class>,
168
165
169
166
// Specialization for extensions, splits the string returned by OpenCL
170
167
template <>
171
- struct get_device_info <vector_class<string_class>,
172
- info::device::extensions> {
168
+ struct get_device_info <vector_class<string_class>, info::device::extensions> {
173
169
static vector_class<string_class> _ (RT::PiDevice dev) {
174
170
string_class result =
175
171
get_device_info<string_class, info::device::extensions>::_ (dev);
@@ -183,19 +179,19 @@ struct get_device_info<vector_class<info::partition_property>,
183
179
info::device::partition_properties> {
184
180
static vector_class<info::partition_property> _ (RT::PiDevice dev) {
185
181
auto info_partition =
186
- pi::cast<RT::PiDeviceInfo>(info::device::partition_properties);
182
+ pi::cast<RT::PiDeviceInfo>(info::device::partition_properties);
187
183
188
184
size_t resultSize;
189
- PI_CALL (RT::piDeviceGetInfo ( dev, info_partition, 0 , NULL , &resultSize) );
185
+ PI_CALL (RT::piDeviceGetInfo, dev, info_partition, 0 , nullptr , &resultSize);
190
186
191
187
size_t arrayLength = resultSize / sizeof (cl_device_partition_property);
192
188
if (arrayLength == 0 ) {
193
189
return {};
194
190
}
195
191
unique_ptr_class<cl_device_partition_property[]> arrayResult (
196
192
new cl_device_partition_property[arrayLength]);
197
- PI_CALL (RT::piDeviceGetInfo (
198
- dev, info_partition, resultSize, arrayResult. get (), NULL ) );
193
+ PI_CALL (RT::piDeviceGetInfo, dev, info_partition, resultSize, arrayResult. get (),
194
+ nullptr );
199
195
200
196
vector_class<info::partition_property> result;
201
197
for (size_t i = 0 ; i < arrayLength - 1 ; ++i) {
@@ -211,9 +207,10 @@ struct get_device_info<vector_class<info::partition_affinity_domain>,
211
207
info::device::partition_affinity_domains> {
212
208
static vector_class<info::partition_affinity_domain> _ (RT::PiDevice dev) {
213
209
cl_device_affinity_domain result;
214
- PI_CALL (RT::piDeviceGetInfo (
215
- dev, pi::cast<RT::PiDeviceInfo>(info::device::partition_affinity_domains),
216
- sizeof (result), &result, NULL ));
210
+ PI_CALL (
211
+ RT::piDeviceGetInfo, dev,
212
+ pi::cast<RT::PiDeviceInfo>(info::device::partition_affinity_domains),
213
+ sizeof (result), &result, nullptr );
217
214
return read_domain_bitfield (result);
218
215
}
219
216
};
@@ -225,18 +222,18 @@ struct get_device_info<info::partition_affinity_domain,
225
222
info::device::partition_type_affinity_domain> {
226
223
static info::partition_affinity_domain _ (RT::PiDevice dev) {
227
224
size_t resultSize;
228
- PI_CALL (RT::piDeviceGetInfo (
229
- dev, pi::cast<RT::PiDeviceInfo>(
230
- info::device::partition_type_affinity_domain),
231
- 0 , NULL , &resultSize) );
225
+ PI_CALL (RT::piDeviceGetInfo, dev,
226
+ pi::cast<RT::PiDeviceInfo>(
227
+ info::device::partition_type_affinity_domain),
228
+ 0 , nullptr , &resultSize);
232
229
if (resultSize != 1 ) {
233
230
return info::partition_affinity_domain::not_applicable;
234
231
}
235
232
cl_device_partition_property result;
236
- PI_CALL (RT::piDeviceGetInfo (
237
- dev, pi::cast<RT::PiDeviceInfo>(
238
- info::device::partition_type_affinity_domain),
239
- sizeof (result), &result, NULL ) );
233
+ PI_CALL (RT::piDeviceGetInfo, dev,
234
+ pi::cast<RT::PiDeviceInfo>(
235
+ info::device::partition_type_affinity_domain),
236
+ sizeof (result), &result, nullptr );
240
237
if (result == CL_DEVICE_AFFINITY_DOMAIN_NUMA ||
241
238
result == CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE ||
242
239
result == CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE ||
@@ -255,36 +252,35 @@ struct get_device_info<info::partition_property,
255
252
info::device::partition_type_property> {
256
253
static info::partition_property _ (RT::PiDevice dev) {
257
254
size_t resultSize;
258
- PI_CALL (RT::piDeviceGetInfo (
259
- dev, PI_DEVICE_INFO_PARTITION_TYPE, 0 , NULL , &resultSize) );
255
+ PI_CALL (RT::piDeviceGetInfo, dev, PI_DEVICE_INFO_PARTITION_TYPE, 0 , nullptr ,
256
+ &resultSize);
260
257
if (!resultSize)
261
258
return info::partition_property::no_partition;
262
259
263
260
size_t arrayLength = resultSize / sizeof (cl_device_partition_property);
264
261
265
262
unique_ptr_class<cl_device_partition_property[]> arrayResult (
266
263
new cl_device_partition_property[arrayLength]);
267
- PI_CALL (RT::piDeviceGetInfo (
268
- dev, PI_DEVICE_INFO_PARTITION_TYPE, resultSize, arrayResult.get (), 0 ) );
264
+ PI_CALL (RT::piDeviceGetInfo, dev, PI_DEVICE_INFO_PARTITION_TYPE, resultSize,
265
+ arrayResult.get (), nullptr );
269
266
if (!arrayResult[0 ])
270
267
return info::partition_property::no_partition;
271
268
return info::partition_property (arrayResult[0 ]);
272
269
}
273
270
};
274
271
// Specialization for supported subgroup sizes
275
272
template <>
276
- struct get_device_info <vector_class<size_t >,
277
- info::device::sub_group_sizes> {
273
+ struct get_device_info <vector_class<size_t >, info::device::sub_group_sizes> {
278
274
static vector_class<size_t > _ (RT::PiDevice dev) {
279
275
size_t resultSize = 0 ;
280
- PI_CALL (RT::piDeviceGetInfo (
281
- dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
282
- 0 , nullptr , &resultSize) );
283
-
284
- vector_class<size_t > result (resultSize/ sizeof (size_t ));
285
- PI_CALL (RT::piDeviceGetInfo (
286
- dev, pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
287
- resultSize, result.data (), nullptr ) );
276
+ PI_CALL (RT::piDeviceGetInfo, dev,
277
+ pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes), 0 ,
278
+ nullptr , &resultSize);
279
+
280
+ vector_class<size_t > result (resultSize / sizeof (size_t ));
281
+ PI_CALL (RT::piDeviceGetInfo, dev,
282
+ pi::cast<RT::PiDeviceInfo>(info::device::sub_group_sizes),
283
+ resultSize, result.data (), nullptr );
288
284
return result;
289
285
}
290
286
};
0 commit comments