raid6: arm64: add SVE optimized implementation for syndrome generation
PATCH v2 1/1 raid6: arm64: add SVE optimized implementation for syndrome generation
Implement Scalable Vector Extension (SVE) optimized routines for RAID6 syndrome generation and recovery on ARM64.
The SVE instruction set allows for variable vector lengths (from 128 to 2048 bits), scaling automatically with the hardware capabilities. This implementation handles arbitrary SVE vector lengths using the cntb instruction to determine the runtime vector length.
The implementation introduces svex1, svex2, and svex4 algorithms. The svex4 algorithm utilizes loop unrolling by 4 blocks per iteration and manual software pipelining (interleaving memory loads with XORs) to minimize instruction dependency stalls and maximize CPU pipeline utilization and memory bandwidth.
Performance was tested on an AWS Graviton3 (Neoverse-V1) instance which features 256-bit SVE vector length. The svex4 implementation outperforms the existing 128-bit neonx4 baseline for syndrome generation:
raid6: svex4 gen() 19688 MB/s
raid6: svex2 gen() 18610 MB/s
raid6: svex1 gen() 19254 MB/s
raid6: neonx8 gen() 18554 MB/s
raid6: neonx4 gen() 19612 MB/s
raid6: neonx2 gen() 16248 MB/s
raid6: neonx1 gen() 13591 MB/s
raid6: using algorithm svex4 gen() 19688 MB/s
raid6: .... xor() 11212 MB/s, rmw enabled
raid6: using neon recovery algorithm
Note that for the recovery path (xor_syndrome), NEON may still be selected dynamically by the algorithm benchmark, as the recovery workload is heavily memory-bound.
--- include/linux/raid/pq.h | 3 + lib/raid6/Makefile | 5 + lib/raid6/algos.c | 5 + lib/raid6/sve.c | 675 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 688 insertions(+) create mode 100644 lib/raid6/sve.c
include/linux/raid/pq.h +3 -0
@@ -140,6 +140,9 @@ extern const struct raid6_calls raid6_neonx1;extern const struct raid6_calls raid6_neonx2;extern const struct raid6_calls raid6_neonx4;extern const struct raid6_calls raid6_neonx8; +extern const struct raid6_calls raid6_svex1; +extern const struct raid6_calls raid6_svex2; +extern const struct raid6_calls raid6_svex4;/* Algorithm list */ extern const struct raid6_calls *const raid6_algos[];
lib/raid6/Makefile +5 -0
@@ -8,6 +8,7 @@ raid6_pq-$(CONFIG_X86) += recov_ssse3.o recov_avx2.o mmx.o sse1.o sse2.o avx2.o raid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o \ vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o raid6_pq-$(CONFIG_KERNEL_MODE_NEON) += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o +raid6_pq-$(CONFIG_ARM64_SVE) += sve.o raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o raid6_pq-$(CONFIG_LOONGARCH) += loongarch_simd.o recov_loongarch_simd.o raid6_pq-$(CONFIG_RISCV_ISA_V) += rvv.o recov_rvv.o
@@ -67,6 +68,10 @@ CFLAGS_REMOVE_neon2.o += $(CC_FLAGS_NO_FPU) CFLAGS_REMOVE_neon4.o += $(CC_FLAGS_NO_FPU) CFLAGS_REMOVE_neon8.o += $(CC_FLAGS_NO_FPU) CFLAGS_REMOVE_recov_neon_inner.o += $(CC_FLAGS_NO_FPU) + +CFLAGS_sve.o += $(CC_FLAGS_FPU) +CFLAGS_REMOVE_sve.o += $(CC_FLAGS_NO_FPU) + targets += neon1.c neon2.c neon4.c neon8.c $(obj)/neon%.c: $(src)/neon.uc $(src)/unroll.awk FORCE $(call if_changed,unroll)
lib/raid6/algos.c +5 -0
@@ -66,6 +66,11 @@ const struct raid6_calls * const raid6_algos[] = { &raid6_neonx2, &raid6_neonx1, #endif +#ifdef CONFIG_ARM64_SVE + &raid6_svex4, + &raid6_svex2, + &raid6_svex1, +#endif #ifdef CONFIG_LOONGARCH #ifdef CONFIG_CPU_HAS_LASX &raid6_lasx,
lib/raid6/sve.c new file +675 -0
675 lines not on this page · raw message
Signature · 1 line
2.43.0