mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-12 01:10:17 +00:00
Unify saturates<> implementation
This commit is contained in:
@@ -56,20 +56,9 @@ struct saturates
|
||||
CK_TILE_HOST_DEVICE constexpr auto operator()(const From& from) const
|
||||
-> std::enable_if_t<std::is_arithmetic_v<From>, From>
|
||||
{
|
||||
if constexpr(std::is_floating_point_v<To> || std::is_same_v<To, half_t> ||
|
||||
std::is_same_v<To, bfloat16_t> || std::is_same_v<To, fp8_t> ||
|
||||
std::is_same_v<To, bf8_t>)
|
||||
{
|
||||
return clamp(from,
|
||||
type_convert<From>(numeric<To>::lowest()),
|
||||
type_convert<From>(numeric<To>::max()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return clamp(from,
|
||||
type_convert<From>(numeric<To>::min()),
|
||||
type_convert<From>(numeric<To>::max()));
|
||||
}
|
||||
return clamp(from,
|
||||
type_convert<From>(numeric<To>::lowest()),
|
||||
type_convert<From>(numeric<To>::max()));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user