use of jdk.vm.ci.amd64.AMD64.CPUFeature in project graal by oracle.
the class SubstrateGraalUtils method updateGraalArchitectureWithHostCPUFeatures.
/**
* Updates the architecture in Graal at run-time in order to enable best code generation on the
* given machine.
*
* Note: this method is not synchronized as it only introduces new features to the enum map
* which is backed by an array. If two threads repeat the work nothing can go wrong.
*
* @param graalBackend The graal backend that should be updated.
*/
public static void updateGraalArchitectureWithHostCPUFeatures(Backend graalBackend) {
if (SubstrateUtil.HOSTED) {
throw shouldNotReachHere("Architecture should be updated only at runtime.");
}
if (!architectureInitialized) {
architectureInitialized = true;
AMD64CPUFeatureAccess.verifyHostSupportsArchitecture(graalBackend.getCodeCache().getTarget().arch);
AMD64 architecture = (AMD64) graalBackend.getCodeCache().getTarget().arch;
EnumSet<AMD64.CPUFeature> features = AMD64CPUFeatureAccess.determineHostCPUFeatures();
architecture.getFeatures().addAll(features);
}
}
use of jdk.vm.ci.amd64.AMD64.CPUFeature in project graal by oracle.
the class NativeImageGenerator method createTarget.
public static TargetDescription createTarget(Platform platform) {
if (includedIn(platform, Platform.AMD64.class)) {
Architecture architecture;
if (NativeImageOptions.NativeArchitecture.getValue()) {
architecture = GraalAccess.getOriginalTarget().arch;
} else {
EnumSet<AMD64.CPUFeature> features = EnumSet.noneOf(AMD64.CPUFeature.class);
// SSE and SSE2 are added by defaults as they are required by Graal
features.add(AMD64.CPUFeature.SSE);
features.add(AMD64.CPUFeature.SSE2);
features.addAll(parseCSVtoEnum(AMD64.CPUFeature.class, NativeImageOptions.CPUFeatures.getValue()));
architecture = new AMD64(features, SubstrateTargetDescription.allFlags());
}
assert architecture instanceof AMD64 : "SVM supports only AMD64 architectures.";
return new SubstrateTargetDescription(architecture, true, 16, 0, false);
} else {
throw UserError.abort("Architecture specified by platform is not supported: " + platform.getClass().getTypeName());
}
}
use of jdk.vm.ci.amd64.AMD64.CPUFeature in project graal by oracle.
the class AMD64CPUFeatureAccess method verifyHostSupportsArchitecture.
public static void verifyHostSupportsArchitecture(Architecture imageArchitecture) {
AMD64 architecture = (AMD64) imageArchitecture;
EnumSet<AMD64.CPUFeature> features = determineHostCPUFeatures();
if (!features.containsAll(architecture.getFeatures())) {
List<AMD64.CPUFeature> missingFeatures = new ArrayList<>();
for (AMD64.CPUFeature feature : architecture.getFeatures()) {
if (!features.contains(feature)) {
missingFeatures.add(feature);
}
}
throw VMError.shouldNotReachHere("Current target does not support the following CPU features that are required by the image: " + missingFeatures);
}
}
use of jdk.vm.ci.amd64.AMD64.CPUFeature in project graal by oracle.
the class AMD64ArrayCompareToOp method supportsAVX512VLBW.
private static boolean supportsAVX512VLBW(TargetDescription target) {
AMD64 arch = (AMD64) target.arch;
EnumSet<CPUFeature> features = arch.getFeatures();
return features.contains(CPUFeature.AVX512BW) && features.contains(CPUFeature.AVX512VL);
}
Aggregations