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

Implement LLVM x86 SSE4.2 intrinsics #3622

Merged
merged 2 commits into from
Jun 13, 2024
Merged

Implement LLVM x86 SSE4.2 intrinsics #3622

merged 2 commits into from
Jun 13, 2024

Conversation

TDecking
Copy link
Contributor

SSE4.2 is arguably the least important SIMD extension for the x86 ISA, but it should still be supported for the sake of completeness.

@TDecking TDecking force-pushed the sse4_2 branch 2 times, most recently from 1563021 to 6ee977c Compare May 20, 2024 00:51
@RalfJung
Copy link
Member

@eduardosm you've done all the other x86 intrinsics -- can you help review this one? That would be great. :)
(No pressure, and no rush either.)

@RalfJung
Copy link
Member

RalfJung commented May 20, 2024

@TDecking
Thanks for the PR!

I see you've done a whole lot of back-and-forth with CI. Is running tests locally not working for you? We have instructions for that here. If that does not work, please describe your problem on Zulip; having to wait for CI adds a lot of friction so we should figure out how to get it all running on your machine.

Copy link
Contributor

@eduardosm eduardosm left a comment

Choose a reason for hiding this comment

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

Thanks! I never had the nerve to implement SSE4.2 string manipulation intrinsics.

I believe this is still work-in-progress, so I left some comments that I hope you find useful to get things working :)

src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
@TDecking
Copy link
Contributor Author

@eduardosm Thanks for your input. The implementation is fixed and ready.

src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
@TDecking
Copy link
Contributor Author

@eduardosm Ready.

@TDecking
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label May 25, 2024
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!

I can't really review the actual implementations here, as I don't have any clue what they are even trying to implement. 😂 I think in general that's fine, since we have tests -- but to make future maintenance possible here, I ask you to please add a lot more comments. There's a bunch of concepts that are just assumed to be known here, which you have to explain -- like how a string is passed to these functions, or what the difference is between "implicit" and "explicit" (or what these terms even mean).

Also, how good is the test coverage? If someone added a random bug in the middle of one of your functions, would the tests catch that? If not, then it'd be great if you could add more tests, so that when we have to adjust this code in the future (e.g. for Miri API changes) we don't accidentally break it.

src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
tests/pass/shims/x86/intrinsics-x86-sse42.rs Show resolved Hide resolved
tests/pass/shims/x86/intrinsics-x86-sse42.rs Show resolved Hide resolved
@RalfJung
Copy link
Member

@eduardosm thanks a lot for your help with the initial review here! 💛

@RalfJung
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels May 27, 2024
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
@TDecking TDecking force-pushed the sse4_2 branch 2 times, most recently from b4c1bcd to cae6ebe Compare May 30, 2024 08:39
@TDecking
Copy link
Contributor Author

@rustbot ready.

@RalfJung I've added some additional test cases, which should cover every possible code path now.
I've also improved the documentation, but I'm not certain wether it is sufficient. To what extent may I assume that a maintainer
will google the intrinsics when performing a major refactor?

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels May 31, 2024
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, this helped! It does create new questions though. :)

I've also improved the documentation, but I'm not certain wether it is sufficient. To what extent may I assume that a maintainer
will google the intrinsics when performing a major refactor?

Ideally searching the web won't be needed as the code contains URLs where decent documentation can be found.

src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
@RalfJung
Copy link
Member

RalfJung commented Jun 8, 2024

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels Jun 8, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 8, 2024
…rrors

add missing Scalar::from_i128

We seem to have `from` methods for all primitive types except `i128`... let's complete the set of methods. (This came up in rust-lang/miri#3622.)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jun 8, 2024
Rollup merge of rust-lang#126157 - RalfJung:scalar-i128, r=compiler-errors

add missing Scalar::from_i128

We seem to have `from` methods for all primitive types except `i128`... let's complete the set of methods. (This came up in rust-lang/miri#3622.)
src/shims/x86/sse42.rs Show resolved Hide resolved
src/shims/x86/sse42.rs Show resolved Hide resolved
src/shims/x86/sse42.rs Show resolved Hide resolved
src/shims/x86/sse42.rs Outdated Show resolved Hide resolved
@TDecking
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels Jun 13, 2024
@RalfJung
Copy link
Member

I think this is good to go... I can't actually check whether all these intrinsics behave the way they should, but I guess people will complain if they see wrong results. ;)

Please squash the commits.

@TDecking
Copy link
Contributor Author

@RalfJung done.

@RalfJung
Copy link
Member

Thanks a lot for the PR and for staying with us through all the rounds of review! :-)

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 13, 2024

📌 Commit 562b724 has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jun 13, 2024

⌛ Testing commit 562b724 with merge 54d7471...

@bors
Copy link
Collaborator

bors commented Jun 13, 2024

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 54d7471 to master...

@bors bors merged commit 54d7471 into rust-lang:master Jun 13, 2024
8 checks passed
@TDecking TDecking deleted the sse4_2 branch June 13, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Waiting for a review to complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants