From 0b4f742e8a650fe598ef38ebce39919afe133bc4 Mon Sep 17 00:00:00 2001 From: peizhilin Date: Wed, 19 Dec 2018 17:38:48 +0800 Subject: [PATCH] fix the build issue test=develop --- .../operators/elementwise/elementwise_mul_mkldnn_op.cc | 4 ++++ paddle/fluid/operators/math/detail/lstm_cpu_kernel.h | 6 ++++++ paddle/fluid/operators/math/jit_kernel_blas.cc | 2 ++ 3 files changed, 12 insertions(+) diff --git a/paddle/fluid/operators/elementwise/elementwise_mul_mkldnn_op.cc b/paddle/fluid/operators/elementwise/elementwise_mul_mkldnn_op.cc index a3cf78dac5d..b45e08174c6 100644 --- a/paddle/fluid/operators/elementwise/elementwise_mul_mkldnn_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_mul_mkldnn_op.cc @@ -83,8 +83,12 @@ class ElementwiseMulMKLDNNKernel : public framework::OpKernel { UpdateDataFormat(ctx, const_cast(x), "x_data_format"); UpdateDataFormat(ctx, const_cast(y), "y_data_format"); +#ifdef PADDLE_WITH_XBYAK Xbyak::util::Cpu cpu; const bool is_avx512_enabled = cpu.has(Xbyak::util::Cpu::tAVX512F); +#else + const bool is_avx512_enabled = platform::MayIUse(platform::avx512f); +#endif // PADDLE_WITH_XBYAK const bool are_dims_divisable = !(x_int_dims[1] % 16); const bool is_x_format_correct = x->format() == memory::format::nChw16c; const bool is_y_format_correct = y->format() == memory::format::nc; diff --git a/paddle/fluid/operators/math/detail/lstm_cpu_kernel.h b/paddle/fluid/operators/math/detail/lstm_cpu_kernel.h index ccbd05c82ad..2e3779ff084 100644 --- a/paddle/fluid/operators/math/detail/lstm_cpu_kernel.h +++ b/paddle/fluid/operators/math/detail/lstm_cpu_kernel.h @@ -17,6 +17,12 @@ limitations under the License. */ #include "paddle/fluid/operators/math/detail/activation_functions.h" #include "paddle/fluid/operators/math/lstm_compute.h" +#if defined(_WIN32) +#if defined(__AVX2__) || defined(__AVX__) +inline __m256 operator+=(__m256 a, __m256 b) { return _mm256_add_ps(a, b); } +#endif +#endif + namespace paddle { namespace operators { namespace math { diff --git a/paddle/fluid/operators/math/jit_kernel_blas.cc b/paddle/fluid/operators/math/jit_kernel_blas.cc index 8cf588efba5..ea54367c3b4 100644 --- a/paddle/fluid/operators/math/jit_kernel_blas.cc +++ b/paddle/fluid/operators/math/jit_kernel_blas.cc @@ -212,8 +212,10 @@ class EltwiseMulnChw16cNCKernelImpl private: std::unique_ptr jitcode_{nullptr}; +#endif }; +#ifdef PADDLE_WITH_XBYAK template <> bool EltwiseMulnChw16cNCKernelImpl::useJIT(int d) { return true; -- GitLab