@@ -14,10 +14,13 @@ limitations under the License. */
14
14
15
15
#include " paddle/fluid/operators/math/jit_kernel.h"
16
16
#include < string>
17
- #include " paddle/fluid/operators/math/jit_code.h"
18
17
#include " paddle/fluid/operators/math/jit_kernel_macro.h"
19
18
#include " paddle/fluid/platform/enforce.h"
20
19
20
+ #ifdef PADDLE_WITH_XBYAK
21
+ #include " paddle/fluid/operators/math/jit_code.h"
22
+ #endif
23
+
21
24
#ifdef PADDLE_WITH_MKLML
22
25
#include " paddle/fluid/platform/dynload/mklml.h"
23
26
#endif
@@ -64,6 +67,7 @@ class VMulKernelImpl : public VMulKernel<T> {
64
67
static inline bool useMKL (int d) { return false ; }
65
68
66
69
explicit VMulKernelImpl (int d) : VMulKernel<T>() {
70
+ #ifdef PADDLE_WITH_XBYAK
67
71
if (useJIT (d)) {
68
72
// roughly estimate the size of code
69
73
size_t sz = 96 + d / AVX_FLOAT_BLOCK * 4 * 8 ;
@@ -72,6 +76,7 @@ class VMulKernelImpl : public VMulKernel<T> {
72
76
jitcode_->getCode <void (*)(const T*, const T*, T*, int )>();
73
77
return ;
74
78
}
79
+ #endif
75
80
#ifdef PADDLE_WITH_MKLML
76
81
if (useMKL (d)) {
77
82
this ->Compute = VMulMKL<T>;
@@ -81,15 +86,21 @@ class VMulKernelImpl : public VMulKernel<T> {
81
86
this ->Compute = VMulRefer<T>;
82
87
}
83
88
89
+ #ifdef PADDLE_WITH_XBYAK
90
+
84
91
private:
85
92
std::unique_ptr<gen::VMulJitCode> jitcode_{nullptr };
93
+ #endif
86
94
};
87
95
96
+ #ifdef PADDLE_WITH_XBYAK
88
97
template <>
89
98
bool VMulKernelImpl<float >::useJIT(int d) {
90
99
return gen::VMulJitCode::init (d);
91
100
}
101
+ #endif
92
102
103
+ #ifdef PADDLE_WITH_MKLML
93
104
template <>
94
105
bool VMulKernelImpl<float >::useMKL(int d) {
95
106
return jit::MayIUse (jit::avx512f) && d > 512 ;
@@ -99,6 +110,7 @@ template <>
99
110
bool VMulKernelImpl<double >::useMKL(int d) {
100
111
return true ;
101
112
}
113
+ #endif
102
114
103
115
REGISTER_JITKERNEL (vmul, VMulKernel);
104
116
0 commit comments