RFR: 8309130: x86_64 AVX512 intrinsics for Arrays.sort methods (int, long, float and double arrays) [v14]
Srinivas Vamsi Parasa
duke at openjdk.org
Tue Aug 15 20:04:20 UTC 2023
On Tue, 15 Aug 2023 19:23:24 GMT, iaroslavski <duke at openjdk.org> wrote:
>>> @vamsi-parasa We need to preserve NaNs. The base (https://github.com/intel/x86-simd-sort) algorithm used doesn't preserve NaNs.
>>
>> Thanks for catching this Sandhya! This is fixed now in the most recent commit. A preprocessing step is added to move the NaNs to the top of the array.
>
> Hello @vamsi-parasa !
>
> Do you process negative zeros properly? From one hand -0.0f equals to 0.0f, but negative zeros must be placed before 0.0f.
> See javadoc for Arrays.sort(float[] a). The same situation with -0.0d (double type).
@iaroslavski
Hello Vladimir,
Thank you for your comments and suggestions!
Please see the answers below:
1) A single method is being used for int/float/long/double currently and is being intrinsified. This helps to handle the call to the AVX512 sort stub in a unified manner without duplication of the code.
2) The long offset is being used during compilation and passing arguments to the AVX512 sort stub. It's true that it's not being used on the Java side. This is along the lines of vectorizedMismatch for MemorySegment. In future, having this API will make it easier to enable sort for memory segments especially those backed by native heap.
3) Thank you for suggesting about parallelSort ! So far, this optimization for intended for the serial sort. Will spend some time to analyze the changes needed to support parallelSort and will provide an update.
4) True, it would be helpful to have one unified benchmark. Will run the benchmark and provide the performance numbers for AVX512 sort and the Arrays.sort()
5) Sure, will also run the above benchmark and do a performance comaparison of AVX512 sort with enhanced DPQS (radix sort) as well.
Thank you,
Vamsi
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14227#issuecomment-1679526230
More information about the hotspot-compiler-dev
mailing list