Skip to content

Commit

Permalink
8290066: Remove KNL specific handling for new CPU target check in IR …
Browse files Browse the repository at this point in the history
…annotation

Reviewed-by: kvn, sviswanathan
  • Loading branch information
Jatin Bhateja committed Jul 16, 2022
1 parent 0143cf1 commit 2342684
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 39 deletions.
2 changes: 0 additions & 2 deletions src/hotspot/cpu/x86/vm_version_x86.cpp
Expand Up @@ -938,8 +938,6 @@ void VM_Version::get_processor_features() {
_features &= ~CPU_HT;
}

// Note: Any modifications to following suppressed feature list for KNL target
// should also be applied to test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java
if (is_intel()) { // Intel cpus specific settings
if (is_knights_family()) {
_features &= ~CPU_VZEROUPPER;
Expand Down
Expand Up @@ -280,30 +280,7 @@ private boolean checkCPUFeature(String feature, String value) {
return false;
}
String cpuFeatures = WHITE_BOX.getCPUFeatures();
// Following feature list is in sync with suppressed feature list for KNL target.
// Please refer vm_version_x86.cpp for details.
HashSet<String> knlFeatureSet = new HashSet<>();
knlFeatureSet.add("AVX512BW");
knlFeatureSet.add("AVX512VL");
knlFeatureSet.add("AVX512DQ");
knlFeatureSet.add("AVX512_VNNI");
knlFeatureSet.add("AVX512_VAES");
knlFeatureSet.add("AVX512_VPOPCNTDQ");
knlFeatureSet.add("AVX512_VPCLMULQDQ");
knlFeatureSet.add("AVX512_VBMI");
knlFeatureSet.add("AVX512_VBMI2");
knlFeatureSet.add("CLWB");
knlFeatureSet.add("FLUSHOPT");
knlFeatureSet.add("GFNI");
knlFeatureSet.add("AVX512_BITALG");
Boolean isKNLFlagEnabled = WHITE_BOX.getBooleanVMFlag("UseKNLSetting");
// Perform the feature check if UseKNLSetting flag is set to off or if
// feature is supported by KNL target.
if (isKNLFlagEnabled == null ||
(isKNLFlagEnabled && (!knlFeatureSet.contains(feature.toUpperCase()) || falseValue))) {
return (trueValue && cpuFeatures.contains(feature)) || (falseValue && !cpuFeatures.contains(feature));
}
return false;
return (trueValue && cpuFeatures.contains(feature)) || (falseValue && !cpuFeatures.contains(feature));
}

private boolean hasNoRequiredFlags(String[] orRules, String ruleType) {
Expand Down
Expand Up @@ -21,7 +21,7 @@
* questions.
*/

package compiler.vectorapi;
package ir_framework.tests;

import compiler.lib.ir_framework.*;
import compiler.lib.ir_framework.driver.irmatching.IRViolationException;
Expand All @@ -32,33 +32,31 @@
* @requires vm.cpu.features ~= ".*avx512f.*"
* @requires os.arch=="amd64" | os.arch=="x86_64"
* @library /test/lib /
* @run driver compiler.vectorapi.TestCPUFeatureCheck
* @run driver ir_framework.tests.TestCPUFeatureCheck
*/

public class TestCPUFeatureCheck {
private static int a[] = new int[1000];
private static int b[] = new int[1000];
private static int res[] = new int[1000];
private static final int SIZE = 1000;
private static int a[] = new int[SIZE];
private static int b[] = new int[SIZE];
private static int res[] = new int[SIZE];

public static void setup() {
for (int i = 0; i < 1000; i++) {
for (int i = 0; i < SIZE; i++) {
a[i] = i;
b[i] = i;
}
}

public static void main(String args[]) {
setup();
TestFramework.runWithFlags("-XX:-TieredCompilation",
"-XX:UseAVX=3",
"-XX:+UseKNLSetting",
"-XX:CompileThresholdScaling=0.3");
TestFramework.runWithFlags("-XX:+UseKNLSetting");
}

@Test
@IR(counts = {IRNode.ADD_VI, "> 0"}, applyIfCPUFeature = {"avx512bw", "false"})
public static void test1() {
for (int i = 0; i < 1000; i++) {
for (int i = 0; i < SIZE; i++) {
res[i] = a[i] + b[i];
}
}
Expand All @@ -67,7 +65,7 @@ public static void test1() {
@Test
@IR(counts = {IRNode.ADD_VI, "> 0"}, applyIfCPUFeatureAnd = {"avx512bw", "false", "avx512f", "true"})
public static void test2() {
for (int i = 0; i < 1000; i++) {
for (int i = 0; i < SIZE; i++) {
res[i] = a[i] + b[i];
}
}
Expand All @@ -76,7 +74,7 @@ public static void test2() {
@Test
@IR(counts = {IRNode.ADD_VI, "> 0"}, applyIfCPUFeatureOr = {"avx512bw", "true", "avx512f", "true"})
public static void test3() {
for (int i = 0; i < 1000; i++) {
for (int i = 0; i < SIZE; i++) {
res[i] = a[i] + b[i];
}
}
Expand Down

0 comments on commit 2342684

Please sign in to comment.