pytorch/caffe2/operators/quantized/int8_simd.h
JerryShih 0dfdc2cbdb Update int8_simd.h (#13859)
Summary:
If we use clang with sse4 support, we will have the function redefinition
error between [1] and [2]. This patch try to add some checkings to fix this
problem.

I just turn on USE_NATIVE_ARCH with clang, then I hit the redefinition error.

[1]
caffe2/operators/quantized/int8_simd.h
[2]
third_party/gemmlowp/gemmlowp/fixedpoint/fixedpoint_sse.h
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13859

Differential Revision: D13095694

Pulled By: ezyang

fbshipit-source-id: c65166e4d5a04bb54e2b82c52740af00116ccb0d
2019-01-16 23:19:46 -08:00

24 lines
722 B
C

#pragma once
// We want to allow 128-bit wide SIMD if either NEON is available (as
// detected by GEMMLOWP_NEON), or whether SSE4.2 and Clang is
// available (in which case we will use the neon_sse.h library to
// share source between the two implementations). We use SSE4.2 to
// ensure we can use the full neon2sse library, and we use Clang as
// GCC has issues correctly compiling some parts of the neon2sse
// library.
// Otherwise, the INT8_NEON_SIMD variable will be undefined.
#include "gemmlowp/fixedpoint/fixedpoint.h"
#include "gemmlowp/public/gemmlowp.h"
#ifdef GEMMLOWP_NEON
#define INT8_NEON_SIMD
#endif
#if defined(__SSE4_2__) && defined(__clang__)
#include "NEON_2_SSE.h"
#define INT8_NEON_SIMD
#endif