Partially stabilize LoongArch target features by heiher · Pull Request #135015 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

This file contains hidden or 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

[ Show hidden characters]({{ revealButtonHref }})

heiher

Stabilization PR for the LoongArch target features. This PR stabilizes some of the target features tracked by #44839.

Specifically, this PR stabilizes the following target features:

Docs PR: rust-lang/reference#1707

r? @Amanieu

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

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Jan 2, 2025

@rustbot

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

@rust-log-analyzer

This comment has been minimized.

@RalfJung

If "d" and "f" work anything like the RISC-V features of the same name, they should not be stabilized yet. We need to figure out #116344 and #131799 for LoongArch first.

Does any of the other features ever have any effect on calling conventions or ABI?

@heiher

If "d" and "f" work anything like the RISC-V features of the same name, they should not be stabilized yet. We need to figure out #116344 and #131799 for LoongArch first.

Does any of the other features ever have any effect on calling conventions or ABI?

Thank you! Other than f and d, there are no other target features affecting the calling convention and ABI.

@heiher heiher changed the titleStabilize LoongArch target features Partially stabilize LoongArch target features

Jan 2, 2025

@ehuss

Amanieu

Comment on lines 773 to 774

("relax", STABLE, &[]),
("ual", STABLE, &[]),

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Also to be clear, ual can only affect how unaligned accesses are codegen'd, and nothing else. See this recent discussion on Zulip.

If we have target feature docs somewhere, they should clarify hat unaligned accesses are still UB except when performed via {read,write}_unaligned.

Choose a reason for hiding this comment

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

I agree with skipping these two target features and stabilizing them at a more appropriate time.

@Amanieu

@rustbot rustbot added the T-lang

Relevant to the language team, which will review and decide on the PR/issue.

label

Jan 2, 2025

@heiher

@bors

@bors

@rfcbot

@tmandry

@traviscross

@rfcbot concern what-about-d-and-f

In #135015 (comment), @RalfJung raised a concern:

If "d" and "f" work anything like the RISC-V features of the same name, they should not be stabilized yet. We need to figure out #116344 and #131799 for LoongArch first.

Does any of the other features ever have any effect on calling conventions or ABI?

Let's figure out the answer to that.

@RalfJung

Ah I think the point is, there are now ABI checks set up for this, so the target features should be safe.

I hope they are, I don't have any experience with this target. The target is extremely similar to RISC-V though, and RISC-V has a lot more eyes on it and more people have experience in it, so it may make sense to stabilize "f" and "d" there first if we are confident about this. @Amanieu do you know if there are any blockers for that?

@RalfJung

Also, @heiher given that 4 of the features on the original list have subtle ABI questions, could you double checks that all the other features are harmless in that regard?

@traviscross traviscross added I-lang-radar

Items that are on lang's radar and will need eventual work or consideration.

and removed I-lang-nominated

Nominated for discussion during a lang team meeting.

I-lang-easy-decision

Issue: The decision needed by the team is conjectured to be easy; this does not imply nomination

labels

Apr 16, 2025

@Amanieu Amanieu added the relnotes

Marks issues that should be documented in the release notes of the next release.

label

Apr 16, 2025

@heiher

Also, @heiher given that 4 of the features on the original list have subtle ABI questions, could you double checks that all the other features are harmless in that regard?

f and d already have ABI compatibility checks in place. For lsx, 128-bit vectors are always passed through general-purpose registers, while for lasx, 256-bit vectors are always passed on the stack — so all four features are ABI-safe. The other features don’t affect the ABI and are harmless in that regard. Thanks.

@nikomatsakis

@heiher

Has the Final Comment Period ended? If so, I request to merge it. Thanks!

@RalfJung

No, the bot will post when FCP has ended. So far, FCP has not even started.

Currently FCP is blocked on the concern registered by @traviscross here. I think that concern can be resolved since indeed the ABI check does account for "d" and "f" properly. I am a bit nervous since this is the first target feature where the ABI check becomes load-bearing on stable, but I guess that had to happen eventually. ;) It might be worth to double-check that we have good test coverage here. Can you edit tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs to use revisions: and also add a loongarch revision? (I know I was opposed to adding more tests in the past, but now that this moves to stable I am changing my mind. Also, adding a new revision as opposed to an entirely new test makes this much easier to maintain.) And we also need a test for the case of disabling a feature that should not be disabled; that could probably be a revision of tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs.

EDIT: I am adding tests in #140395.

@traviscross

If you're happy then I'm happy, and we can...

@rfcbot resolve what-about-d-and-f

@rfcbot

🔔 This is now entering its final comment period, as per the review above. 🔔

@RalfJung

@heiher are all the features being stabilized here supported by our minimal LLVM version (which is v19 I think)? We should probably not stabilize target features that some rustc builds cannot support.

@heiher

Zalathar added a commit to Zalathar/rust that referenced this pull request

Apr 29, 2025

@Zalathar

…etrochenkov

organize and extend forbidden target feature tests

In particular this adds some loongarch tests for rust-lang#135015, Cc @heiher

Seems like the tests change so much git does not detect the renames; a commit-by-commit review should help.

Zalathar added a commit to Zalathar/rust that referenced this pull request

Apr 30, 2025

@Zalathar

…etrochenkov

organize and extend forbidden target feature tests

In particular this adds some loongarch tests for rust-lang#135015, Cc @heiher

Seems like the tests change so much git does not detect the renames; a commit-by-commit review should help.

Zalathar added a commit to Zalathar/rust that referenced this pull request

Apr 30, 2025

@Zalathar

…etrochenkov

organize and extend forbidden target feature tests

In particular this adds some loongarch tests for rust-lang#135015, Cc @heiher

Seems like the tests change so much git does not detect the renames; a commit-by-commit review should help.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 30, 2025

@bors

organize and extend forbidden target feature tests

In particular this adds some loongarch tests for rust-lang#135015, Cc @heiher

Seems like the tests change so much git does not detect the renames; a commit-by-commit review should help.

try-job: x86_64-gnu-llvm-*

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 2, 2025

@bors

organize and extend forbidden target feature tests

In particular this adds some loongarch tests for rust-lang#135015, Cc @heiher

Seems like the tests change so much git does not detect the renames; a commit-by-commit review should help.

try-job: x86_64-gnu-llvm-20-*

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

May 3, 2025

@matthiaskrgr

…etrochenkov

organize and extend forbidden target feature tests

In particular this adds some loongarch tests for rust-lang#135015, Cc @heiher

Seems like the tests change so much git does not detect the renames; a commit-by-commit review should help.

try-job: x86_64-gnu-llvm-20-*

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

May 3, 2025

@rust-timer

Rollup merge of rust-lang#140395 - RalfJung:target-feature-tests, r=petrochenkov

organize and extend forbidden target feature tests

In particular this adds some loongarch tests for rust-lang#135015, Cc @heiher

Seems like the tests change so much git does not detect the renames; a commit-by-commit review should help.

try-job: x86_64-gnu-llvm-20-*

Labels

A-target-feature

Area: Enabling/disabling target features like AVX, Neon, etc.

disposition-merge

This issue / PR is in PFCP or FCP with a disposition to merge it.

final-comment-period

In the final comment period and will be merged soon unless new substantive objections are raised.

I-lang-radar

Items that are on lang's radar and will need eventual work or consideration.

O-loongarch

Target: LoongArch (LA32R, LA32S, LA64)

relnotes

Marks issues that should be documented in the release notes of the next release.

S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-lang

Relevant to the language team, which will review and decide on the PR/issue.