From 9f4f18f286bd01593093258d7f6bff3b514ac476 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Wed, 14 Sep 2022 11:04:49 +0800 Subject: [PATCH] Fix arm fp16 compile error (#45991) * fix arm fp16 compile error * polish macro impl --- paddle/phi/common/float16.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/paddle/phi/common/float16.h b/paddle/phi/common/float16.h index 1597602648a..c401d8c6575 100644 --- a/paddle/phi/common/float16.h +++ b/paddle/phi/common/float16.h @@ -14,7 +14,11 @@ #pragma once +#if defined(_M_X64) || defined(__x86_64__) || defined(_M_IX86) || \ + defined(__i386__) +#define __PADDLE_x86__ #include +#endif #include #include @@ -109,7 +113,7 @@ struct PADDLE_ALIGN(2) float16 { float16_t res = vget_lane_f16(vcvt_f16_f32(tmp), 0); x = *reinterpret_cast(&res); -#elif defined(__F16C__) +#elif defined(__F16C__) and defined(__PADDLE_x86__) x = _cvtss_sh(val, 0); #else -- GitLab