@@ -228,42 +228,48 @@ class half;
228
228
229
229
// Several aliases are defined below:
230
230
// - StorageT: actual representation of half data type. It is used by scalar
231
- // half values and by 'sycl::vec' class . On device side, it points to some
232
- // native half data type, while on host some custom data type is used to
233
- // emulate operations of 16-bit floating-point values
231
+ // half values. On device side, it points to some native half data type, while
232
+ // on host some custom data type is used to emulate operations of 16-bit
233
+ // floating-point values
234
234
//
235
235
// - BIsRepresentationT: data type which is used by built-in functions. It is
236
236
// distinguished from StorageT, because on host, we can still operate on the
237
237
// wrapper itself and there is no sense in direct usage of underlying data
238
238
// type (too many changes required for BIs implementation without any
239
239
// foreseeable profits)
240
240
//
241
- // - VecNStorageT - representation of N-element vector of halfs. Follows the
242
- // same logic as StorageT
241
+ // - VecElemT: representation of each element in the vector. On device it is
242
+ // the same as StorageT to carry a native vector representation, while on
243
+ // host it stores the sycl::half implementation directly.
244
+ //
245
+ // - VecNStorageT: representation of N-element vector of halfs. Follows the
246
+ // same logic as VecElemT.
243
247
#ifdef __SYCL_DEVICE_ONLY__
244
248
using StorageT = _Float16;
245
249
using BIsRepresentationT = _Float16;
250
+ using VecElemT = _Float16;
246
251
247
- using Vec2StorageT = StorageT __attribute__ ((ext_vector_type(2 )));
248
- using Vec3StorageT = StorageT __attribute__ ((ext_vector_type(3 )));
249
- using Vec4StorageT = StorageT __attribute__ ((ext_vector_type(4 )));
250
- using Vec8StorageT = StorageT __attribute__ ((ext_vector_type(8 )));
251
- using Vec16StorageT = StorageT __attribute__ ((ext_vector_type(16 )));
252
+ using Vec2StorageT = VecElemT __attribute__ ((ext_vector_type(2 )));
253
+ using Vec3StorageT = VecElemT __attribute__ ((ext_vector_type(3 )));
254
+ using Vec4StorageT = VecElemT __attribute__ ((ext_vector_type(4 )));
255
+ using Vec8StorageT = VecElemT __attribute__ ((ext_vector_type(8 )));
256
+ using Vec16StorageT = VecElemT __attribute__ ((ext_vector_type(16 )));
252
257
#else // SYCL_DEVICE_ONLY
253
258
using StorageT = detail::host_half_impl::half;
254
259
// No need to extract underlying data type for built-in functions operating on
255
260
// host
256
261
using BIsRepresentationT = half;
262
+ using VecElemT = half;
257
263
258
264
// On the host side we cannot use OpenCL cl_half# types as an underlying type
259
265
// for vec because they are actually defined as an integer type under the
260
266
// hood. As a result half values will be converted to the integer and passed
261
267
// as a kernel argument which is expected to be floating point number.
262
- using Vec2StorageT = std::array<StorageT , 2 >;
263
- using Vec3StorageT = std::array<StorageT , 3 >;
264
- using Vec4StorageT = std::array<StorageT , 4 >;
265
- using Vec8StorageT = std::array<StorageT , 8 >;
266
- using Vec16StorageT = std::array<StorageT , 16 >;
268
+ using Vec2StorageT = std::array<VecElemT , 2 >;
269
+ using Vec3StorageT = std::array<VecElemT , 3 >;
270
+ using Vec4StorageT = std::array<VecElemT , 4 >;
271
+ using Vec8StorageT = std::array<VecElemT , 8 >;
272
+ using Vec16StorageT = std::array<VecElemT , 16 >;
267
273
#endif // SYCL_DEVICE_ONLY
268
274
269
275
#ifndef __SYCL_DEVICE_ONLY__
0 commit comments