• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2022 Huawei Technologies Co., Ltd
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 #include "nnacl/kernel/matmul_create.h"
18 #include "nnacl/kernel/matmul_base.h"
19 #if defined(ENABLE_AVX512)
20 #include "nnacl/kernel/matmul_avx512.h"
21 #include "nnacl/intrinsics/ms_simd_cpu_info.h"
22 #endif
23 
24 #if defined(ENABLE_AVX)
25 #include "nnacl/kernel/matmul_avx.h"
26 #endif
27 
28 #if defined(ENABLE_SSE)
29 #include "nnacl/kernel/matmul_sse.h"
30 #endif
31 
32 #if defined(ENABLE_ARM32)
33 #include "nnacl/kernel/matmul_arm32.h"
34 #endif
35 
36 #if defined(ENABLE_ARM64)
37 #include "nnacl/kernel/matmul_arm64.h"
38 #endif
39 
CreateMatmulKernel()40 KernelBase *CreateMatmulKernel() {
41   KernelBase *matmul = NULL;
42 
43 #if defined(ENABLE_AVX512)
44   AVX512_HARDWARE_SELF_AWARENESS_BEGIN
45   matmul = CreateMatmulAVX512();
46   if (matmul != NULL) {
47     return matmul;
48   }
49   AVX512_HARDWARE_SELF_AWARENESS_END
50 #endif
51 
52 #if defined(ENABLE_AVX)
53   matmul = CreateMatmulAVX();
54   if (matmul != NULL) {
55     return matmul;
56   }
57 #endif
58 
59 #if defined(ENABLE_SSE)
60   matmul = CreateMatmulSSE();
61   if (matmul != NULL) {
62     return matmul;
63   }
64 #endif
65 
66 #if defined(ENABLE_ARM64)
67   matmul = CreateMatmulARM64();
68   if (matmul != NULL) {
69     return matmul;
70   }
71 #endif
72 
73 #if defined(ENABLE_ARM32)
74   matmul = CreateMatmulARM32();
75   if (matmul != NULL) {
76     return matmul;
77   }
78 #endif
79 
80   matmul = CreateMatmulBase();
81   return matmul;
82 }
83