Compute Library
 21.02
Registrars.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2021 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef SRC_CORE_COMMON_REGISTRARS_H
25 #define SRC_CORE_COMMON_REGISTRARS_H
26 
27 #if defined(ENABLE_FP16_KERNELS)
28 
29 #if defined(__ARM_FEATURE_SVE)
30 #define REGISTER_FP16_SVE(func_name) &(func_name)
31 #else /* !defined(__ARM_FEATURE_SVE) */
32 #define REGISTER_FP16_SVE(func_name) nullptr
33 #endif /* defined(__ARM_FEATURE_SVE) */
34 
35 #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
36 #define REGISTER_FP16_NEON(func_name) &(func_name)
37 #else /* !defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) */
38 #define REGISTER_FP16_NEON(func_name) nullptr
39 #endif /* defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) */
40 
41 #else /* !defined(ENABLE_FP16_KERNELS) */
42 #define REGISTER_FP16_NEON(func_name) nullptr
43 #define REGISTER_FP16_SVE(func_name) nullptr
44 #endif /* defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) */
45 
46 #if defined(ENABLE_FP32_KERNELS)
47 #if defined(__ARM_FEATURE_SVE)
48 #define REGISTER_FP32_SVE(func_name) &(func_name)
49 #endif /* defined(__ARM_FEATURE_SVE) */
50 #define REGISTER_FP32_NEON(func_name) &(func_name)
51 #else /* defined(ENABLE_FP32_KERNELS) */
52 #define REGISTER_FP32_NEON(func_name) nullptr
53 #define REGISTER_FP32_SVE(func_name) nullptr
54 #endif /* defined(ENABLE_FP32_KERNELS) */
55 
56 #if defined(ENABLE_QASYMM8_SIGNED_KERNELS)
57 #if defined(__ARM_FEATURE_SVE)
58 #define REGISTER_QASYMM8_SIGNED_SVE(func_name) &(func_name)
59 #endif /* defined(__ARM_FEATURE_SVE) */
60 #define REGISTER_QASYMM8_SIGNED_NEON(func_name) &(func_name)
61 #else /* defined(ENABLE_QASYMM8_SIGNED_KERNELS) */
62 #define REGISTER_QASYMM8_SIGNED_NEON(func_name) nullptr
63 #define REGISTER_QASYMM8_SIGNED_SVE(func_name) nullptr
64 #endif /* defined(ENABLE_QASYMM8_SIGNED_KERNELS) */
65 
66 #if defined(ENABLE_QASYMM8_KERNELS)
67 #if defined(__ARM_FEATURE_SVE)
68 #define REGISTER_QASYMM8_SVE(func_name) &(func_name)
69 #endif /* defined(__ARM_FEATURE_SVE) */
70 #define REGISTER_QASYMM8_NEON(func_name) &(func_name)
71 #else /* defined(ENABLE_QASYMM8_KERNELS) */
72 #define REGISTER_QASYMM8_NEON(func_name) nullptr
73 #define REGISTER_QASYMM8_SVE(func_name) nullptr
74 #endif /* defined(ENABLE_QASYMM8_KERNELS) */
75 
76 #if defined(ENABLE_QSYMM16_KERNELS)
77 #if defined(__ARM_FEATURE_SVE)
78 #define REGISTER_QSYMM16_SVE(func_name) &(func_name)
79 #endif /* defined(__ARM_FEATURE_SVE) */
80 #define REGISTER_QSYMM16_NEON(func_name) &(func_name)
81 #else /* defined(ENABLE_QSYMM16_KERNELS) */
82 #define REGISTER_QSYMM16_NEON(func_name) nullptr
83 #define REGISTER_QSYMM16_SVE(func_name) nullptr
84 #endif /* defined(ENABLE_QSYMM16_KERNELS) */
85 
86 #if defined(ENABLE_INTEGER_KERNELS)
87 #if defined(__ARM_FEATURE_SVE)
88 #define REGISTER_INTEGER_SVE(func_name) &(func_name)
89 #endif /* defined(__ARM_FEATURE_SVE) */
90 #define REGISTER_INTEGER_NEON(func_name) &(func_name)
91 #else /* defined(ENABLE_INTEGER_KERNELS) */
92 #define REGISTER_INTEGER_NEON(func_name) nullptr
93 #define REGISTER_INTEGER_SVE(func_name) nullptr
94 #endif /* defined(ENABLE_INTEGER_KERNELS) */
95 
96 #endif /* SRC_CORE_COMMON_REGISTRARS_H */