From c78b57d4db41d99d0fc50741e78aee8ea841fc65 Mon Sep 17 00:00:00 2001 From: "Agarwal, Udit" Date: Thu, 11 Apr 2024 09:38:44 -0700 Subject: [PATCH] Fiox formatting --- .../sycl/detail/generic_type_traits.hpp | 3 +- sycl/include/sycl/types.hpp | 54 +++++++++++-------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/sycl/include/sycl/detail/generic_type_traits.hpp b/sycl/include/sycl/detail/generic_type_traits.hpp index ab83086758a03..fae82268c1d98 100644 --- a/sycl/include/sycl/detail/generic_type_traits.hpp +++ b/sycl/include/sycl/detail/generic_type_traits.hpp @@ -330,8 +330,7 @@ template auto convertToOpenCLType(T &&x) { // non-uniform groups implementation. if constexpr (std::is_same_v) { return bit_cast(x); - } - else { + } else { return bit_cast(x); } #else diff --git a/sycl/include/sycl/types.hpp b/sycl/include/sycl/types.hpp index bba53438037e9..679b9ba258383 100644 --- a/sycl/include/sycl/types.hpp +++ b/sycl/include/sycl/types.hpp @@ -121,7 +121,8 @@ static constexpr ToType BitCast(const FromType &Value) { #endif } -/* Heper functions to get and set values in vec, depdending on the underlying data type. */ +/* Heper functions to get and set values in vec, depdending on the underlying + * data type. */ template struct vec_helper { using RetType = T; static constexpr RetType get(T value) { return value; } @@ -307,8 +308,8 @@ template class vec { // vector extension. This is for MSVC compatibility, which has a max alignment // of 64 for direct params. If we drop MSVC, we can have alignment the same as // size and use vector extensions for all sizes. - // TODO: Inline this ans we are now always using array on device, irrespective of - // the data type. + // TODO: Inline this ans we are now always using array on device, irrespective + // of the data type. static constexpr bool IsUsingArrayOnDevice = true; #if defined(__SYCL_DEVICE_ONLY__) @@ -522,7 +523,8 @@ template class vec { std::is_fundamental_v> || detail::is_half_or_bf16_v>, vec &> - // TODO: Can we use std::fill or something similar to vectorize assignment operation? + // TODO: Can we use std::fill or something similar to vectorize assignment + // operation? operator=(const EnableIfUsingArrayOnDevice &Rhs) { for (int i = 0; i < NumElements; ++i) { setValue(i, Rhs); @@ -567,8 +569,8 @@ template class vec { /* @SYCL2020 * Available only when: compiled for the device. - * Converts this SYCL vec instance to the underlying backend-native vector type - * defined by vector_t. + * Converts this SYCL vec instance to the underlying backend-native vector + * type defined by vector_t. */ operator vector_t() const { if constexpr (NumElements == 1) { @@ -665,8 +667,8 @@ template class vec { !std::is_same_v; if constexpr (canUseNativeVectorConvert) { Result.m_Data = detail::BitCast( - detail::convertImpl(extVecType)); + detail::convertImpl(extVecType)); } else #endif // defined(__SYCL_DEVICE_ONLY__) { @@ -835,7 +837,8 @@ template class vec { #define __SYCL_BINOP(BINOP, OPASSIGN, CONVERT) \ friend vec operator BINOP(const vec &Lhs, const vec &Rhs) { \ vec Ret; \ - if constexpr (IsBfloat16 || std::is_same_v) { \ + if constexpr (IsBfloat16 || \ + std::is_same_v) { \ for (size_t I = 0; I < NumElements; ++I) { \ Ret.setValue(I, (Lhs.getValue(I) BINOP Rhs.getValue(I))); \ } \ @@ -874,8 +877,9 @@ template class vec { friend vec operator BINOP(const vec &Lhs, const vec &Rhs) { \ vec Ret{}; \ for (size_t I = 0; I < NumElements; ++I) \ - Ret.setValue(I, (DataT)(vec_data::get(Lhs.getValue( \ - I)) BINOP vec_data::get(Rhs.getValue(I)))); \ + Ret.setValue(I, \ + (DataT)(vec_data::get(Lhs.getValue(I)) \ + BINOP vec_data::get(Rhs.getValue(I)))); \ return Ret; \ } \ friend vec operator BINOP(const vec &Lhs, const DataT &Rhs) { \ @@ -931,7 +935,8 @@ template class vec { vec Ret{}; \ /* ext_vector_type does not support bfloat16 or half, so for these */ \ /* we do element-by-element operation on the underlying std::array. */ \ - if constexpr (IsBfloat16 || std::is_same_v) { \ + if constexpr (IsBfloat16 || \ + std::is_same_v) { \ for (size_t I = 0; I < NumElements; ++I) { \ /* We cannot use SetValue here as the operator is not a friend of*/ \ /* Ret on Windows. */ \ @@ -1036,14 +1041,14 @@ template class vec { if constexpr (!std::is_same_v && !std::is_same_v && #if (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE != 0) - !std::is_same_v) + !std::is_same_v) #else 1) -#endif - { - auto extVec = detail::BitCast(Rhs.m_Data); - return vec, NumElements>{!extVec}; - } else +#endif + { + auto extVec = detail::BitCast(Rhs.m_Data); + return vec, NumElements>{!extVec}; + } else #endif { for (size_t I = 0; I < NumElements; ++I) { @@ -1159,7 +1164,7 @@ template class vec { constexpr DataT getValue(EnableIfNotHostHalf Index, int) const { return vec_data::get(m_Data[Index]); } -#else // __SYCL_DEVICE_ONLY__ +#else // __SYCL_DEVICE_ONLY__ template > constexpr void setValue(int Index, const DataT &Value, int) { @@ -1971,7 +1976,8 @@ template struct VecStorageImpl { static constexpr size_t Num = (N == 3) ? 4 : N; static constexpr size_t Sz = Num * sizeof(T); // using DataType = - // typename std::conditional>::type; using DataType = std::array; using VectorDataType = T __attribute__((ext_vector_type(N))); @@ -2073,7 +2079,7 @@ template <> struct VecStorage { #if defined(__SYCL_DEVICE_ONLY__) #define __SYCL_DEFINE_HALF_VECSTORAGE(Num) \ template <> struct VecStorage { \ - using DataType = sycl::detail::half_impl::Vec##Num##DeviceStorageT; \ + using DataType = sycl::detail::half_impl::Vec##Num##DeviceStorageT; \ using VectorDataType = sycl::detail::half_impl::Vec##Num##StorageT; \ }; #else // defined(__SYCL_DEVICE_ONLY__) @@ -2105,8 +2111,10 @@ template <> struct VecStorage { #else #define __SYCL_DEFINE_BF16_VECSTORAGE(Num) \ template <> struct VecStorage { \ - using DataType = sycl::ext::oneapi::detail::bf16::Vec##Num##DeviceStorageT; \ - using VectorDataType = sycl::ext::oneapi::detail::bf16::Vec##Num##StorageT; \ + using DataType = \ + sycl::ext::oneapi::detail::bf16::Vec##Num##DeviceStorageT; \ + using VectorDataType = \ + sycl::ext::oneapi::detail::bf16::Vec##Num##StorageT; \ }; #endif __SYCL_DEFINE_BF16_VECSTORAGE(2)