Skip to content

Commit 597b66f

Browse files
committed
[Cleanup] Format and align template struct definitions in half.hpp, common.h, and gemm_sp_sm80.h
1 parent 88435da commit 597b66f

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

src/tl_templates/cpp/half.hpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,9 @@ using std::true_type;
513513
template <typename T> struct is_float : std::is_floating_point<T> {};
514514
#else
515515
/// Conditional type.
516-
template <bool, typename T, typename> struct conditional { typedef T type; };
516+
template <bool, typename T, typename> struct conditional {
517+
typedef T type;
518+
};
517519
template <typename T, typename F> struct conditional<false, T, F> {
518520
typedef F type;
519521
};
@@ -534,7 +536,9 @@ template <> struct is_float<long double> : true_type {};
534536
#endif
535537

536538
/// Type traits for floating-point bits.
537-
template <typename T> struct bits { typedef unsigned char type; };
539+
template <typename T> struct bits {
540+
typedef unsigned char type;
541+
};
538542
template <typename T> struct bits<const T> : bits<T> {};
539543
template <typename T> struct bits<volatile T> : bits<T> {};
540544
template <typename T> struct bits<const volatile T> : bits<T> {};
@@ -550,10 +554,14 @@ typedef std::uint_fast32_t uint32;
550554
typedef std::int_fast32_t int32;
551555

552556
/// Unsigned integer of (at least) 32 bits width.
553-
template <> struct bits<float> { typedef std::uint_least32_t type; };
557+
template <> struct bits<float> {
558+
typedef std::uint_least32_t type;
559+
};
554560

555561
/// Unsigned integer of (at least) 64 bits width.
556-
template <> struct bits<double> { typedef std::uint_least64_t type; };
562+
template <> struct bits<double> {
563+
typedef std::uint_least64_t type;
564+
};
557565
#else
558566
/// Unsigned integer of (at least) 16 bits width.
559567
typedef unsigned short uint16;
@@ -578,7 +586,9 @@ struct bits<double>
578586
unsigned long, unsigned long long> {};
579587
#else
580588
/// Unsigned integer of (at least) 64 bits width.
581-
template <> struct bits<double> { typedef unsigned long type; };
589+
template <> struct bits<double> {
590+
typedef unsigned long type;
591+
};
582592
#endif
583593
#endif
584594

src/tl_templates/cuda/common.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ TL_DEVICE unsigned int cast_smem_ptr_to_int(const void *const smem_ptr) {
136136
return smem_int;
137137
}
138138

139-
template <typename T> struct normalize_atomic_type { using type = T; };
139+
template <typename T> struct normalize_atomic_type {
140+
using type = T;
141+
};
140142

141143
template <> /**
142144
* Map the public half_t alias to the native `half` type for atomic

src/tl_templates/cuda/gemm_sp_sm80.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,13 @@ template <> struct DispatchType<cutlass::bfloat16_t> {
121121
using Type = cutlass::bfloat16_t;
122122
};
123123

124-
template <> struct DispatchType<unsigned char> { using Type = uint8_t; };
124+
template <> struct DispatchType<unsigned char> {
125+
using Type = uint8_t;
126+
};
125127

126-
template <> struct DispatchType<signed char> { using Type = int8_t; };
128+
template <> struct DispatchType<signed char> {
129+
using Type = int8_t;
130+
};
127131

128132
template <typename Shape, int num_warp_m, int num_warp_n, bool trans_A,
129133
bool trans_B, bool clear_accum, typename A_type_raw,

0 commit comments

Comments
 (0)