fixed multiple definition issue of bfp16/fp32 conversion function when building ckProfiler (#51)

* fixed bfloat16 issues

* refactor type_convert

Co-authored-by: Chao Liu <chao.liu2@amd.com>
This commit is contained in:
zjing14
2021-11-16 15:44:17 -06:00
committed by GitHub
parent 89e1ebd4d5
commit 0a66c54e95
18 changed files with 157 additions and 337 deletions

View File

@@ -61,3 +61,13 @@ void ostream_HostTensorDescriptor(const HostTensorDescriptor& desc, std::ostream
LogRange(os, desc.GetStrides(), ", ");
os << "}" << std::endl;
}
float bf16_to_f32_(ushort src_val)
{
union
{
uint32_t int32;
float fp32;
} u = {uint32_t(src_val) << 16};
return u.fp32;
}