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

import simd_ intrinsics #137551

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

Conversation

folkertdev
Copy link
Contributor

@folkertdev folkertdev commented Feb 24, 2025

In most cases, we can import the simd intrinsics rather than redeclare them. Apparently, most of these tests were written before std::intrinsics::simd existed.

There are a couple of exceptions where we can't yet import:

  • the intrinsics are not declared as const fn in the standard library, causing issues in the const-eval tests
  • the simd_shuffle_generic function is not exposed from std::intrinsics
  • the simd_fpow and simd_fpowi functions are not exposed from std::intrinsics (removed in remove simd_fpow and simd_fpowi #137595)
  • some tests use no_core, and therefore cannot use std::intrinsics

r? @RalfJung

cc @workingjubilee do you have context on why some intrinsics are not exposed?

@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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Feb 24, 2025
@workingjubilee
Copy link
Member

there's a story behind simd_shuffle_generic

@workingjubilee
Copy link
Member

I'm not aware of one for the fpow and fpowi ones.

@RalfJung
Copy link
Member

RalfJung commented Feb 24, 2025

the intrinsics are not declared as const fn in the standard library, causing issues in the const-eval tests

Only simd_insert and simd_extract can be used in const-eval. You can make them const fn in this PR if you want, then they should be usable for those tests.

the simd_shuffle_generic function is not exposed from std::intrinsics

Yeah that needs some highly experimental type system features so we cannot use it in core/std.

the simd_fpow and simd_fpowi functions are not exposed from std::intrinsics

Oh that's odd, could you open an issue?

some tests use no_core, and therefore cannot use std::intrinsics

👍

@rust-log-analyzer

This comment has been minimized.

Comment on lines +11 to +12
mod types {
// signed integer types
Copy link
Member

Choose a reason for hiding this comment

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

Why did you do this unrelated refactor? Makes the review harder...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the goal of this is the rustfmt::skip, otherwise this reformats to 3X the lines

Copy link
Member

Choose a reason for hiding this comment

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

But why would you format this at all?

It's generally not good to do drive-by formatting of previously unformatted files as part of an unrelated PR. That just makes the review harder than it has to be.

@folkertdev
Copy link
Contributor Author

I've opened #137555 for the simd_fpow intrinsics. It really just looks like an oversight to me.

@bors
Copy link
Contributor

bors commented Feb 25, 2025

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

@RalfJung
Copy link
Member

Can you let me know when you rebased? (GH does not always send notifications for force-pushes.)

@RalfJung RalfJung 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 Feb 25, 2025
@folkertdev folkertdev force-pushed the import-simd-intrinsics branch from 4c19a70 to f48829b Compare February 25, 2025 09:31
@folkertdev
Copy link
Contributor Author

I've rebased (but not squashed yet, I'll do that at the very end)

Also, this PR will give merge conflicts with the simd_pow removal #137595

@bors
Copy link
Contributor

bors commented Feb 26, 2025

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

@folkertdev folkertdev force-pushed the import-simd-intrinsics branch 3 times, most recently from bae561b to 87b1189 Compare February 26, 2025 10:02
@folkertdev folkertdev marked this pull request as ready for review February 26, 2025 10:03
@folkertdev
Copy link
Contributor Author

I've rebased again, and undrafted because this should now not be blocked on anything

@rust-log-analyzer

This comment has been minimized.

@folkertdev
Copy link
Contributor Author

some mingw job failed with a connection error. Is there a way to restart that job besides closing/re-opening the PR?

@folkertdev folkertdev force-pushed the import-simd-intrinsics branch from 87b1189 to 038f4e2 Compare February 27, 2025 11:24
@rustbot
Copy link
Collaborator

rustbot commented Feb 27, 2025

Some changes occurred to the platform-builtins intrinsics. Make sure the
LLVM backend as well as portable-simd gets adapted for the changes.

cc @antoyo, @GuillaumeGomez, @bjorn3, @calebzulawski, @programmerjake

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @rust-lang/wg-const-eval

@RalfJung
Copy link
Member

I will approve this now since I like the cleanup. However, in the future, please respect the time of reviewers and do not perform any drive-by formatting changes.

@bors r+

@bors
Copy link
Contributor

bors commented Feb 27, 2025

📌 Commit 038f4e2 has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 27, 2025

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 27, 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants