未验证 提交 c647cac5 编写于 作者: R risemeup1 提交者: GitHub

patch on gloo/types.h (#50784)

* patch on gloo/types.h

* fix patch

* change patch dir

* add patch
上级 12e9aaa5
......@@ -41,6 +41,7 @@ if(WITH_GPU)
${native_dst})
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCC)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpfullversion -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
......@@ -53,6 +54,9 @@ if(CMAKE_COMPILER_IS_GNUCC)
native_dst)
set(GLOO_PATCH_COMMAND patch -d ${GLOO_SOURCE_DIR}/gloo/transport/tcp <
${native_dst})
file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/gloo/types.h.patch
types_header)
set(GLOO_PATCH_COMMAND patch -d ${GLOO_SOURCE_DIR}/gloo/ < ${types_header})
endif()
endif()
include_directories(${GLOO_INCLUDE_DIR})
......
diff --git a/gloo/types.h b/gloo/types.h
index 31e193b..3a8ed74 100755
--- a/gloo/types.h
+++ b/gloo/types.h
@@ -319,8 +319,7 @@ inline float cpu_half2float(float16 h) {
unsigned temp = ((sign << 31) | (exponent << 23) | mantissa);
- void* rp = &temp;
- return *(float*)rp;
+ return (float)temp;
}
} // namespace gloo
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册