-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix some issues with folded AArch64 features #107294
Conversation
r? @oli-obk (rustbot has picked a reviewer for you, use r? to override) |
r? @Amanieu since you reviewed the other PR, too |
This comment has been minimized.
This comment has been minimized.
@@ -149,6 +149,9 @@ pub fn time_trace_profiler_finish(file_name: &Path) { | |||
// Though note that Rust can also be build with an external precompiled version of LLVM | |||
// which might lead to failures if the oldest tested / supported LLVM version | |||
// doesn't yet support the relevant intrinsics | |||
// | |||
// Note: The first feature in the list that is returned is the mapping to the feature that is | |||
// provided from the `s` parameter. | |||
pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> { |
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.
I think it's a mistake to make this function do too much. Could the logic for implied/tied features be moved to a separate function and handled separately?
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.
Yeah, I agree with that and was thinking the same while making the change. This was already handling the implied features before this change, so I just added neon
and fp-armv8
to it to fix that issue. The fact it's used in multiple places is why I created a different function for if they should be disabled together.
It was done this way to fix those bugs, however, long term I think this should be a graph structure to correctly show the relationships between the different features.
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.
Perhaps it would be clearer to make this function return a struct instead:
struct LlvmFeatures<'a> {
/// Features that should be enabled/disabled.
features: SmallVec<[&'a str; 2]>,
/// Features that are implicitly enabled when the feature is enabled.
dependencies: SmallVec<[&'a str; 2]>,
}
If I read correctly the last comment, this can be switched to waiting on author to incorporate changes. Feel free to request a review with @rustbot author |
@JamieCunliffe any updates on this? |
In rust-lang#91608 the fp-armv8 feature was removed as it's tied to the neon feature. However disabling neon didn't actually disable the use of floating point registers and instructions, for this `-fp-armv8` is required.
Some features that are tied together only make sense to be folded together when enabling the feature. For example on AArch64 sve and neon are tied together, however it doesn't make sense to disable neon when disabling sve.
Rather than returning an array of features from to_llvm_features, return a structure that contains the dependencies. This also contains metadata on how the features depend on each other to allow for the correct enabling and disabling.
@bors r+ |
📌 Commit 04efd0da1cfb438c5cb41b6d3637e719416faf0f has been approved by It is now in the queue for this repository. |
@Amanieu I'm not sure if it needs to be approved again, but I updated it to resolve the merge conflicts. |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (52dd1cd): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 646.753s -> 646.927s (0.03%) |
In #91608 the
fp
feature was removed for AArch64 and folded into theneon
feature, however disabling theneon
feature doesn't actually disable thefp
feature. If my understanding on that thread is correct it should do.While doing this, I also noticed that disabling some features would disable features that it shouldn't. For instance enabling
sve
will enableneon
, however, when disablingsve
it would then also disableneon
, I wouldn't expect disablingsve
to also disableneon
.cc @workingjubilee