Skip to content

Commit 69fd1f5

Browse files
committed
[GR-51349] Let getMaxLaneCount() report zero for now.
PullRequest: graal/16584
2 parents c14c392 + 9c21634 commit 69fd1f5

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_vm_vector_VectorSupport.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@
2727
import com.oracle.svm.core.annotate.Delete;
2828
import com.oracle.svm.core.annotate.Substitute;
2929
import com.oracle.svm.core.annotate.TargetClass;
30-
import com.oracle.svm.core.util.VMError;
3130

3231
@TargetClass(className = "jdk.internal.vm.vector.VectorSupport")
3332
public final class Target_jdk_internal_vm_vector_VectorSupport {
@@ -37,6 +36,10 @@ public final class Target_jdk_internal_vm_vector_VectorSupport {
3736
@SuppressWarnings("unused")
3837
@Substitute
3938
public static int getMaxLaneCount(Class<?> etype) {
40-
throw VMError.unsupportedFeature("VectorSupport.getMaxLaneCount not supported.");
39+
/*
40+
* GR-51303: The Vector API is not yet optimized by the Graal compiler. But instead of
41+
* letting applications fail, always return a max lane count of zero for now.
42+
*/
43+
return 0;
4144
}
4245
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporterFeature.java

+10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.oracle.svm.hosted.util.CPUTypeAMD64;
4646
import com.oracle.svm.hosted.util.CPUTypeRISCV64;
4747
import com.oracle.svm.util.LogUtils;
48+
import com.oracle.svm.util.ReflectionUtil;
4849

4950
@AutomaticallyRegisteredFeature
5051
public class ProgressReporterFeature implements InternalFeature {
@@ -62,6 +63,15 @@ public void duringAnalysis(DuringAnalysisAccess access) {
6263
reporter.reportStageProgress();
6364
}
6465

66+
@Override
67+
public void afterAnalysis(AfterAnalysisAccess access) {
68+
var vectorSpeciesClass = ReflectionUtil.lookupClass(true, "jdk.incubator.vector.VectorSpecies");
69+
if (vectorSpeciesClass != null && access.isReachable(vectorSpeciesClass)) {
70+
LogUtils.warning(
71+
"This application uses a preview of the Vector API, which is functional but slow on Native Image because it is not yet optimized by the Graal compiler. Please keep this in mind when evaluating performance.");
72+
}
73+
}
74+
6575
@Override
6676
public void afterCompilation(AfterCompilationAccess access) {
6777
if (SubstrateOptions.BuildOutputBreakdowns.getValue()) {

0 commit comments

Comments
 (0)