Skip to content

Commit 4da9833

Browse files
committed
Move std::common_type specialization to traits.hpp
and remove stale comments
1 parent d7b8676 commit 4da9833

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

sycl/include/syclcompat/math.hpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,30 +2302,3 @@ inline constexpr unsigned extend_vcompare4_add(AT a, BT b, unsigned c,
23022302
}
23032303

23042304
} // namespace syclcompat
2305-
2306-
// Specialize std::common_type for bfloat16
2307-
// Semantics here match bfloat16.hpp operator overloads (all mixed type math
2308-
// ops return bfloat16)
2309-
// TODO(syclcompat-lib-reviewers) Move this to bfloat extension
2310-
namespace std {
2311-
template <> struct common_type<sycl::ext::oneapi::bfloat16> {
2312-
using type = sycl::ext::oneapi::bfloat16;
2313-
};
2314-
2315-
template <>
2316-
struct common_type<sycl::ext::oneapi::bfloat16, sycl::ext::oneapi::bfloat16> {
2317-
using type = sycl::ext::oneapi::bfloat16;
2318-
};
2319-
2320-
template <typename T> struct common_type<sycl::ext::oneapi::bfloat16, T> {
2321-
using type = sycl::ext::oneapi::bfloat16; // std::common_type_t<float, T>; //
2322-
// sycl::ext::oneapi::bfloat16
2323-
// promotes to float
2324-
};
2325-
2326-
template <typename T> struct common_type<T, sycl::ext::oneapi::bfloat16> {
2327-
using type = sycl::ext::oneapi::bfloat16; // std::common_type_t<T, float>; //
2328-
// sycl::ext::oneapi::bfloat16
2329-
// promotes to float
2330-
};
2331-
} // namespace std

sycl/include/syclcompat/traits.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,26 @@ template <typename T>
268268
inline constexpr bool is_floating_point_v = is_floating_point<T>::value;
269269

270270
} // namespace syclcompat
271+
272+
// Specialize std::common_type for bfloat16
273+
// Semantics here match bfloat16.hpp operator overloads (all mixed type math
274+
// ops return bfloat16)
275+
// TODO(syclcompat-lib-reviewers) Move this to bfloat extension
276+
namespace std {
277+
template <> struct common_type<sycl::ext::oneapi::bfloat16> {
278+
using type = sycl::ext::oneapi::bfloat16;
279+
};
280+
281+
template <>
282+
struct common_type<sycl::ext::oneapi::bfloat16, sycl::ext::oneapi::bfloat16> {
283+
using type = sycl::ext::oneapi::bfloat16;
284+
};
285+
286+
template <typename T> struct common_type<sycl::ext::oneapi::bfloat16, T> {
287+
using type = sycl::ext::oneapi::bfloat16;
288+
};
289+
290+
template <typename T> struct common_type<T, sycl::ext::oneapi::bfloat16> {
291+
using type = sycl::ext::oneapi::bfloat16;
292+
};
293+
} // namespace std

0 commit comments

Comments
 (0)