RFR: 8309130: x86_64 AVX512 intrinsics for Arrays.sort methods (int, long, float and double arrays) [v42]
himichael
duke at openjdk.org
Sun Oct 15 07:43:53 UTC 2023
On Sat, 14 Oct 2023 03:21:52 GMT, himichael <duke at openjdk.org> wrote:
>>> my question is that this feature should improve performance several times, but it doesn't look like there's much difference between open jdk 22.19 and jdk 8. is there a problem with my configuration ?
>>
>> Hello @himichael,
>>
>> Using your code snippet, please see the output below using the latest JDK and JDK 20 (which does not have AVX512 sort):
>>
>> JDK 20 (without AVX512 sort):
>> `java -XX:CompileCommand=CompileThresholdScaling,java.util.DualPivotQuicksort::sort,0.0001 -XX:-TieredCompilation JDKSort `
>>
>> elapse time -> **7501 ms**
>>
>> ------------------------------
>> JDK 22 (with AVX512 sort)
>> `java -XX:CompileCommand=CompileThresholdScaling,java.util.DualPivotQuicksort::sort,0.0001 -XX:-TieredCompilation JDKSort`
>> elapse time -> **1607 ms**
>>
>> It shows 4.66x speedup.
>
>> > my question is that this feature should improve performance several times, but it doesn't look like there's much difference between open jdk 22.19 and jdk 8. is there a problem with my configuration ?
>>
>> Hello @himichael,
>>
>> Using your code snippet, please see the output below using the latest JDK and JDK 20 (which does not have AVX512 sort):
>>
>> JDK 20 (without AVX512 sort): `java -XX:CompileCommand=CompileThresholdScaling,java.util.DualPivotQuicksort::sort,0.0001 -XX:-TieredCompilation JDKSort `
>>
>> elapse time -> **7501 ms**
>>
>> JDK 22 (with AVX512 sort) `java -XX:CompileCommand=CompileThresholdScaling,java.util.DualPivotQuicksort::sort,0.0001 -XX:-TieredCompilation JDKSort` elapse time -> **1607 ms**
>>
>> It shows 4.66x speedup.
>
> Hello, @vamsi-parasa
> I used the commands you provided, but nothing seems to have changed.
> The test procedure as follow:
> use JDK 8(without AVX512 sort)
>
> /data/soft/jdk1.8.0_371/bin/javac JDKSort.java
> /data/soft/jdk1.8.0_371/bin/java JDKSort
>
> elapse time -> **15309 ms**
>
> use OpenJDK 22.19(with AVX512 sort)
>
> /data/soft/jdk-22/bin/javac JDKSort.java
> /data/soft/jdk-22/bin/java -XX:CompileCommand=CompileThresholdScaling,java.util.DualPivotQuicksort::sort,0.0001 -XX:-TieredCompilation JDKSort
> CompileCommand: CompileThresholdScaling java/util/DualPivotQuicksort.sort double CompileThresholdScaling = 0.000100
>
> elapse time -> **11687 ms**
>
> Not much seems to have changed.
>
> My JDK info:
> OpenJDK 22.19:
>
> /data/soft/jdk-22/bin/java -version
> openjdk version "22-ea" 2024-03-19
> OpenJDK Runtime Environment (build 22-ea+19-1460)
> OpenJDK 64-Bit Server VM (build 22-ea+19-1460, mixed mode, sharing)
>
>
> JDK 8:
>
> /data/soft/jdk1.8.0_371/bin/java -version
> java version "1.8.0_371"
> Java(TM) SE Runtime Environment (build 1.8.0_371-b11)
> Java HotSpot(TM) 64-Bit Server VM (build 25.371-b11, mixed mode)
>
>
>
> I tested Intel's **x86-simd-sort**, my code as follow:
> ```c++
> #include <iostream>
> #include <vector>
> #include <algorithm>
> #include <chrono>
> #include "src/avx512-32bit-qsort.hpp"
>
> int main() {
>
> // 100 million records
> const int size = 100000000;
> std::vector<int> random_array(size);
>
> for (int i = 0; i < size; ++i) {
> random_array[i] = rand();
> }
>
> auto start_time = std::chrono::steady_clock::now();
>
> avx512_qsort(random_array.data(), size);
>
> auto end_time = std::chrono::steady_clock::now();
> auto elapse_time = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time)....
> @himichael , could you check if the libsimdsort.so is being loaded by running the command below? `java -Xlog:library --version | grep libsimdsort`
>
> Here is my output: [0.021s][info][library] Loaded library **libsimdsort.so**, handle 0x00007fa3c801ad80
Hello, @vamsi-parasa,
I see why, I run command ```/data/soft/jdk-22/bin/java -Xlog:library -version```
results as follows:
[0.071s][info][library] Loaded library libjsvml.so, handle 0x00007f3a5c0223e0
openjdk version "22-ea" 2024-03-19
OpenJDK Runtime Environment (build 22-ea+19-1460)
OpenJDK 64-Bit Server VM (build 22-ea+19-1460, mixed mode, sharing)
There is no information about ```libsimdsort.so```
run ```/data/soft/jdk-22/bin/java -Xlog:library``` the results as follows:
[0.044s][info][library] Loaded library libjsvml.so, handle 0x00007f00b40223e0
[0.067s][info][library] Failed to find JNI_OnLoad_nio in library with handle 0x00007f016a4f6150
[0.068s][info][library] Loaded library /data/soft/jdk-22/lib/libnio.so, handle 0x00007f0160196da0
[0.068s][info][library] Found JNI_OnLoad in library with handle 0x00007f0160196da0
[0.069s][info][library] Found Java_sun_nio_fs_UnixNativeDispatcher_init in library with handle 0x00007f0160196da0
[0.069s][info][library] Found Java_sun_nio_fs_UnixNativeDispatcher_getcwd in library with handle 0x00007f0160196da0
[0.069s][info][library] Failed to find JNI_OnLoad_jimage in library with handle 0x00007f016a4f6150
[0.069s][info][library] Loaded library /data/soft/jdk-22/lib/libjimage.so, handle 0x00007f0160005450
[0.069s][info][library] Failed to find JNI_OnLoad in library with handle 0x00007f0160005450
[0.069s][info][library] Failed to find Java_jdk_internal_jimage_NativeImageBuffer_getNativeMap in library with handle 0x00007f0160196da0
[0.069s][info][library] Found Java_jdk_internal_jimage_NativeImageBuffer_getNativeMap in library with handle 0x00007f0160005450
It shows some bad failures, but it doesn't seem to have anything to do with libsimdsort.
I am not using a physical machine, I am using a virtual machine, this virtual machine supports the AVX512 instruction set.
How do I open libsimdsort ?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14227#issuecomment-1763307754
More information about the hotspot-compiler-dev
mailing list