On Mon, 9 Nov 2026 23:30:12 GMT, Sandhya Viswanathan <[email protected]>
wrote:
>> Volodymyr Paprotski has updated the pull request with a new target base due
>> to a merge or a rebase. The pull request now contains eight commits:
>>
>> - re-enable test
>> - Merge remote-tracking branch 'origin/master' into avx2-mlkem
>> - whitespace
>> - reduce fuzz test repetition
>> - Merge remote-tracking branch 'origin/master' into avx2-mlkem
>> - prepare for rebase
>> - comments from Anas
>> - avx2 mlkem drop
>
> src/hotspot/cpu/x86/stubGenerator_x86_64_kyber.cpp line 243:
>
>> 241: const XMMRegister* scratch1 = scratch == input1 ? output : scratch;
>> 242: const XMMRegister* scratch2 = scratch == input1 ? scratch : output;
>> 243: bool input2ScratchOverlap = input2[0] == scratch1[1];
>
> Is this input2ScratchOverlap check sufficient?
That comment and name were confusing/wrong.. renamed/redid things a bit
> src/hotspot/cpu/x86/stubGenerator_x86_64_kyber.cpp line 280:
>
>> 278: // NOTE: size 0 and 1 are used for final and initial shuffles
>> respectively of
>> 279: // kyberNtt and kyberInverseNtt. For size 0 and 1, input1[]
>> 280: // and input2[] are modified in-place (and output2 is used as a
>> temporary)
>
> For the AVX_256bit 16/32 path also input2 is modified in place.
done
> src/hotspot/cpu/x86/stubGenerator_x86_64_kyber.cpp line 354:
>
>> 352: break;
>> 353: case 0: // final unshuffle for kyberNtt
>> 354: // reverse case 1: all even are in input1 and odd in input2,
>> put back
>
> Need to say 32 bit quantities here.
> Why do we need different code for case 0 and case 1? For the 512-bit, case 0
> and case 1 have same code.
Matched the avx2 and 512 comments
(to clarify, avx512 code is provided with different shuffle tables, depending
if case0 or case1 is called)
for why the two cases.. they are the inverse operations: one
scrambles/interleaves, the other unscrambles/uninterleaves
> src/hotspot/cpu/x86/stubGenerator_x86_64_kyber.cpp line 421:
>
>> 419: break;
>> 420: // Special cases
>> 421: case 1: // initial shuffle for kyberInverseNtt
>
> case1 and 0 have same code, no need to duplicate.
hmm. you are right, its gets different unsuffle[12], but identical sequence. I
would rather keep the case numbers (to keep it consistent with the AVX2 case).
> src/hotspot/cpu/x86/stubGenerator_x86_64_kyber.cpp line 1201:
>
>> 1199: // condensed (byte[168]) = c_rarg0
>> 1200: // condensedOffs (int) = c_rarg1
>> 1201: // parsed (short[112]) = c_rarg2
>
> Should this be byte[192] and short[128]? The comment above
> MLKEM.twelve2Sixteen says so.
yeah, fixed. didnt look at the existing comment close enough, thanks
> src/hotspot/cpu/x86/stubGenerator_x86_64_kyber.cpp line 1483:
>
>> 1481: void StubGenerator::generate_kyber_stubs() {
>> 1482: int vector_len = Assembler::AVX_256bit;
>> 1483: if (VM_Version::supports_evex() && VM_Version::supports_avx512bw()) {
>
> Should this be VM_Version::supports_avx512vlbw()? The 12To16 stub at
> 1361–1366 uses AVX_256bit vector length.
done, missed it, thanks
> test/jdk/sun/security/provider/pqc/ML_KEM_Intrinsic_Test.java line 38:
>
>> 36: * @key randomness
>> 37: * @modules java.base/com.sun.crypto.provider:+open
>> 38: * @run main/othervm -XX:UseAVX=2 ML_KEM_Intrinsic_Test
>
> I think we should add AVX2 to the requires directive, as we are using
> UseAVX=2 on run command line:
> requires os.simpleArch == "x64" & vm.cpu.features ~= ".*avx2.*"
done
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/33444#discussion_r4591143726
PR Review Comment: https://git.openjdk.org/jdk/pull/33444#discussion_r4554152127
PR Review Comment: https://git.openjdk.org/jdk/pull/33444#discussion_r4591290751
PR Review Comment: https://git.openjdk.org/jdk/pull/33444#discussion_r4591197580
PR Review Comment: https://git.openjdk.org/jdk/pull/33444#discussion_r4554235797
PR Review Comment: https://git.openjdk.org/jdk/pull/33444#discussion_r4554095846
PR Review Comment: https://git.openjdk.org/jdk/pull/33444#discussion_r4553892770