Queries on AVX512 support in Hotspot

Tobias Hartmann tobias.hartmann at oracle.com
Fri Nov 26 10:45:13 UTC 2021


Hi Rahul,

On 22.11.21 09:49, Rahul wrote:
> Request help with questions on AVX512 support in Hotspot.
> Please note I am trying to find existing AVX512 support in hotspot.

Answers to below questions really depend on what you mean by "AVX512 support". I assume you mean
support for AVX512 instructions in C2's (vector) optimizations? Or do you specifically mean the
Vector API (https://openjdk.java.net/jeps/417)?

> Understood that the support started with JDK-8076276 enhancement.
> When compared with instruction set manuals it seems full AVX512
> instructions are not supported for now.
> (e.g.: AVX512_IFMA, AVX512_BF16 set instructions etc. seems not supported
> Also though feature CPU_AVX512F, AVX512PF etc. feature set is enabled,
> again it seems all instructions in the set may not be supported.)

Right, C2 optimizations only require/support a subset of all the AVX512 instructions but that's the
same for SSE and other vector instruction sets. It's because C2's superword optimization only
supports vectorizing some operations and we therefore only need the corresponding vector instructions.

Vector instructions are also used at other places. For example, for arraycopy or for zeroing (see
https://bugs.openjdk.java.net/browse/JDK-8251871).

> So is the existing support added so far documented somewhere?

I don't think there is any documentation other than the code and the JBS entries:
https://bugs.openjdk.java.net/issues/?jql=component%20%3D%20hotspot%20and%20type%20in%20(Enhancement)%20and%20(text%20~%20AVX512%20or%20text%20~%20%22AVX-512%22%20or%20text%20~%20%22AVX%20512%22)

You could also include bugs:
https://bugs.openjdk.java.net/issues/?jql=component%20%3D%20hotspot%20and%20type%20in%20(Enhancement%2C%20bug)%20and%20(text%20~%20AVX512%20or%20text%20~%20%22AVX-512%22%20or%20text%20~%20%22AVX%20512%22)

> Also any details of any ongoing, future plans to add remaining AVX-512
> support?

Again, you could look at above JBS issues that are still unresolved.

> Aslo trying to check available jtreg tests, benchmarks related to AVX-512.
> Is the main related tests located at -
> test/hotspot/jtreg/compiler/loopopts/superword/ ?
> (Also found
> test/hotspot/jtreg/compiler/loopopts/superword/TestArrayCopyConjoint.java,
> TestArrayCopyDisjoint.java tests)

Yes, these are the tests for C2's superword optimization that vectorizes loops and makes use of AVX
instructions when possible. But there are other tests that exercise this (for example, all the
arraycopy tests).

We also have many microbenchmarks that exercise vector instructions. For example,
test/micro/org/openjdk/bench/java/lang/ArrayCopyObject.java.

> Are there any other functional or unit tests to check exact AVX
> instructions generated.

I don't think we have any tests that check that/which vector instructions are emitted.

> For example, to catch situations like AVX2 instructions getting wrongly
> generated instead of available/expected AVX3 instructions !?.
> Request guidance with existing AVX-512 support tests, benchmarks.

Hope that helps. The Intel folks might be able to add more details.

Best regards,
Tobias


More information about the hotspot-compiler-dev mailing list