Make all RAID forwarders static and local using a new registration interface

Co-authored-by: Andrea Mazzoleni <amadvance@gmail.com>
This commit is contained in:
Christoph Hellwig 2026-04-11 18:26:55 +02:00 • committed by Andrea Mazzoleni
parent 4016f0974a
commit cf515b82b2
12 changed files with 568 additions and 529 deletions

View file

@ -24,7 +24,7 @@ CFLAGS += -O2
else
CFLAGS += -O0 --coverage -DCOVERAGE=1 -DNDEBUG=1
endif
OBJS = raid.o check.o int.o intz.o x86.o x86z.o tables.o memory.o test.o helper.o module.o tag.o
OBJS = raid.o check.o int.o intz.o x86.o x86z.o tables.o memory.o test.o helper.o module.o
%.o: ../%.c
$(CC) $(CFLAGS) -c -o $@ $<

View file

@ -68,15 +68,15 @@ long long EXPECTED[RAID_PARITY_MAX] = {
327012476050LL
};
static __always_inline int test_sub_matrix(int nr, long long *total)
static __always_inline int test_sub_matrix(int nr, int64_t *total)
{
uint8_t M[RAID_PARITY_MAX * RAID_PARITY_MAX];
int np = RAID_PARITY_MAX;
int nd = RAID_DATA_MAX;
int ip[RAID_PARITY_MAX];
int id[RAID_DATA_MAX];
long long count;
long long expected;
int64_t count;
int64_t expected;
printf("\n%ux%u\n", nr, nr);
@ -119,7 +119,7 @@ static __always_inline int test_sub_matrix(int nr, long long *total)
int test_all_sub_matrix(void)
{
long long total;
int64_t total;
printf("Invert all square submatrices of the %dx%d Cauchy matrix\n",
RAID_PARITY_MAX, RAID_DATA_MAX);

View file

@ -143,7 +143,7 @@ void speed(void)
/* GEN1 */
printf("%8s", "gen1");
printf("%8s", raid_gen1_tag());
printf("%8s", raid_gen_tag(RAID_ALGO_CAUCHY_PAR1));
fflush(stdout);
printf("%8s", "");
@ -196,7 +196,7 @@ void speed(void)
/* GEN2 */
printf("%8s", "gen2");
printf("%8s", raid_gen2_tag());
printf("%8s", raid_gen_tag(RAID_ALGO_CAUCHY_PAR2));
fflush(stdout);
printf("%8s", "");
@ -255,7 +255,7 @@ void speed(void)
/* GENz */
printf("%8s", "genz");
printf("%8s", raid_genz_tag());
printf("%8s", raid_gen_tag(RAID_ALGO_VANDERMONDE_PAR3));
fflush(stdout);
printf("%8s", "");
@ -318,7 +318,7 @@ void speed(void)
/* GEN3 */
printf("%8s", "gen3");
printf("%8s", raid_gen3_tag());
printf("%8s", raid_gen_tag(RAID_ALGO_CAUCHY_PAR3));
fflush(stdout);
SPEED_START {
@ -381,7 +381,7 @@ void speed(void)
/* GEN4 */
printf("%8s", "gen4");
printf("%8s", raid_gen4_tag());
printf("%8s", raid_gen_tag(RAID_ALGO_CAUCHY_PAR4));
fflush(stdout);
SPEED_START {
@ -446,7 +446,7 @@ void speed(void)
/* GEN5 */
printf("%8s", "gen5");
printf("%8s", raid_gen5_tag());
printf("%8s", raid_gen_tag(RAID_ALGO_CAUCHY_PAR5));
fflush(stdout);
SPEED_START {
@ -511,7 +511,7 @@ void speed(void)
/* GEN6 */
printf("%8s", "gen6");
printf("%8s", raid_gen6_tag());
printf("%8s", raid_gen_tag(RAID_ALGO_CAUCHY_PAR6));
fflush(stdout);
SPEED_START {
@ -587,13 +587,13 @@ void speed(void)
printf("\n");
printf("%8s", "rec1");
printf("%8s", raid_rec1_tag());
printf("%8s", raid_rec_tag(RAID_ALGO_CAUCHY_PAR1));
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN1 optimized case */
raid_rec1_int8(1, id, ip + 1, nd, size, v);
raid_gen_force(1, sizeof(void *) == 8 ? raid_gen1_int64 : raid_gen1_int32);
/* +1 to avoid GEN1 optimized case */
raid_rec1_int8(1, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -603,9 +603,9 @@ void speed(void)
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN1 optimized case */
raid_rec1_ssse3(1, id, ip + 1, nd, size, v);
raid_gen_force(1, raid_gen1_sse2);
/* +1 to avoid GEN1 optimized case */
raid_rec1_ssse3(1, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -614,9 +614,9 @@ void speed(void)
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN1 optimized case */
raid_rec1_avx2(1, id, ip + 1, nd, size, v);
raid_gen_force(1, raid_gen1_avx2);
/* +1 to avoid GEN1 optimized case */
raid_rec1_avx2(1, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -626,13 +626,13 @@ void speed(void)
printf("\n");
printf("%8s", "rec2");
printf("%8s", raid_rec2_tag());
printf("%8s", raid_rec_tag(RAID_ALGO_CAUCHY_PAR2));
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN2 optimized case */
raid_rec2_int8(2, id, ip + 1, nd, size, v);
raid_gen_force(2, sizeof(void *) == 8 ? raid_gen2_int64 : raid_gen2_int32);
/* +1 to avoid GEN2 optimized case */
raid_rec2_int8(2, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -642,9 +642,13 @@ void speed(void)
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN2 optimized case */
raid_rec2_ssse3(2, id, ip + 1, nd, size, v);
#ifdef CONFIG_X86_64
raid_gen_force(2, raid_gen2_sse2ext);
#else
raid_gen_force(2, raid_gen2_sse2);
#endif
/* +1 to avoid GEN2 optimized case */
raid_rec2_ssse3(2, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -653,9 +657,9 @@ void speed(void)
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
/* +1 to avoid GEN1 optimized case */
raid_rec2_avx2(2, id, ip + 1, nd, size, v);
raid_gen_force(2, raid_gen2_avx2);
/* +1 to avoid GEN1 optimized case */
raid_rec2_avx2(2, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -665,12 +669,12 @@ void speed(void)
printf("\n");
printf("%8s", "rec3");
printf("%8s", raid_recX_tag());
printf("%8s", raid_rec_tag(RAID_ALGO_CAUCHY_PAR3));
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_int8(3, id, ip, nd, size, v);
raid_gen_force(3, raid_gen3_int8);
raid_recX_int8(3, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -680,8 +684,12 @@ void speed(void)
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_ssse3(3, id, ip, nd, size, v);
#ifdef CONFIG_X86_64
raid_gen_force(3, raid_gen3_ssse3ext);
#else
raid_gen_force(3, raid_gen3_ssse3);
#endif
raid_recX_ssse3(3, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -690,8 +698,8 @@ void speed(void)
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_avx2(3, id, ip, nd, size, v);
raid_gen_force(3, raid_gen3_avx2ext);
raid_recX_avx2(3, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -701,12 +709,12 @@ void speed(void)
printf("\n");
printf("%8s", "rec4");
printf("%8s", raid_recX_tag());
printf("%8s", raid_rec_tag(RAID_ALGO_CAUCHY_PAR4));
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_int8(4, id, ip, nd, size, v);
raid_gen_force(4, raid_gen4_int8);
raid_recX_int8(4, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -716,8 +724,12 @@ void speed(void)
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_ssse3(4, id, ip, nd, size, v);
#ifdef CONFIG_X86_64
raid_gen_force(4, raid_gen4_ssse3ext);
#else
raid_gen_force(4, raid_gen4_ssse3);
#endif
raid_recX_ssse3(4, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -726,8 +738,12 @@ void speed(void)
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_avx2(4, id, ip, nd, size, v);
#ifdef CONFIG_X86_64
raid_gen_force(4, raid_gen4_avx2ext);
#else
raid_gen_force(4, raid_gen4_ssse3);
#endif
raid_recX_avx2(4, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -737,12 +753,12 @@ void speed(void)
printf("\n");
printf("%8s", "rec5");
printf("%8s", raid_recX_tag());
printf("%8s", raid_rec_tag(RAID_ALGO_CAUCHY_PAR5));
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_int8(5, id, ip, nd, size, v);
raid_gen_force(5, raid_gen5_int8);
raid_recX_int8(5, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -752,8 +768,12 @@ void speed(void)
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_ssse3(5, id, ip, nd, size, v);
#ifdef CONFIG_X86_64
raid_gen_force(5, raid_gen5_ssse3ext);
#else
raid_gen_force(5, raid_gen5_ssse3);
#endif
raid_recX_ssse3(5, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -762,8 +782,12 @@ void speed(void)
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_avx2(5, id, ip, nd, size, v);
#ifdef CONFIG_X86_64
raid_gen_force(5, raid_gen5_avx2ext);
#else
raid_gen_force(5, raid_gen5_ssse3);
#endif
raid_recX_avx2(5, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -773,12 +797,12 @@ void speed(void)
printf("\n");
printf("%8s", "rec6");
printf("%8s", raid_recX_tag());
printf("%8s", raid_rec_tag(RAID_ALGO_CAUCHY_PAR6));
fflush(stdout);
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_int8(6, id, ip, nd, size, v);
raid_gen_force(6, raid_gen6_int8);
raid_recX_int8(6, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -788,8 +812,12 @@ void speed(void)
#ifdef CONFIG_SSSE3
if (raid_cpu_has_ssse3()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_ssse3(6, id, ip, nd, size, v);
#ifdef CONFIG_X86_64
raid_gen_force(6, raid_gen6_ssse3ext);
#else
raid_gen_force(6, raid_gen6_ssse3);
#endif
raid_recX_ssse3(6, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
@ -798,8 +826,12 @@ void speed(void)
#ifdef CONFIG_AVX2
if (raid_cpu_has_avx2()) {
SPEED_START {
for (j = 0; j < nd; ++j)
raid_recX_avx2(6, id, ip, nd, size, v);
#ifdef CONFIG_X86_64
raid_gen_force(6, raid_gen6_avx2ext);
#else
raid_gen_force(6, raid_gen6_ssse3);
#endif
raid_recX_avx2(6, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);