summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Dolbeau <romain@dolbeau.org>2021-04-26 21:42:42 +0200
committerBrian Behlendorf <behlendorf1@llnl.gov>2021-05-19 20:00:08 -0700
commit7dc7f3f127d077588e56c921a7ff6281d5c50e89 (patch)
tree0e9b5bfe9e84321227c01e574ace4233a78b5ad9
parentff691ffab152ed9fb39faf6fda4e17de18e356e3 (diff)
Fix AVX512BW Fletcher code on AVX512-but-not-BW machines
Introduce a specific valid function for avx512f+avx512bw (instead of checking only for avx512f). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Adam Moss <c@yotes.com> Signed-off-by: Romain Dolbeau <romain@dolbeau.org> Closes #11937 Closes #11938
-rw-r--r--module/zcommon/zfs_fletcher_avx512.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/module/zcommon/zfs_fletcher_avx512.c b/module/zcommon/zfs_fletcher_avx512.c
index 300ec4c1f..963f089b0 100644
--- a/module/zcommon/zfs_fletcher_avx512.c
+++ b/module/zcommon/zfs_fletcher_avx512.c
@@ -210,6 +210,12 @@ fletcher_4_avx512bw_byteswap(fletcher_4_ctx_t *ctx, const void *buf,
}
STACK_FRAME_NON_STANDARD(fletcher_4_avx512bw_byteswap);
+static boolean_t
+fletcher_4_avx512bw_valid(void)
+{
+ return (fletcher_4_avx512f_valid() && zfs_avx512bw_available());
+}
+
const fletcher_4_ops_t fletcher_4_avx512bw_ops = {
.init_native = fletcher_4_avx512f_init,
.fini_native = fletcher_4_avx512f_fini,
@@ -217,7 +223,7 @@ const fletcher_4_ops_t fletcher_4_avx512bw_ops = {
.init_byteswap = fletcher_4_avx512f_init,
.fini_byteswap = fletcher_4_avx512f_fini,
.compute_byteswap = fletcher_4_avx512bw_byteswap,
- .valid = fletcher_4_avx512f_valid,
+ .valid = fletcher_4_avx512bw_valid,
.name = "avx512bw"
};
#endif