Conversation
|
Hi @OH195-C. I was looking for the question about why there is no p=4,5,6 implementation for AVX2_gfni, as you are implementing it, but I cannot find it... |
|
Hi @pablodelara. I closed the issue #419, because this commit fixes it. (I will be using the OH195-C account for all future communication.)
During implementation, some YMM and general-purpose registers were reused to address register pressure. As demonstrated above, AVX2+GFNI (+1~+6) consistently outperforms AVX2. Crucially, it introduces no data read amplification, maintaining consistency with other SIMD implementations. The performance results for ec_encode_data_update_single_src_simple_warm are shown below: |
|
Hi @pablodelara, I noticed that some CI checks are failing. I reviewed the error logs, which is strange because I haven't modified any of the affected files. Could you advise on how to resolve this? |
Can you rebase on top of latest master? |
Done. I've rebased onto the latest master. |
|
Hi @pablodelara, could you please re-run the run_tests_linux-riscv64-v job? This looks like a self-hosted runner issue — the build process was killed by an external signal with no compilation errors, and all other 8 CI jobs passed. |
|
Hi @pablodelara , sorry to bother you. Could you please help review this patch when you have some time? Thanks! |
|
Hi @OH195-C. I am definitely seeing an improvement on k+4, but not much on k+5 or k+6 (I am even seeing some degradation). You are testing on 8331C, which supports AVX512. I tested on 6780E, which is E-core with AVX2 support, as this code path is the one that will be used on that CPU. |
Hi @pablodelara Could you share the block size you used? The k+5/k+6 behavior is quite size-dependent, and the degradation you saw is expected in the small-block range.(For clarity: AVX2_GFNI(+1~+3) refers to the current implementation, and AVX2_GFNI(+1~+6) refers to the new one in this PR.) Both AVX2_GFNI(+1~+3) and AVX2_GFNI(+1~+6) outperform AVX2, thanks to the GFNI instructions — so the comparison here is really between the two GFNI-based paths, not against an AVX2 baseline. For k+4, AVX2_GFNI(+1~+6) keeps the same 64-byte loop stride as AVX2_GFNI(+1~+3), and the implementation avoids reading the source twice, so there's no read amplification — it's a clear win. |
I used 32KB blocks (I benchmarked with -s 32K -k 10 -p 4/5/6). |
The 32 KB result is consistent with my earlier tests. The design motivation here: the current AVX2_GFNI(+1~+3) path reads source data twice for k+4 ~ k+6, introducing read amplification. The goal is to leverage GFNI instructions for speedup while not incurring other performance overhead, such as memory bandwidth amplification — and this patch eliminates that extra read. Would appreciate a code review when you get a chance. @pablodelara |
|
Apologies for the long time to respond. Could you modify the sign-off with real name, please? |
1) add 4~6 vector AVX2 dot product with GFNI implementation
2) add AVX2 6vect mad with GFNI implementation
3) ensuring encoding process not modify the input mul_array pointer
Complete the implementations of ec_encode_data_avx2_gfni and
ec_encode_data_update_avx2_gfni to support parity blocks k+1 through
k+6, consistent with the implementations for other instruction sets
(AVX512, AVX2, etc.). This avoids reading source data twice when
computing parities k+4 to k+6, preventing memory bandwidth
amplification.
Signed-off-by: chenliang <cl304641@alibaba-inc.com>
@pablodelara Done, updated the sign-off with my real name. |
|
This is now merged, thanks! |
Thank you for the review and merge! Looking forward to contributing more. |



Erasure Code:
1) add 4~6 vector AVX2 dot product with GFNI implementation
2) add AVX2 6vect mad with GFNI implementation
3) ensuring encoding process not modify the input mul_array pointer
Complete the implementations of ec_encode_data_avx2_gfni and ec_encode_data_update_avx2_gfni to support parity blocks k+1 through k+6, consistent with the implementations for other instruction sets (AVX512, AVX2, etc.). This avoids reading source data twice when computing parities k+4 to k+6, preventing memory bandwidth amplification.