-
Notifications
You must be signed in to change notification settings - Fork 14k
Implement SIMD funnel shifts in const-eval/Miri #147534
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow review, and thanks!
Please also add tests. All new code should always come with tests. :) Testing this in const-eval is enough since Miri uses the same implementation.
|
We can't test in const-eval yet right? This doesn't make the intrinsics |
|
Oh right, this has the impl in rustc but doesn't expose it yet as that is blocked or more extensive testing... yeah a Miri test also works. |
|
☔ The latest upstream changes (presumably #148446) made this pull request unmergeable. Please resolve the merge conflicts. |
3947340 to
b3afd22
Compare
|
The Miri subtree was changed cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
|
Those tests check that we find the UB; please also add tests ensuring we return the correct result (including the corner case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I edited the comment a little. You didn't talk about the implementation doing << and >> and | at all! You were supposed to explain why those are the right operations to use. Imagine explaining this to someone who has never seen a funnel shift before in their life (i.e., someone like me).
But even with all that, I still don't get it. You basically say "because they live in the lower bits, the implementation is easy". That explains nothing, it just asserts without justification that it is easy. What is the argument for why the bits end up in the right place?
|
☔ The latest upstream changes (presumably #148507) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Since there's more work happening in this direction, what are your thoughts on adding a to/from array conversion for all simd types via a trait and adding that trait bound to the intrinsic? Then the intrinsic body could be written in library code and work for all backends that do not implement the simd intrinsics (#93145) |
|
Yeah if we could have fallback impls for the |
b3afd22 to
87bd458
Compare
|
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. |
b767368 to
50a6df4
Compare
|
I have added a lot more explanation, could you check if that is enough? @rustbot ready |
50a6df4 to
a23f10a
Compare
|
Yeah that is the entire patch I think, r=me after squashing and when CI is green. |
c9159c9 to
a7aedeb
Compare
|
Tests pass now @bors r=RalfJung |
…Jung Implement SIMD funnel shifts in const-eval/Miri Split off from rust-lang#147520 with just this change for easier review r? `@RalfJung`
Rollup of 15 pull requests Successful merges: - #147404 (Fix issue with callsite inline attribute not being applied sometimes.) - #147534 (Implement SIMD funnel shifts in const-eval/Miri) - #147686 (update isolate_highest_one for NonZero<T>) - #148020 (Show backtrace on allocation failures when possible) - #148204 (Modify contributor email entries in .mailmap) - #148230 (rustdoc: Properly highlight shebang, frontmatter & weak keywords in source code pages and code blocks) - #148555 (Fix rust-by-example spanish translation) - #148556 (Fix suggestion for returning async closures) - #148585 ([rustdoc] Replace `print` methods with functions to improve code readability) - #148600 (re-use `self.get_all_attrs` result for pass indirectly attribute) - #148612 (Add note for identifier with attempted hygiene violation) - #148613 (Switch hexagon targets to rust-lld) - #148644 ([bootstrap] Make `--open` option work with `doc src/tools/error_index_generator`) - #148649 (don't completely reset `HeadUsages`) - #148675 (Remove eslint-js from npm dependencies) r? `@ghost` `@rustbot` modify labels: rollup
…Jung Implement SIMD funnel shifts in const-eval/Miri Split off from rust-lang#147520 with just this change for easier review r? ``@RalfJung``
Rollup of 16 pull requests Successful merges: - #147534 (Implement SIMD funnel shifts in const-eval/Miri) - #147686 (update isolate_highest_one for NonZero<T>) - #148020 (Show backtrace on allocation failures when possible) - #148204 (Modify contributor email entries in .mailmap) - #148230 (rustdoc: Properly highlight shebang, frontmatter & weak keywords in source code pages and code blocks) - #148279 (rustc_builtin_macros: rename bench parameter to avoid collisions with user-defined function names) - #148555 (Fix rust-by-example spanish translation) - #148556 (Fix suggestion for returning async closures) - #148585 ([rustdoc] Replace `print` methods with functions to improve code readability) - #148600 (re-use `self.get_all_attrs` result for pass indirectly attribute) - #148612 (Add note for identifier with attempted hygiene violation) - #148613 (Switch hexagon targets to rust-lld) - #148619 (Enable std locking functions on AIX) - #148644 ([bootstrap] Make `--open` option work with `doc src/tools/error_index_generator`) - #148649 (don't completely reset `HeadUsages`) - #148675 (Remove eslint-js from npm dependencies) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - #145656 (Stabilize s390x `vector` target feature and `is_s390x_feature_detected!` macro) - #147024 (std_detect: Support run-time detection on OpenBSD using elf_aux_info) - #147534 (Implement SIMD funnel shifts in const-eval/Miri) - #147540 (Stabilise `as_array` in `[_]` and `*const [_]`; stabilise `as_mut_array` in `[_]` and `*mut [_]`.) - #147686 (update isolate_highest_one for NonZero<T>) - #148230 (rustdoc: Properly highlight shebang, frontmatter & weak keywords in source code pages and code blocks) - #148555 (Fix rust-by-example spanish translation) - #148556 (Fix suggestion for returning async closures) - #148585 ([rustdoc] Replace `print` methods with functions to improve code readability) - #148600 (re-use `self.get_all_attrs` result for pass indirectly attribute) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - #145656 (Stabilize s390x `vector` target feature and `is_s390x_feature_detected!` macro) - #147024 (std_detect: Support run-time detection on OpenBSD using elf_aux_info) - #147534 (Implement SIMD funnel shifts in const-eval/Miri) - #147540 (Stabilise `as_array` in `[_]` and `*const [_]`; stabilise `as_mut_array` in `[_]` and `*mut [_]`.) - #147686 (update isolate_highest_one for NonZero<T>) - #148230 (rustdoc: Properly highlight shebang, frontmatter & weak keywords in source code pages and code blocks) - #148555 (Fix rust-by-example spanish translation) - #148556 (Fix suggestion for returning async closures) - #148585 ([rustdoc] Replace `print` methods with functions to improve code readability) - #148600 (re-use `self.get_all_attrs` result for pass indirectly attribute) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - #145656 (Stabilize s390x `vector` target feature and `is_s390x_feature_detected!` macro) - #147024 (std_detect: Support run-time detection on OpenBSD using elf_aux_info) - #147534 (Implement SIMD funnel shifts in const-eval/Miri) - #147540 (Stabilise `as_array` in `[_]` and `*const [_]`; stabilise `as_mut_array` in `[_]` and `*mut [_]`.) - #147686 (update isolate_highest_one for NonZero<T>) - #148230 (rustdoc: Properly highlight shebang, frontmatter & weak keywords in source code pages and code blocks) - #148555 (Fix rust-by-example spanish translation) - #148556 (Fix suggestion for returning async closures) - #148585 ([rustdoc] Replace `print` methods with functions to improve code readability) - #148600 (re-use `self.get_all_attrs` result for pass indirectly attribute) r? `@ghost` `@rustbot` modify labels: rollup
Split off from #147520 with just this change for easier review
r? @RalfJung