Re: [PATCH v3] lib/raid/xor: x86: Add AVX-512 optimized xor_gen()
Eric Biggers <[email protected]>
| Newsgroups | gmane.linux.kernel.cryptoapi,gmane.linux.kernel,gmane.linux.raid |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 17, 2026 at 07:56:53AM +0200, Christoph Hellwig wrote: > Can use the xor: prefix used for all other commits to lib/raid/xor? > > > Benchmark on AMD Ryzen 9 9950X (Zen 5): > > > > src_cnt avx avx512 Improvement > > ======= ========== ========== =========== > > 1 56353 MB/s 75388 MB/s 33% > > 2 54274 MB/s 68409 MB/s 26% > > 3 44649 MB/s 64042 MB/s 43% > > 4 41315 MB/s 55002 MB/s 33% > > On my Zen 5 mobile (AMD Ryzen AI 7 PRO 350) both the existing > AVX2 and this AVX512 code give numbers in the 200+ GB/s range. Not > sure if is just the different benchmarking or something else going on. I used lib/raid/xor/xor-core.c which measures the throughput of parity data generated, whereas your proposed xor_benchmark() in xor_kunit measures the throughput of source data consumed. I don't know which makes more sense, but we should make them consistent with each other. > FYI, one or 2 sources are basically useless as they RAID5 configs > that have no benefits over simple mirroring and thus the numbers > aren't too interesting. > > > +DO_XOR_BLOCKS(avx512_inner, xor_avx512_2, xor_avx512_3, xor_avx512_4, > > + xor_avx512_5); > > Is there really much of a benefit of doing the historic DO_XOR_BLOCKS > vs doing the loop manually? Especially as the common cases for a > modern RAID will usually loop over more disks than this was built > for. I.e., in practice one or two source buffers only happen at the > end of a loop over more disks. There's not really a way out of unrolling by source buffer count, as otherwise the pointers would continuously have to be reloaded into registers. That's why your proposal was so slow (see the numbers I gave in https://lore.kernel.org/linux-crypto/20260612055933.GA6675@sol/ ). It could be something different from 2-5 specifically, or open-coded instead of using the macro if that's all you're asking for, but at a high level the unrolling by source buffer count does seem to be needed. - Eric