-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ARMv8.x feature flags #4489
Merged
Merged
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
424af04
Add ARMv8.3a feature flag
steven-johnson 560fa94
Update CodeGen_ARM.cpp
steven-johnson a5f56a7
Update CodeGen_ARM.cpp
steven-johnson c0617cc
Merge branch 'master' into srj-armv83a
steven-johnson dcaa84b
Merge branch 'main' into srj-armv83a
steven-johnson 2d26d30
Update CodeGen_ARM.cpp
steven-johnson 1a5a4b4
Add Features for all the ARM v8.x architectures
steven-johnson cd8baf2
Update CodeGen_ARM.cpp
steven-johnson b55a27c
Fixes
steven-johnson 72e5ade
Merge branch 'main' into srj-armv83a
steven-johnson 93b6018
get_runtime_compatible_target() should use meet
steven-johnson 20aae96
Add ARMv8a
steven-johnson a4e0532
trigger buildbots
steven-johnson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,41 @@ using namespace llvm; | |
|
||
namespace { | ||
|
||
// Populate feature flags in a target according to those implied by | ||
// existing flags, so that instruction patterns can just check for the | ||
// oldest feature flag that supports an instruction. | ||
// | ||
// According to LLVM, ARM architectures have the following is-a-superset-of | ||
// relationships: | ||
// | ||
// v9.5a > v9.4a > v9.3a > v9.2a > v9.1a > v9a; | ||
// v v v v v | ||
// v8.9a > v8.8a > v8.7a > v8.6a > v8.5a > v8.4a > ... > v8a; | ||
// | ||
// v8r has no relation to anything. | ||
Target complete_arm_target(Target t) { | ||
constexpr int num_arm_v8_features = 9; | ||
static const Target::Feature arm_v8_features[num_arm_v8_features] = { | ||
Target::ARMv89a, | ||
Target::ARMv88a, | ||
Target::ARMv87a, | ||
Target::ARMv86a, | ||
Target::ARMv85a, | ||
Target::ARMv84a, | ||
Target::ARMv83a, | ||
Target::ARMv82a, | ||
Target::ARMv81a, | ||
}; | ||
|
||
for (int i = 0; i < num_arm_v8_features - 1; i++) { | ||
if (t.has_feature(arm_v8_features[i])) { | ||
t.set_feature(arm_v8_features[i + 1]); | ||
} | ||
} | ||
|
||
return t; | ||
} | ||
|
||
// Substitute in loads that feed into slicing shuffles, to help with vld2/3/4 | ||
// emission. These are commonly lifted as lets because they get used by multiple | ||
// interleaved slices of the same load. | ||
|
@@ -201,7 +236,7 @@ class CodeGen_ARM : public CodeGen_Posix { | |
}; | ||
|
||
CodeGen_ARM::CodeGen_ARM(const Target &target) | ||
: CodeGen_Posix(target) { | ||
: CodeGen_Posix(complete_arm_target(target)) { | ||
|
||
// TODO(https://github.com/halide/Halide/issues/8088): See if | ||
// use_llvm_vp_intrinsics can replace architecture specific code in this | ||
|
@@ -2445,9 +2480,9 @@ string CodeGen_ARM::mcpu_target() const { | |
} | ||
} else { | ||
if (target.os == Target::IOS) { | ||
return "cyclone"; | ||
return "apple-a7"; | ||
} else if (target.os == Target::OSX) { | ||
return "apple-a12"; | ||
return "apple-m1"; | ||
} else if (target.has_feature(Target::SVE2)) { | ||
return "cortex-x1"; | ||
} else { | ||
|
@@ -2468,6 +2503,30 @@ string CodeGen_ARM::mattrs() const { | |
if (target.has_feature(Target::ARMv81a)) { | ||
attrs.emplace_back("+v8.1a"); | ||
} | ||
if (target.has_feature(Target::ARMv82a)) { | ||
attrs.emplace_back("+v8.2a"); | ||
} | ||
if (target.has_feature(Target::ARMv83a)) { | ||
attrs.emplace_back("+v8.3a"); | ||
} | ||
if (target.has_feature(Target::ARMv84a)) { | ||
attrs.emplace_back("+v8.4a"); | ||
} | ||
if (target.has_feature(Target::ARMv85a)) { | ||
attrs.emplace_back("+v8.5a"); | ||
} | ||
if (target.has_feature(Target::ARMv86a)) { | ||
attrs.emplace_back("+v8.6a"); | ||
} | ||
if (target.has_feature(Target::ARMv87a)) { | ||
attrs.emplace_back("+v8.7a"); | ||
} | ||
if (target.has_feature(Target::ARMv88a)) { | ||
attrs.emplace_back("+v8.8a"); | ||
} | ||
if (target.has_feature(Target::ARMv89a)) { | ||
attrs.emplace_back("+v8.9a"); | ||
} | ||
if (target.has_feature(Target::ARMDotProd)) { | ||
attrs.emplace_back("+dotprod"); | ||
} | ||
|
@@ -2482,7 +2541,7 @@ string CodeGen_ARM::mattrs() const { | |
} | ||
} else { | ||
// TODO: Should Halide's SVE flags be 64-bit only? | ||
// TODO: Sound we ass "-neon" if NoNEON is set? Does this make any sense? | ||
// TODO: Sound we add "-neon" if NoNEON is set? Does this make any sense? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While you're here, Sound -> Should There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Sound we ass" FTW |
||
if (target.has_feature(Target::SVE2)) { | ||
attrs.emplace_back("+sve2"); | ||
} else if (target.has_feature(Target::SVE)) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
target
has been completed at this point, isn't this going to add attrs for everything requested and below? Is LLVM cool with that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, good question.