diff --git a/include/onnxruntime/core/framework/float16.h b/include/onnxruntime/core/framework/float16.h index 598f3748af..290a5e7f2f 100644 --- a/include/onnxruntime/core/framework/float16.h +++ b/include/onnxruntime/core/framework/float16.h @@ -41,7 +41,7 @@ inline bool operator<(const MLFloat16& left, const MLFloat16& right) { return le // BFloat16 struct BFloat16 { uint16_t val{0}; -#if defined(USE_ROCM) +#if defined(__HIP__) ORT_HOST_DEVICE BFloat16() = default; #else BFloat16() = default; @@ -54,7 +54,7 @@ struct BFloat16 { inline ORT_HOST_DEVICE BFloat16(float v) { #if defined(CUDA_VERSION) && CUDA_VERSION >= 11000 && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 800 val = __bfloat16_as_ushort(__float2bfloat16(v)); -#elif defined(USE_ROCM) +#elif defined(__HIP__) // We should be using memcpy in order to respect the strict aliasing rule but it fails in the HIP environment. if (v != v) { // isnan val = UINT16_C(0x7FC0); @@ -81,7 +81,7 @@ struct BFloat16 { inline ORT_HOST_DEVICE float ToFloat() const { #if defined(CUDA_VERSION) && CUDA_VERSION >= 11000 return __bfloat162float(*reinterpret_cast(&val)); -#elif defined(USE_ROCM) +#elif defined(__HIP__) // We should be using memcpy in order to respect the strict aliasing rule but it fails in the HIP environment. float result = 0; uint32_t tmp = val;