File tree Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Expand file tree Collapse file tree 4 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -422,3 +422,7 @@ endif()
422422if (FBGEMM_BUILD_FBGEMM_GPU)
423423 add_subdirectory (fbgemm_gpu)
424424endif ()
425+
426+ if (HAVE_GNU_F2H_IEEE)
427+ add_definitions (-DHAVE_GNU_F2H_IEEE)
428+ endif ()
Original file line number Diff line number Diff line change 1+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2+ # All rights reserved.
3+ #
4+ # This source code is licensed under the BSD-style license found in the
5+ # LICENSE file in the root directory of this source tree.
6+
7+
8+ ################################################################################
9+ # Finds and sets GNU_FH2_IEEE compilation flags
10+ ################################################################################
11+
12+ INCLUDE (CheckCXXSourceCompiles)
13+
14+ CHECK_CXX_SOURCE_COMPILES("
15+ #include <arm_neon.h>
16+ int main() {
17+ float f = 1.0f;
18+ uint16_t h = __gnu_f2h_ieee(f);
19+ return 0;
20+ }
21+ " HAVE_GNU_F2H_IEEE)
Original file line number Diff line number Diff line change 1010
1111set (fbgemm_sources_normal
1212 "${FBGEMM} /src/EmbeddingSpMDM.cc"
13- "${FBGEMM} /src/EmbeddingSpMDMAutovec.cc"
1413 "${FBGEMM} /src/EmbeddingSpMDMNBit.cc"
1514 "${FBGEMM} /src/QuantUtils.cc"
1615 "${FBGEMM} /src/RefImplementations.cc"
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ inline float cpu_half2float_ref(const float16 h) {
287287// Same as the previous function, but use the built-in fp16 to fp32
288288// conversion provided by the compiler
289289inline float cpu_half2float (const float16 h) {
290- #ifdef HAS_NATIVE_FP16_TYPE
290+ #if defined( HAS_NATIVE_FP16_TYPE) && defined(HAVE_GNU_F2H_IEEE)
291291 __fp16 h_fp16;
292292 std::memcpy (&h_fp16, &h, sizeof (__fp16));
293293 return h_fp16;
@@ -297,7 +297,7 @@ inline float cpu_half2float(const float16 h) {
297297}
298298
299299inline float16 cpu_float2half (const float f) {
300- #ifdef HAS_NATIVE_FP16_TYPE
300+ #if defined( HAS_NATIVE_FP16_TYPE) && defined(HAVE_GNU_F2H_IEEE)
301301 __fp16 h = f;
302302 float16 res;
303303 std::memcpy (&res, &h, sizeof (__fp16));
You can’t perform that action at this time.
0 commit comments