Skip to content

Conversation

@sayantn
Copy link
Contributor

@sayantn sayantn commented Oct 9, 2025

successor to #146568, this refactors some implementations and ports the implementation of simd_fma and simd_relaxed_fmato rustc_const_eval

Also adds some remaining f16/f128 support in these intrinsics

r? @RalfJung

@rustbot
Copy link
Collaborator

rustbot commented Oct 9, 2025

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

@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 Oct 9, 2025
@sayantn
Copy link
Contributor Author

sayantn commented Oct 9, 2025

In a similar fashion to #146568, I have not made the signatures const. If this gets merged quickly enough, I will just add these to #147521, otherwise new PR it is

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

Thanks! Here are some first comments.

All of the new intrinsics Miri supports with this will also need Miri tests.

View changes since this review

@RalfJung
Copy link
Member

RalfJung commented Oct 9, 2025

successor to #146568, this refactors some implementations and implements the following SIMD intrinsics in const-eval

Please update the PR description: This doesn't actually add anything in const-eval, it adds it to the interpreter and then only exposes this in Miri.

@sayantn sayantn changed the title Implement the remaining SIMD intrinsics in const-eval Port the remaining SIMD intrinsics to const-eval Oct 9, 2025
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

Thanks!
Still missing tests for the new f16/f128 support.

View changes since this review

@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 Oct 10, 2025
@sayantn
Copy link
Contributor Author

sayantn commented Oct 10, 2025

Do we really need f16/f128 tests? It's painful to add them because portable_simd doesn't implement SimdElement for f16 and f128, so we have to roll our own repr_simd types

@RalfJung
Copy link
Member

RalfJung commented Oct 10, 2025

Why do we add f16/f128 support if portable_simd can't even use it?

tests/pass/intrinsics/portable-simd.rs already declares two custom repr(simd) types. That only takes a few lines of code. Declaring two more shouldn't be so bad. We only need smoke tests, but I'd rather not have entirely dead codepaths here.

@sayantn
Copy link
Contributor Author

sayantn commented Oct 10, 2025

I am adding them mostly for completeness sake, but stdarch will need simd_fma with f16.

Declaring two more shouldn't be so bad.

Ok I will add 👍

@sayantn
Copy link
Contributor Author

sayantn commented Oct 10, 2025

@rustbot ready

added tests for f16 and f128 (just copied f32 and f64 tests)

@rustbot rustbot 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 Oct 10, 2025
#[rustc_nounwind]
pub unsafe fn simd_shuffle_const_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;

pub fn simd_ops_f16() {
Copy link
Member

Choose a reason for hiding this comment

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

Your new functions aren't actually being called, but you made them pub which suppresses the warning...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh sorry, my mistake

Copy link
Member

Choose a reason for hiding this comment

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

Please remove all these pub. I think we have enough evidence to consider them dangerous. :)

@RalfJung
Copy link
Member

@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 11, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 11, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 11, 2025
@bors
Copy link
Collaborator

bors commented Oct 13, 2025

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

@rustbot
Copy link
Collaborator

rustbot commented Oct 26, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@sayantn
Copy link
Contributor Author

sayantn commented Oct 26, 2025

@rustbot ready

Sorry for the delay @RalfJung. Made sure the tests were actually being called. Had to remove simd_fsqrt tests for f16 and f128, as they are Miri-only and currently unimplemented for f16 and f128

@rustbot rustbot 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 Oct 26, 2025
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

@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 Nov 2, 2025
@RalfJung
Copy link
Member

RalfJung commented Nov 3, 2025

Thanks!
@bors r+

@bors
Copy link
Collaborator

bors commented Nov 3, 2025

📌 Commit 0681bae has been approved by RalfJung

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 3, 2025
bors added a commit that referenced this pull request Nov 3, 2025
Rollup of 8 pull requests

Successful merges:

 - #135099 (Add FileCheck annotations to mir-opt/copy-prop)
 - #145903 (Give correct suggestion for a typo in raw pointers)
 - #147520 (Port the remaining SIMD intrinsics to const-eval)
 - #148068 (rustdoc: Use configured target modifiers when collecting doctests)
 - #148099 (Prepare to move debugger discovery from compiletest to bootstrap)
 - #148268 (rustdoc: fix `--emit=dep-info` on scraped examples)
 - #148306 (Remove double check when decoding ExpnId to avoid races)
 - #148378 (Fix documentation for std::panic::update_hook)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c8625a5 into rust-lang:master Nov 3, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 3, 2025
rust-timer added a commit that referenced this pull request Nov 3, 2025
Rollup merge of #147520 - sayantn:simd-const-eval, r=RalfJung

Port the remaining SIMD intrinsics to const-eval

successor to #146568, this refactors some implementations and ports the implementation of `simd_fma` and `simd_relaxed_fma`to `rustc_const_eval`

Also adds some remaining f16/f128 support in these intrinsics

r? `@RalfJung`
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 4, 2025
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#135099 (Add FileCheck annotations to mir-opt/copy-prop)
 - rust-lang/rust#145903 (Give correct suggestion for a typo in raw pointers)
 - rust-lang/rust#147520 (Port the remaining SIMD intrinsics to const-eval)
 - rust-lang/rust#148068 (rustdoc: Use configured target modifiers when collecting doctests)
 - rust-lang/rust#148099 (Prepare to move debugger discovery from compiletest to bootstrap)
 - rust-lang/rust#148268 (rustdoc: fix `--emit=dep-info` on scraped examples)
 - rust-lang/rust#148306 (Remove double check when decoding ExpnId to avoid races)
 - rust-lang/rust#148378 (Fix documentation for std::panic::update_hook)

r? `@ghost`
`@rustbot` modify labels: rollup
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.

5 participants