1 | /******************************************************************************* |
2 | * Copyright 2017-2020 Intel Corporation |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | *******************************************************************************/ |
16 | |
17 | #ifndef CPU_GEMM_OS_BLAS_HPP |
18 | #define CPU_GEMM_OS_BLAS_HPP |
19 | |
20 | /* oneDNN provides gemm functionality on its own using jit generated |
21 | * kernels. This is the only official supported option. |
22 | * |
23 | * However, for the debugging purposes we keep (internally) an ability |
24 | * to use cblas functions from the other libraries. The following macros |
25 | * affect the behavior: |
26 | * - USE_CBLAS allow using sgemm and other regular BLAS functionality |
27 | * - USE_MKL (implies USE_CBLAS) same as above + allow using igemm and |
28 | * packed gemm from Intel MKL library. |
29 | */ |
30 | |
31 | #if defined(USE_MKL) |
32 | |
33 | #if !defined(USE_CBLAS) |
34 | #define USE_CBLAS |
35 | #endif |
36 | |
37 | #include "mkl_cblas.h" |
38 | #include "mkl_version.h" |
39 | |
40 | #define USE_MKL_PACKED_GEMM (INTEL_MKL_VERSION >= 20190001) |
41 | #define USE_MKL_IGEMM \ |
42 | (INTEL_MKL_VERSION >= 20180000 && __INTEL_MKL_BUILD_DATE >= 20170628) |
43 | |
44 | #else /* defined(USE_MKL) */ |
45 | |
46 | #define USE_MKL_PACKED_GEMM 0 |
47 | #define USE_MKL_IGEMM 0 |
48 | |
49 | #if defined(USE_CBLAS) |
50 | |
51 | #if defined(_SX) |
52 | extern "C" { |
53 | #endif |
54 | |
55 | #include "cblas.h" |
56 | |
57 | #if defined(_SX) |
58 | } |
59 | #endif |
60 | |
61 | #endif /* defined(USE_CBLAS) */ |
62 | #endif /* defined(USE_MKL) */ |
63 | |
64 | #endif /* CPU_GEMM_OS_BLAS_HPP */ |
65 | |
66 | // vim: et ts=4 sw=4 cindent cino+=l0,\:4,N-s |
67 | |