diff options
author | Kenneth Heafield <kpu@users.noreply.github.com> | 2021-04-06 15:27:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 15:27:41 +0300 |
commit | 47ab01ad8f0a9ac8bad217f837479c1bd517bc2a (patch) | |
tree | d0121bfc48ec760fcd28734a3e909ae22e4b240b | |
parent | d3657687c9b84d2ea2ea39b2fac7b89597bde848 (diff) | |
parent | ed8813777656ef2cbcf3d4324f373a26a279520a (diff) |
Merge pull request #86 from abhi-agg/wasm-preprocessor-cleanup
Replaced __EMSCRIPTEN__ with WASM preprocessor directive
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | intgemm/intgemm.h | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 911e087..acc5eb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,11 @@ if (USE_OPENMP) target_link_libraries(intgemm PUBLIC OpenMP::OpenMP_CXX) endif() +if (COMPILE_WASM) + # A compile defintion to compile intgemm on WASM platform + target_compile_definitions(intgemm PUBLIC WASM) +endif() + option(WORMHOLE "Use WASM wormhole https://bugzilla.mozilla.org/show_bug.cgi?id=1672160" OFF) if (WORMHOLE) target_compile_definitions(intgemm PUBLIC INTGEMM_WORMHOLE) diff --git a/intgemm/intgemm.h b/intgemm/intgemm.h index 029a8ec..fdf6980 100644 --- a/intgemm/intgemm.h +++ b/intgemm/intgemm.h @@ -49,7 +49,7 @@ #include "avx512_gemm.h" #include "avx512vnni_gemm.h" -#if defined(__EMSCRIPTEN__) +#if defined(WASM) // No header for CPUID since it's hard-coded. #elif defined(__INTEL_COMPILER) #include <immintrin.h> @@ -171,15 +171,15 @@ template <class T> T ChooseCPU(T avx2 #endif , T ssse3, T -#ifndef __EMSCRIPTEN__ +#ifndef WASM sse2 #endif , T -#ifndef __EMSCRIPTEN__ +#ifndef WASM unsupported #endif ) { -#if defined(__EMSCRIPTEN__) +#if defined(WASM) // emscripten does SSE4.1 but we only use up to SSSE3. return ssse3; #elif defined(__INTEL_COMPILER) |