Add support for AVX2 GFNI

This commit is contained in:
Andrea Mazzoleni 2026-05-27 20:01:40 +02:00
parent 994c208315
commit c4f9869f98
9 changed files with 1074 additions and 28 deletions

View file

@ -101,7 +101,6 @@ sdecovtest:
# Use this target to run a complete test on Ice Lake simulator
sde:
$(SDE) -icl -- ./selftest
$(SDE) -clx -- ./speedtest
$(SDE) -icl -- ./speedtest
$(SDE) -icl -- ./fulltest

View file

@ -39,6 +39,12 @@ int main(void)
printf("Including x86 AVX2\n");
if (raid_cpu_has_avx512bw())
printf("Including x86 AVX512BW\n");
if (raid_cpu_has_avx2gfni())
#ifdef USE_RAID_AES
printf("Including x86 AVX2GFNI\n");
#else
printf("Excluding x86 AVX2GFNI due polynomial mismatch\n");
#endif
if (raid_cpu_has_avx512gfni())
#ifdef USE_RAID_AES
printf("Including x86 AVX512GFNI\n");
@ -73,18 +79,13 @@ int main(void)
/* LCOV_EXCL_STOP */
}
printf("Test Cauchy parity generation with %u data disks...\n", RAID_DATA_MAX);
if (raid_test_par(RAID_MODE_CAUCHY, RAID_DATA_MAX, TEST_SIZE) != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
printf("Test Cauchy parity generation with 1 data disk...\n");
if (raid_test_par(RAID_MODE_CAUCHY, 1, TEST_SIZE) != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
printf("Test Cauchy parity generation with 1-%u data disks...\n", RAID_DATA_MAX);
for (int i = 1; i <= RAID_DATA_MAX; ++i) {
if (raid_test_par(RAID_MODE_CAUCHY, i, TEST_SIZE) != 0) {
/* LCOV_EXCL_START */
goto bail;
/* LCOV_EXCL_STOP */
}
}
printf("Test Cauchy recovering with all combinations of %u data and 6 parity blocks...\n", TEST_COUNT);

View file

@ -137,9 +137,16 @@ void speed(void)
printf("%8s", "avx2");
#ifdef CONFIG_X86_64
printf("%8s", "avx2e");
#ifdef CONFIG_AVX512BW
printf("%8s", "avx512");
#endif
#ifdef CONFIG_AVX2GFNI
printf("%8s", "gfni");
#endif
#ifdef CONFIG_AVX512GFNI
printf("%8s", "gfni512");
#endif
#endif
#endif
printf("\n");
@ -278,6 +285,16 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen2_avx2gfni(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -423,6 +440,16 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen3_avx2gfni(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -508,6 +535,16 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen4_avx2gfni(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -593,6 +630,16 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen5_avx2gfni(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -678,6 +725,16 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen6_avx2gfni(nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -702,9 +759,16 @@ void speed(void)
printf("%8s", "ssse3");
printf("%8s", "avx2");
#ifdef CONFIG_X86_64
#ifdef CONFIG_AVX512BW
printf("%8s", "avx512");
#endif
#ifdef CONFIG_AVX2GFNI
printf("%8s", "gfni");
#endif
#ifdef CONFIG_AVX512GFNI
printf("%8s", "gfni512");
#endif
#endif
#endif
printf("\n");
@ -759,6 +823,18 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen_force(1, raid_gen1_avx2);
/* +1 to avoid GEN1 optimized case */
raid_rec1_avx2gfni(1, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -828,6 +904,18 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen_force(2, raid_gen2_avx2gfni);
/* +1 to avoid GEN2 optimized case */
raid_rec2_avx2gfni(2, id, ip + 1, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -893,6 +981,17 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen_force(3, raid_gen3_avx2gfni);
raid_recX_avx2gfni(3, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -961,6 +1060,17 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen_force(4, raid_gen4_avx2gfni);
raid_recX_avx2gfni(4, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -1029,6 +1139,17 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen_force(5, raid_gen5_avx2gfni);
raid_recX_avx2gfni(5, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -1097,6 +1218,17 @@ void speed(void)
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX2GFNI
if (raid_cpu_has_avx2gfni()) {
SPEED_START {
raid_gen_force(6, raid_gen6_avx2gfni);
raid_recX_avx2gfni(6, id, ip, nd, size, v);
} SPEED_STOP
printf("%8" PRIu64, ds / dt);
fflush(stdout);
}
#endif
#ifdef CONFIG_AVX512GFNI
if (raid_cpu_has_avx512gfni()) {
SPEED_START {
@ -1130,6 +1262,12 @@ int main(void)
printf("Including x86 AVX2\n");
if (raid_cpu_has_avx512bw())
printf("Including x86 AVX512BW\n");
if (raid_cpu_has_avx2gfni())
#ifdef USE_RAID_AES
printf("Including x86 AVX2GFNI\n");
#else
printf("Including x86 AVX2GFNI (Performance reference only. Polynomial mismatch prevents use)\n");
#endif
if (raid_cpu_has_avx512gfni())
#ifdef USE_RAID_AES
printf("Including x86 AVX512GFNI\n");