mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Add AArch64 NEON parity generation and recovery functions
This commit is contained in:
parent
d9c6b7989e
commit
f76fcf7ab1
12 changed files with 1755 additions and 6 deletions
|
|
@ -23,7 +23,13 @@
|
|||
#define CONFIG_X86 1
|
||||
#define CONFIG_X86_64 1
|
||||
#endif
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#if defined(__ARM_NEON) || defined(__ARM_NEON__)
|
||||
#define CONFIG_NEON 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Includes anything required for compatibility.
|
||||
|
|
@ -144,6 +150,16 @@ void raid_recX_avx2gfni(int nr, int *id, int *ip, int nd, size_t size, void **vv
|
|||
void raid_rec1_avx512gfni(int nr, int *id, int *ip, int nd, size_t size, void **vv);
|
||||
void raid_rec2_avx512gfni(int nr, int *id, int *ip, int nd, size_t size, void **vv);
|
||||
void raid_recX_avx512gfni(int nr, int *id, int *ip, int nd, size_t size, void **vv);
|
||||
void raid_gen1_neon(int nd, size_t size, void **vv);
|
||||
void raid_gen2_neon(int nd, size_t size, void **vv);
|
||||
void raid_genz_neon(int nd, size_t size, void **vv);
|
||||
void raid_gen3_neon(int nd, size_t size, void **vv);
|
||||
void raid_gen4_neon(int nd, size_t size, void **vv);
|
||||
void raid_gen5_neon(int nd, size_t size, void **vv);
|
||||
void raid_gen6_neon(int nd, size_t size, void **vv);
|
||||
void raid_rec1_neon(int nr, int *id, int *ip, int nd, size_t size, void **vv);
|
||||
void raid_rec2_neon(int nr, int *id, int *ip, int nd, size_t size, void **vv);
|
||||
void raid_recX_neon(int nr, int *id, int *ip, int nd, size_t size, void **vv);
|
||||
|
||||
/*
|
||||
* Functions for parity computation.
|
||||
|
|
@ -348,5 +364,23 @@ static __always_inline void raid_avx_end(void)
|
|||
}
|
||||
#endif /* CONFIG_X86 */
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
static __always_inline void raid_neon_begin(void)
|
||||
{
|
||||
}
|
||||
|
||||
static __always_inline void raid_neon_end(void)
|
||||
{
|
||||
asm volatile ("" : : : "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7");
|
||||
asm volatile ("" : : : "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15");
|
||||
asm volatile ("" : : : "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23");
|
||||
asm volatile ("" : : : "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31");
|
||||
}
|
||||
|
||||
void raid_register_neon(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -251,6 +251,9 @@ void raid_init(void)
|
|||
raid_register_avx2gfni();
|
||||
raid_register_avx512gfni();
|
||||
#endif
|
||||
#ifdef CONFIG_NEON
|
||||
raid_register_neon();
|
||||
#endif
|
||||
|
||||
/* set the default mode */
|
||||
raid_mode(RAID_MODE_CAUCHY);
|
||||
|
|
|
|||
1408
raid/neon.c
Normal file
1408
raid/neon.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -9119,7 +9119,7 @@ const uint8_t __aligned(256) raid_gfcauchy[6][256] =
|
|||
},
|
||||
};
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
#if defined(CONFIG_X86) || defined(CONFIG_NEON)
|
||||
/**
|
||||
* PSHUFB tables for the Cauchy matrix.
|
||||
*
|
||||
|
|
@ -14653,7 +14653,7 @@ const uint8_t __aligned(256) raid_gfcauchypshufb[251][5][2][16] =
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
#if defined(CONFIG_X86) || defined(CONFIG_NEON)
|
||||
/**
|
||||
* PSHUFB tables for generic multiplication.
|
||||
*
|
||||
|
|
@ -24805,7 +24805,7 @@ const uint8_t __aligned(256) raid_gfcauchy[6][256] =
|
|||
},
|
||||
};
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
#if defined(CONFIG_X86) || defined(CONFIG_NEON)
|
||||
/**
|
||||
* PSHUFB tables for the Cauchy matrix.
|
||||
*
|
||||
|
|
@ -30339,7 +30339,7 @@ const uint8_t __aligned(256) raid_gfcauchypshufb[251][5][2][16] =
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
#if defined(CONFIG_X86) || defined(CONFIG_NEON)
|
||||
/**
|
||||
* PSHUFB tables for generic multiplication.
|
||||
*
|
||||
|
|
|
|||
25
raid/test.c
25
raid/test.c
|
|
@ -216,6 +216,9 @@ int raid_test_rec(int mode, int nd, size_t size)
|
|||
test_setup(i) = raid_rec1_avx512gfni;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_NEON
|
||||
test_setup(i) = raid_rec1_neon;
|
||||
#endif
|
||||
} else if (i == 2) {
|
||||
test_setup(i) = raid_rec2_int8;
|
||||
|
|
@ -234,6 +237,9 @@ int raid_test_rec(int mode, int nd, size_t size)
|
|||
test_setup(i) = raid_rec2_avx512gfni;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_NEON
|
||||
test_setup(i) = raid_rec2_neon;
|
||||
#endif
|
||||
} else {
|
||||
test_setup(i) = raid_recX_int8;
|
||||
|
|
@ -252,6 +258,9 @@ int raid_test_rec(int mode, int nd, size_t size)
|
|||
test_setup(i) = raid_recX_avx512gfni;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_NEON
|
||||
test_setup(i) = raid_recX_neon;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -370,6 +379,11 @@ int raid_test_par(int mode, int nd, size_t size)
|
|||
test_setup(2) = raid_gen2_int32;
|
||||
test_setup(2) = raid_gen2_int64;
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
test_setup(1) = raid_gen1_neon;
|
||||
test_setup(2) = raid_gen2_neon;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
test_setup(1) = raid_gen1_sse2;
|
||||
|
|
@ -404,6 +418,13 @@ int raid_test_par(int mode, int nd, size_t size)
|
|||
test_setup(5) = raid_gen5_int8;
|
||||
test_setup(6) = raid_gen6_int8;
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
test_setup(3) = raid_gen3_neon;
|
||||
test_setup(4) = raid_gen4_neon;
|
||||
test_setup(5) = raid_gen5_neon;
|
||||
test_setup(6) = raid_gen6_neon;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_ssse3()) {
|
||||
test_setup(3) = raid_gen3_ssse3;
|
||||
|
|
@ -450,6 +471,10 @@ int raid_test_par(int mode, int nd, size_t size)
|
|||
test_setup(3) = raid_genz_int32;
|
||||
test_setup(3) = raid_genz_int64;
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
test_setup(3) = raid_genz_neon;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
test_setup(3) = raid_genz_sse2;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ CFLAGS += -O2 -DUSE_RAID_AES
|
|||
else
|
||||
CFLAGS += -O0 --coverage -DCOVERAGE=1 -DNDEBUG=1
|
||||
endif
|
||||
OBJS = raid.o check.o int.o intz.o x86.o x86z.o gfni.o tables.o memory.o test.o helper.o module.o
|
||||
OBJS = raid.o check.o int.o intz.o x86.o x86z.o gfni.o neon.o tables.o memory.o test.o helper.o module.o
|
||||
|
||||
%.o: ../%.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ int main(void)
|
|||
|
||||
raid_init();
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
printf("Including ARM NEON\n");
|
||||
#endif
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2())
|
||||
printf("Including x86 SSE2\n");
|
||||
|
|
|
|||
|
|
@ -125,6 +125,9 @@ void speed(void)
|
|||
printf("%8s", "int8");
|
||||
printf("%8s", "int32");
|
||||
printf("%8s", "int64");
|
||||
#ifdef CONFIG_NEON
|
||||
printf("%8s", "neon");
|
||||
#endif
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
printf("%8s", "sse2");
|
||||
|
|
@ -179,6 +182,15 @@ void speed(void)
|
|||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen1_neon(nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
SPEED_START {
|
||||
|
|
@ -242,6 +254,15 @@ void speed(void)
|
|||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen2_neon(nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
SPEED_START {
|
||||
|
|
@ -327,6 +348,15 @@ void speed(void)
|
|||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_genz_neon(nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
SPEED_START {
|
||||
|
|
@ -381,6 +411,15 @@ void speed(void)
|
|||
printf("%8s", "");
|
||||
printf("%8s", "");
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen3_neon(nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
printf("%8s", "");
|
||||
|
|
@ -459,6 +498,15 @@ void speed(void)
|
|||
printf("%8s", "");
|
||||
printf("%8s", "");
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen4_neon(nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
printf("%8s", "");
|
||||
|
|
@ -537,6 +585,15 @@ void speed(void)
|
|||
printf("%8s", "");
|
||||
printf("%8s", "");
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen5_neon(nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
printf("%8s", "");
|
||||
|
|
@ -615,6 +672,15 @@ void speed(void)
|
|||
printf("%8s", "");
|
||||
printf("%8s", "");
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen6_neon(nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2()) {
|
||||
printf("%8s", "");
|
||||
|
|
@ -684,6 +750,9 @@ void speed(void)
|
|||
printf("%8s", "");
|
||||
printf("%8s", "best");
|
||||
printf("%8s", "int8");
|
||||
#ifdef CONFIG_NEON
|
||||
printf("%8s", "neon");
|
||||
#endif
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_ssse3())
|
||||
printf("%8s", "ssse3");
|
||||
|
|
@ -713,6 +782,17 @@ void speed(void)
|
|||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen_force(1, raid_gen1_neon);
|
||||
/* +1 to avoid GEN1 optimized case */
|
||||
raid_rec1_neon(1, id, ip + 1, nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_ssse3()) {
|
||||
SPEED_START {
|
||||
|
|
@ -782,6 +862,17 @@ void speed(void)
|
|||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen_force(2, raid_gen2_neon);
|
||||
/* +1 to avoid GEN2 optimized case */
|
||||
raid_rec2_neon(2, id, ip + 1, nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_ssse3()) {
|
||||
SPEED_START {
|
||||
|
|
@ -854,6 +945,16 @@ void speed(void)
|
|||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen_force(3, raid_gen3_neon);
|
||||
raid_recX_neon(3, id, ip, nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_ssse3()) {
|
||||
SPEED_START {
|
||||
|
|
@ -921,6 +1022,16 @@ void speed(void)
|
|||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen_force(4, raid_gen4_neon);
|
||||
raid_recX_neon(4, id, ip, nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_ssse3()) {
|
||||
SPEED_START {
|
||||
|
|
@ -992,6 +1103,16 @@ void speed(void)
|
|||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen_force(5, raid_gen5_neon);
|
||||
raid_recX_neon(5, id, ip, nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_ssse3()) {
|
||||
SPEED_START {
|
||||
|
|
@ -1063,6 +1184,16 @@ void speed(void)
|
|||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
SPEED_START {
|
||||
raid_gen_force(6, raid_gen6_neon);
|
||||
raid_recX_neon(6, id, ip, nd, size, v);
|
||||
} SPEED_STOP
|
||||
|
||||
printf("%8" PRIu64, ds / dt);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_ssse3()) {
|
||||
SPEED_START {
|
||||
|
|
@ -1133,6 +1264,9 @@ int main(void)
|
|||
|
||||
raid_init();
|
||||
|
||||
#ifdef CONFIG_NEON
|
||||
printf("Including ARM NEON\n");
|
||||
#endif
|
||||
#ifdef CONFIG_X86
|
||||
if (raid_cpu_has_sse2())
|
||||
printf("Including x86 SSE2\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue