RFR: 8325991: Accelerate Poly1305 on x86_64 using AVX2 instructions [v10]

Jatin Bhateja jbhateja at openjdk.org
Fri Mar 1 08:23:54 UTC 2024


On Tue, 27 Feb 2024 21:13:07 GMT, Srinivas Vamsi Parasa <duke at openjdk.org> wrote:

>> The goal of this PR is to accelerate the Poly1305 algorithm using AVX2 instructions (including IFMA) for x86_64 CPUs.
>> 
>> This implementation is directly based on the AVX2 Poly1305 hash computation as implemented in Intel(R) Multi-Buffer Crypto for IPsec Library (url: https://github.com/intel/intel-ipsec-mb/blob/main/lib/avx2_t3/poly_fma_avx2.asm)
>> 
>> This PR shows upto 19x speedup on buffer sizes of 1MB.
>
> Srinivas Vamsi Parasa has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update description of Poly1305 algo

Hi @vamsi-parasa , apart from above assertion check modifications, patch looks good to me.

src/hotspot/cpu/x86/assembler_x86.cpp line 5148:

> 5146:   assert(vector_len == AVX_512bit ? VM_Version::supports_avx512ifma() : VM_Version::supports_avxifma(), "");
> 5147:   InstructionMark im(this);
> 5148:   InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);

uses_vl should be false here.

src/hotspot/cpu/x86/assembler_x86.cpp line 5157:

> 5155: void Assembler::vpmadd52luq(XMMRegister dst, XMMRegister src1, XMMRegister src2, int vector_len) {
> 5156:   assert(vector_len == AVX_512bit ? VM_Version::supports_avx512ifma() : VM_Version::supports_avxifma(), "");
> 5157:   InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);

uses_vl should be false.

src/hotspot/cpu/x86/assembler_x86.cpp line 5183:

> 5181:   assert(vector_len == AVX_512bit ? VM_Version::supports_avx512ifma() : VM_Version::supports_avxifma(), "");
> 5182:   InstructionMark im(this);
> 5183:   InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true);

uses_vl should be false.

-------------

Changes requested by jbhateja (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17881#pullrequestreview-1910555763
PR Review Comment: https://git.openjdk.org/jdk/pull/17881#discussion_r1508637115
PR Review Comment: https://git.openjdk.org/jdk/pull/17881#discussion_r1508637945
PR Review Comment: https://git.openjdk.org/jdk/pull/17881#discussion_r1508638146


More information about the hotspot-compiler-dev mailing list