summaryrefslogtreecommitdiff
path: root/runtime/arch/instruction_set_features.h
diff options
context:
space:
mode:
author xueliang.zhong <xueliang.zhong@linaro.org> 2018-11-06 11:42:41 +0000
committer Evgeny Astigeevich <evgeny.astigeevich@linaro.org> 2019-01-30 14:09:25 +0000
commit7f88c1a269754001bfcaf311b378cf1cc71acf84 (patch)
tree147bb988929e8bd8827c4b148f28da4c28c0ea70 /runtime/arch/instruction_set_features.h
parent5247113f3277fd679e3e1beeb6fbfb30797aa481 (diff)
ART: Enable ISA features run-time detection for ARM64
On a target run-time detected ISA features can be more accurate than instruction set features based on a build-time information such as an instruction set variant or C++ defines. Build-time based features can be too generic and do not include all features a target CPU supports. This CL enables instruction feature run-time detection in the JIT/AOT compilers: - The value "runtime" to the option "--instruction-set-features" to try to detect CPU features at run time. If a target does not support run-time detection it has the same effect as the value "default". - Runtime uses "--instruction-set-features=runtime" if run-time detection is supported. The CL also cleans up how an instruction set feature string is processed by InstructionSetFeatures::AddFeaturesFromString. It used to make redundant uses of Trim in subclasses. The calls are replaced with DCHECKs verifying that feature names are already trimmed. Test: m test-art-target-gtest Test: m test-art-host-gtest Test: art/test.py --target --optimizing --interpreter --jit Test: art/test.py --host --optimizing --interpreter --jit Test: Pixel 3 UI booted Change-Id: I223d5bc968d589dba5c09f6b03ee8c25987610b0
Diffstat (limited to 'runtime/arch/instruction_set_features.h')
-rw-r--r--runtime/arch/instruction_set_features.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/arch/instruction_set_features.h b/runtime/arch/instruction_set_features.h
index f910a4183d..9222a7bad7 100644
--- a/runtime/arch/instruction_set_features.h
+++ b/runtime/arch/instruction_set_features.h
@@ -48,6 +48,20 @@ class InstructionSetFeatures {
// Turn C pre-processor #defines into the equivalent instruction set features for kRuntimeISA.
static std::unique_ptr<const InstructionSetFeatures> FromCppDefines();
+ // Check if run-time detection of instruction set features is supported.
+ //
+ // Return: true - if run-time detection is supported on a target device.
+ // false - otherwise
+ static bool IsRuntimeDetectionSupported() {
+ return FromRuntimeDetection() != nullptr;
+ }
+
+ // Use run-time detection to get instruction set features.
+ //
+ // Return: a set of detected features or nullptr if runtime detection is not
+ // supported on a target.
+ static std::unique_ptr<const InstructionSetFeatures> FromRuntimeDetection();
+
// Process /proc/cpuinfo and use kRuntimeISA to produce InstructionSetFeatures.
static std::unique_ptr<const InstructionSetFeatures> FromCpuInfo();
@@ -126,6 +140,10 @@ class InstructionSetFeatures {
AddFeaturesFromSplitString(const std::vector<std::string>& features,
std::string* error_msg) const = 0;
+ // Add run-time detected architecture specific features in sub-classes.
+ virtual std::unique_ptr<const InstructionSetFeatures>
+ AddRuntimeDetectedFeatures(const InstructionSetFeatures *features ATTRIBUTE_UNUSED) const;
+
private:
DISALLOW_COPY_AND_ASSIGN(InstructionSetFeatures);
};