Skip to content

Added support for apxf target feature #139534

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

madhav-madhusoodanan
Copy link
Contributor

@madhav-madhusoodanan madhav-madhusoodanan commented Apr 8, 2025

Context

  1. Added the apxf target feature, which is dependent upon the LLVM features egpr, push2pop2, ppx, ndd, ccmp, nf, cf and zu.
  2. Converted dependencies of LLVMFeature from an Option to a SmallVec to support multiple dependencies.

Associated Issue

cc: @sayantn

@rustbot
Copy link
Collaborator

rustbot commented Apr 8, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Apr 8, 2025
@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from 970fb61 to 336c5f9 Compare April 8, 2025 15:40
@madhav-madhusoodanan madhav-madhusoodanan marked this pull request as ready for review April 8, 2025 15:41
@madhav-madhusoodanan madhav-madhusoodanan marked this pull request as draft April 8, 2025 15:43
@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from 336c5f9 to 282deb3 Compare April 8, 2025 16:56
@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from 282deb3 to d7bc563 Compare April 8, 2025 17:20
@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from d7bc563 to b3e9d21 Compare April 8, 2025 17:38
@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from b3e9d21 to c0626b5 Compare April 8, 2025 17:48
@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from c0626b5 to 994c752 Compare April 8, 2025 17:59
@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from 994c752 to eaf714b Compare April 8, 2025 18:29
@rust-log-analyzer

This comment has been minimized.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from eaf714b to 6c4b6dc Compare April 8, 2025 18:55
@madhav-madhusoodanan madhav-madhusoodanan marked this pull request as ready for review April 8, 2025 19:54
@madhav-madhusoodanan
Copy link
Contributor Author

I would be grateful if a perf-run could be initiated for this PR.

I think I do not have sufficient privileges for initiating it.

Copy link
Contributor

@sayantn sayantn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do run ./x check tidy before you push, it ensures that CI won't fail right away due to tidy checks

@SparrowLii
Copy link
Member

Sry I'm not familar with llvm so
r? codegen

@madhav-madhusoodanan
Copy link
Contributor Author

Have updated dependencies from a SmallVec<[_, 10]> to a SmallVec<[_, 1]>.

@rust-log-analyzer

This comment has been minimized.

@sayantn
Copy link
Contributor

sayantn commented Apr 21, 2025

You also have to add apxf to tests/ui/check-cfg/target_feature.stderr

@sayantn
Copy link
Contributor

sayantn commented Apr 23, 2025

@chorman0773 should inline-asm-use-gpr32 be added here? Or are we completely going to reg_ext for gpr32?

@chorman0773
Copy link
Contributor

No, leave it off. There are enough instructions that you can't necessarily use an egpr.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from b260411 to 9d85006 Compare April 23, 2025 07:42
@madhav-madhusoodanan
Copy link
Contributor Author

No, leave it off. There are enough instructions that you can't necessarily use an egpr.

Just to clarify, llvm_utils by default wraps the target string into an LLVMFeature, so I'm guessing we wouldn't explicitly need to add inline-asm-use-gpr32 right? (incase a developer needs to use the feature, that is)

@sayantn
Copy link
Contributor

sayantn commented Apr 23, 2025

iiuc, the reason apxf should not imply inline-asm-use-gpr32 is that the new r16-31 registers don't support evex or vex encoded instructions, only rex2 encoding. So they can't be used as regular registers. If inline-asm-use-gpr32 is enabled, llvm might assign a egpr in a reg class, which will generate invalid asm. Target features should not create unsoundess (although they have the potential to do so 😆). There are llvm constraints that we can use to allow users to use gpr32 without activating the i-a-u-g32 tag, so this is not a loss. @chorman0773 is working on a new reg class that will do exactly this, so no need for i-a-u-g32 here

@workingjubilee
Copy link
Member

cool, this looks reasonable, have to doublecheck if I need to check about target features with someone first before approving this, I think

@madhav-madhusoodanan
Copy link
Contributor Author

cool, this looks reasonable, have to doublecheck if I need to check about target features with someone first before approving this, I think

Got it 😊

@bors
Copy link
Collaborator

bors commented May 4, 2025

☔ The latest upstream changes (presumably #140633) made this pull request unmergeable. Please resolve the merge conflicts.

@workingjubilee
Copy link
Member

Ah found the documentation again, and I do not need to consult anyone for this feature. Yay. Rebase? and I'll get it this time.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from 3ac1f53 to f59bcee Compare May 6, 2025 02:20
@rustbot
Copy link
Collaborator

rustbot commented May 6, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@madhav-madhusoodanan
Copy link
Contributor Author

Just rebased this branch and I noticed a bunch of changes to Cargo.lock.
Would it be a concern?

@sayantn
Copy link
Contributor

sayantn commented May 6, 2025

Cargo.lock shouldn't have been modified, might just be a mistake from git. You probably have to revert it

@workingjubilee
Copy link
Member

There should not need to be any Cargo.lock changes as part of this PR.

@madhav-madhusoodanan madhav-madhusoodanan force-pushed the apx-target-feature-addition branch from f59bcee to c32dc2d Compare May 6, 2025 18:10
@workingjubilee
Copy link
Member

Thank you! Should be good to go.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 6, 2025

📌 Commit c32dc2d has been approved by workingjubilee

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 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

10 participants