"...composable_kernel.git" did not exist on "f53ede26e5cb58cb90d9c6c96dafc9a61d1dccc8"
Commit 710e2081 authored by fsx950223's avatar fsx950223
Browse files

use rtz

parent a61aa740
...@@ -964,22 +964,16 @@ inline __host__ __device__ constexpr float type_convert<float, bhalf_t>(bhalf_t ...@@ -964,22 +964,16 @@ inline __host__ __device__ constexpr float type_convert<float, bhalf_t>(bhalf_t
return u.fp32; return u.fp32;
} }
// convert fp32 to bfp16
struct uint16x2_t{
ushort x;
ushort y;
};
template <> template <>
inline __host__ __device__ constexpr bhalf_t type_convert<bhalf_t, float>(float x) inline __host__ __device__ constexpr bhalf_t type_convert<bhalf_t, float>(float x)
{ {
union union
{ {
float fp32; float fp32;
uint16x2_t int32; uint32_t int32;
} u = {x}; } u = {static_cast<float>(x)};
return u.int32.y + (u.int32.x >> 15); return uint16_t(u.int32 >> 16);
} }
// convert fp16 to bf16 // convert fp16 to bf16
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment