mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-07-07 07:37:01 +00:00
Add a workaround for fp8/bf8->f32 packed conversion issue
This commit is contained in:
@@ -885,7 +885,14 @@ template <>
|
||||
inline __host__ __device__ float2_t type_convert<float2_t, f8x2_ocp_t>(f8x2_ocp_t x)
|
||||
{
|
||||
#if CK_OCP_FP8_CVT_FAST_PATH
|
||||
// __builtin_amdgcn_cvt_pk_f32_fp8 can produce incorrect results due to a compiler issue.
|
||||
// TODO: Enable when SWDEV-532959 is fixed.
|
||||
#if defined(__gfx1200__) || defined(__gfx1201__)
|
||||
return float2_t{__builtin_amdgcn_cvt_f32_fp8(bit_cast<uint16_t>(x), 0),
|
||||
__builtin_amdgcn_cvt_f32_fp8(bit_cast<uint16_t>(x), 1)};
|
||||
#else
|
||||
return __builtin_amdgcn_cvt_pk_f32_fp8(bit_cast<uint16_t>(x), false);
|
||||
#endif
|
||||
#else
|
||||
return float2_t{fp8_impl::cast_from_f8<float, f8_ocp_t::wm, f8_ocp_t::we, false>(
|
||||
x.AsType<fp8_storage_t>()[Number<0>{}]),
|
||||
@@ -1021,7 +1028,14 @@ template <>
|
||||
inline __host__ __device__ float2_t type_convert<float2_t, bf8x2_ocp_t>(bf8x2_ocp_t x)
|
||||
{
|
||||
#if CK_OCP_FP8_CVT_FAST_PATH
|
||||
// __builtin_amdgcn_cvt_pk_f32_bf8 can produce incorrect results due to a compiler issue.
|
||||
// TODO: Enable when SWDEV-532959 is fixed.
|
||||
#if defined(__gfx1200__) || defined(__gfx1201__)
|
||||
return float2_t{__builtin_amdgcn_cvt_f32_bf8(bit_cast<uint16_t>(x), 0),
|
||||
__builtin_amdgcn_cvt_f32_bf8(bit_cast<uint16_t>(x), 1)};
|
||||
#else
|
||||
return __builtin_amdgcn_cvt_pk_f32_bf8(bit_cast<uint16_t>(x), false);
|
||||
#endif
|
||||
#else
|
||||
return float2_t{fp8_impl::cast_from_f8<float, bf8_ocp_t::wm, bf8_ocp_t::we, false>(
|
||||
x.AsType<fp8_storage_t>()[Number<0>{}]),
|
||||
|
||||
Reference in New Issue
Block a user