Skip to content
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

Merged
merged 4 commits into from
May 23, 2023
Merged

Conversation

JamieCunliffe
Copy link
Contributor

In #91608 the fp feature was removed for AArch64 and folded into the neon feature, however disabling the neon feature doesn't actually disable the fp 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 enable neon, however, when disabling sve it would then also disable neon, I wouldn't expect disabling sve to also disable neon.

cc @workingjubilee

@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2023

r? @oli-obk

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 25, 2023
@oli-obk
Copy link
Contributor

oli-obk commented Jan 25, 2023

r? @Amanieu since you reviewed the other PR, too

@rustbot rustbot assigned Amanieu and unassigned oli-obk Jan 25, 2023
@rust-log-analyzer

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]> {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

@Amanieu Amanieu Feb 3, 2023

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]>,
}

@apiraino
Copy link
Contributor

apiraino commented Mar 1, 2023

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 ready, thanks!

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 1, 2023
@Dylan-DPC
Copy link
Member

@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.
@Dylan-DPC Dylan-DPC added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 22, 2023
@Amanieu
Copy link
Member

Amanieu commented May 23, 2023

@bors r+

@bors
Copy link
Contributor

bors commented May 23, 2023

📌 Commit 04efd0da1cfb438c5cb41b6d3637e719416faf0f has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 23, 2023
@JamieCunliffe
Copy link
Contributor Author

@Amanieu I'm not sure if it needs to be approved again, but I updated it to resolve the merge conflicts.

@Amanieu
Copy link
Member

Amanieu commented May 23, 2023

@bors r+

@bors
Copy link
Contributor

bors commented May 23, 2023

📌 Commit a059e68 has been approved by Amanieu

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented May 23, 2023

⌛ Testing commit a059e68 with merge 52dd1cd...

@bors
Copy link
Contributor

bors commented May 23, 2023

☀️ Test successful - checks-actions
Approved by: Amanieu
Pushing 52dd1cd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 23, 2023
@bors bors merged commit 52dd1cd into rust-lang:master May 23, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 23, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (52dd1cd): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
-4.8% [-4.8%, -4.8%] 1
Improvements ✅
(secondary)
-1.1% [-1.1%, -1.1%] 1
All ❌✅ (primary) -4.8% [-4.8%, -4.8%] 1

Cycles

Results

This 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.

mean range count
Regressions ❌
(primary)
1.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.1% [1.1%, 1.1%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 646.753s -> 646.927s (0.03%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants