未验证 提交 9f4f18f2 编写于 作者: C Chen Weihang 提交者: GitHub

Fix arm fp16 compile error (#45991)

* fix arm fp16 compile error

* polish macro impl
上级 b85c9b56
...@@ -14,7 +14,11 @@ ...@@ -14,7 +14,11 @@
#pragma once #pragma once
#if defined(_M_X64) || defined(__x86_64__) || defined(_M_IX86) || \
defined(__i386__)
#define __PADDLE_x86__
#include <immintrin.h> #include <immintrin.h>
#endif
#include <stdint.h> #include <stdint.h>
#include <cmath> #include <cmath>
...@@ -109,7 +113,7 @@ struct PADDLE_ALIGN(2) float16 { ...@@ -109,7 +113,7 @@ struct PADDLE_ALIGN(2) float16 {
float16_t res = vget_lane_f16(vcvt_f16_f32(tmp), 0); float16_t res = vget_lane_f16(vcvt_f16_f32(tmp), 0);
x = *reinterpret_cast<uint16_t*>(&res); x = *reinterpret_cast<uint16_t*>(&res);
#elif defined(__F16C__) #elif defined(__F16C__) and defined(__PADDLE_x86__)
x = _cvtss_sh(val, 0); x = _cvtss_sh(val, 0);
#else #else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册