From 78fcd6e58b419fe5f39994def526e8e390bd3fef Mon Sep 17 00:00:00 2001 From: Faye Gao Date: Tue, 28 Mar 2023 08:32:46 +0000 Subject: [PATCH 1/2] 8305055: IR check fails on some aarch64 platforms As @eme64 said in [1], JDK-8298935 introduced some "collateral damage", disabling the vectorization of some conversions when `+AlignVector`. That affects IR checks of TestVectorizeTypeConversion.java and ArrayTypeConvertTest.java on some aarch64 platforms like ThunderX and ThunderX2 [2]. This trivial patch is to allow IR check only when we have "-AlignVector". [1] https://github.com/openjdk/jdk/pull/12350#issuecomment-1470065706 [2] https://github.com/openjdk/jdk/blob/7239150f8aff0e3dc07c5b27f6b7fb07237bfc55/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp#L154 --- .../compiler/c2/irTests/TestVectorizeTypeConversion.java | 7 +++++-- .../vectorization/runner/ArrayTypeConvertTest.java | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorizeTypeConversion.java b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorizeTypeConversion.java index c8a09e4aad8c6..27300f144f703 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorizeTypeConversion.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorizeTypeConversion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Arm Limited. All rights reserved. + * Copyright (c) 2022, 2023, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,7 +57,10 @@ public static void main(String[] args) { @Test @IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_CAST_I2X, ">0", - IRNode.STORE_VECTOR, ">0"}) + IRNode.STORE_VECTOR, ">0"}, + // JDK-8298935 disabled the vectorization of some + // conversions when `+AlignVector`. + applyIf = {"AlignVector", "false"}) private static void testConvI2D(double[] d, int[] a) { for(int i = 0; i < d.length; i++) { d[i] = (double) (a[i]); diff --git a/test/hotspot/jtreg/compiler/vectorization/runner/ArrayTypeConvertTest.java b/test/hotspot/jtreg/compiler/vectorization/runner/ArrayTypeConvertTest.java index b729fa8f9985c..98dd5e7ff2cd9 100644 --- a/test/hotspot/jtreg/compiler/vectorization/runner/ArrayTypeConvertTest.java +++ b/test/hotspot/jtreg/compiler/vectorization/runner/ArrayTypeConvertTest.java @@ -143,6 +143,9 @@ public float[] convertIntToFloat() { @Test @IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"}, + // JDK-8298935 disabled the vectorization of some + // conversions when `+AlignVector`. + applyIf = {"AlignVector", "false"}, counts = {IRNode.VECTOR_CAST_I2X, ">0"}) public double[] convertIntToDouble() { double[] res = new double[SIZE]; @@ -230,6 +233,9 @@ public int[] convertFloatToInt() { @Test @IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512dq", "true"}, + // JDK-8298935 disabled the vectorization of some + // conversions when `+AlignVector`. + applyIf = {"AlignVector", "false"}, counts = {IRNode.VECTOR_CAST_F2X, ">0"}) public long[] convertFloatToLong() { long[] res = new long[SIZE]; @@ -311,6 +317,9 @@ public char[] convertDoubleToChar() { // ---------------- Convert Between F & D ---------------- @Test @IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"}, + // JDK-8298935 disabled the vectorization of some + // conversions when `+AlignVector`. + applyIf = {"AlignVector", "false"}, counts = {IRNode.VECTOR_CAST_F2X, ">0"}) public double[] convertFloatToDouble() { double[] res = new double[SIZE]; From 04f8b11629bdbb516c621f48b91920ebc9b42e8d Mon Sep 17 00:00:00 2001 From: Fei Gao Date: Thu, 30 Mar 2023 08:37:20 +0000 Subject: [PATCH 2/2] Update comments --- .../c2/irTests/TestVectorizeTypeConversion.java | 4 ++-- .../vectorization/runner/ArrayTypeConvertTest.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorizeTypeConversion.java b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorizeTypeConversion.java index 27300f144f703..9255bf4aeeef6 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestVectorizeTypeConversion.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestVectorizeTypeConversion.java @@ -58,8 +58,8 @@ public static void main(String[] args) { @IR(counts = {IRNode.LOAD_VECTOR, ">0", IRNode.VECTOR_CAST_I2X, ">0", IRNode.STORE_VECTOR, ">0"}, - // JDK-8298935 disabled the vectorization of some - // conversions when `+AlignVector`. + // The vectorization of some conversions may fail when `+AlignVector`. + // We can remove the condition after JDK-8303827. applyIf = {"AlignVector", "false"}) private static void testConvI2D(double[] d, int[] a) { for(int i = 0; i < d.length; i++) { diff --git a/test/hotspot/jtreg/compiler/vectorization/runner/ArrayTypeConvertTest.java b/test/hotspot/jtreg/compiler/vectorization/runner/ArrayTypeConvertTest.java index 98dd5e7ff2cd9..f7f3dc3943141 100644 --- a/test/hotspot/jtreg/compiler/vectorization/runner/ArrayTypeConvertTest.java +++ b/test/hotspot/jtreg/compiler/vectorization/runner/ArrayTypeConvertTest.java @@ -143,8 +143,8 @@ public float[] convertIntToFloat() { @Test @IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"}, - // JDK-8298935 disabled the vectorization of some - // conversions when `+AlignVector`. + // The vectorization of some conversions may fail when `+AlignVector`. + // We can remove the condition after JDK-8303827. applyIf = {"AlignVector", "false"}, counts = {IRNode.VECTOR_CAST_I2X, ">0"}) public double[] convertIntToDouble() { @@ -233,8 +233,8 @@ public int[] convertFloatToInt() { @Test @IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512dq", "true"}, - // JDK-8298935 disabled the vectorization of some - // conversions when `+AlignVector`. + // The vectorization of some conversions may fail when `+AlignVector`. + // We can remove the condition after JDK-8303827. applyIf = {"AlignVector", "false"}, counts = {IRNode.VECTOR_CAST_F2X, ">0"}) public long[] convertFloatToLong() { @@ -317,8 +317,8 @@ public char[] convertDoubleToChar() { // ---------------- Convert Between F & D ---------------- @Test @IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"}, - // JDK-8298935 disabled the vectorization of some - // conversions when `+AlignVector`. + // The vectorization of some conversions may fail when `+AlignVector`. + // We can remove the condition after JDK-8303827. applyIf = {"AlignVector", "false"}, counts = {IRNode.VECTOR_CAST_F2X, ">0"}) public double[] convertFloatToDouble() {