13
13
#
14
14
15
15
# MCA_ompi_op_arm_CONFIG([action-if-can-compile],
16
- # [action-if-cant-compile])
16
+ # [action-if-cant-compile])
17
17
# ------------------------------------------------
18
18
AC_DEFUN([MCA_ompi_op_aarch64_CONFIG],[
19
19
AC_CONFIG_FILES([ompi/mca/op/aarch64/Makefile])
@@ -74,33 +74,70 @@ AC_DEFUN([MCA_ompi_op_aarch64_CONFIG],[
74
74
#
75
75
# Check for SVE support
76
76
#
77
- AC_CACHE_CHECK([for SVE support], op_cv_sve_support,
78
- [AS_IF([test " $op_cv_neon_support " = " yes" ],
79
- [
80
- AC_LINK_IFELSE(
81
- [AC_LANG_PROGRAM([[
77
+ AC_CACHE_CHECK([for SVE support], [op_cv_sve_support], [
78
+ AC_MSG_RESULT([])
79
+ # initialize result variables
80
+ op_cv_sve_support= no
81
+ op_cv_sve_add_flags= no
82
+
83
+ # first attempt: no extra flags
84
+ AC_MSG_CHECKING([for SVE support (no additional flags)])
85
+ AC_LINK_IFELSE(
86
+ [AC_LANG_SOURCE([[
82
87
# if defined(__aarch64__) && defined(__ARM_FEATURE_SVE)
83
88
# include <arm_sve.h>
84
89
# else
85
90
# error "No support for __aarch64__ or SVE"
86
91
# endif
87
- ]],
88
- [[
89
- # if defined(__aarch64__) && defined(_ARM_FEATURE_SVE)
90
- svfloat32_t vA;
91
- vA = svdup_n_f32(0)
92
+
93
+ int main(void) {
94
+ svfloat32_t vA;
95
+ vA = svdup_n_f32(0);
96
+ return 0;
97
+ }
98
+ ]])],
99
+ [ op_cv_sve_support= yes
100
+ AC_MSG_RESULT([yes]) ],
101
+ [ AC_MSG_RESULT([no ]) ]
102
+ )
103
+
104
+ # second attempt: use +sve attribute
105
+ AS_IF([test " $op_cv_sve_support " = " no" ],[
106
+ AC_MSG_CHECKING([for SVE support (with +sve)])
107
+ AC_LINK_IFELSE(
108
+ [AC_LANG_SOURCE([[
109
+ # if defined(__aarch64__) && defined(__linux__)
110
+ # include <arm_sve.h>
111
+ # else
112
+ # error "this feature is only supported on aarch64 + linux platforms"
92
113
# endif
93
- ]])],
94
- [op_cv_sve_support= yes],
95
- [op_cv_sve_support= no])])])
96
- ])
97
114
115
+ __attribute__(( __target__("+ sve")) )
116
+ int main(void) {
117
+ svbool_t pg = svptrue_b32 ();
118
+ svuint32_t a = svdup_u32(0);
119
+ svuint32_t b = svdup_u32(0);
120
+ svuint32_t c = svadd_u32_m(pg, a, b);
121
+ return (int)svaddv_u32(pg, c);
122
+ }
123
+ ]])],
124
+ [ op_cv_sve_support= yes
125
+ op_cv_sve_add_flags= yes
126
+ AC_MSG_RESULT([yes]) ],
127
+ [ AC_MSG_RESULT([no ]) ]
128
+ )
129
+ ])
130
+ ])
131
+
132
+ AC_LANG_POP
133
+ ])
98
134
AM_CONDITIONAL([MCA_BUILD_ompi_op_has_neon_support],
99
135
[test " $op_cv_neon_support " = " yes" ])
100
136
AM_CONDITIONAL([MCA_BUILD_ompi_op_has_neon_fp_support],
101
137
[test " $op_cv_neon_fp_support " = " yes" ])
102
138
AM_CONDITIONAL([MCA_BUILD_ompi_op_has_sve_support],
103
139
[test " $op_cv_sve_support " = " yes" ])
140
+
104
141
AC_SUBST(MCA_BUILD_ompi_op_has_neon_support)
105
142
AC_SUBST(MCA_BUILD_ompi_op_has_neon_fp_support)
106
143
AC_SUBST(MCA_BUILD_ompi_op_has_sve_support)
@@ -111,9 +148,12 @@ AC_DEFUN([MCA_ompi_op_aarch64_CONFIG],[
111
148
[AC_DEFINE([OMPI_MCA_OP_HAVE_NEON_FP], [1],[NEON FP supported in the current build])])
112
149
AS_IF([test " $op_cv_sve_support " = " yes" ],
113
150
[AC_DEFINE([OMPI_MCA_OP_HAVE_SVE], [1],[SVE supported in the current build])])
151
+ AS_IF([test " $op_cv_sve_add_flags " = " yes" ],
152
+ [AC_DEFINE([OMPI_MCA_OP_SVE_EXTRA_FLAGS], [1],[SVE supported with additional compile attributes])],
153
+ [AC_DEFINE([OMPI_MCA_OP_SVE_EXTRA_FLAGS], [0],[SVE not supported])])
114
154
115
- # If we have at least support for Neon
116
- AS_IF([test " $op_cv_neon_support " = " yes" ],
155
+ # If we have at least support for Neon or SVE
156
+ AS_IF([test " $op_cv_neon_support " = " yes" || test " $op_cv_sve_support " = " yes " ],
117
157
[$1 ],
118
158
[$2 ])
119
159
])dnl
0 commit comments