-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
require simd_insert, simd_extract indices to be constants #121225
require simd_insert, simd_extract indices to be constants #121225
Conversation
This comment has been minimized.
This comment has been minimized.
26cf1c7
to
6dbe813
Compare
This comment has been minimized.
This comment has been minimized.
I should investigate whether I can do the same trick as #115933 for insert and extract |
Which trick? |
Ah, they wanna do math on their own const generics. Yea, that won't work |
I think all they want to do is |
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.
r=me when stdsimd has been synced
That should be soon hopefully: #121185 |
6dbe813
to
396cf1e
Compare
We had a codegen that that consisted only of calls to simd_insert / simd_extract with variable arguments for the index. @workingjubilee @Amanieu @calebzulawski what are we supposed to do with that, given that we said we want these functions to be like simd_shuffle and only support constant indices? I don't know what the test was actually supposed to test, it had "generic" in the name. See the last commit of this PR. |
I think changing those arguments to const generics is appropriate. Typeck or similar should probably have rejected the non-const argument (which is what shuffles do, I think?) It seems packed_simd is really the only consumer of those intrinsics, if std::arch doesn't use them. |
stdarch uses them as well, but since rust-lang/stdarch#1530 it makes all arguments constants. It also had one non-constant use in a test only, somewhat similar to this codegen test. But if we don't want to support non-constant simd_insert/extract, it makes little sense to have a codegen test for it. Note that this does not quite make the arguments const generics, instead it makes them special magic arguments that must be const. Moving to const generics is tracked at #85229, but not currently possible yet. |
I also think it's fine to make these require constants. |
Is there something that I should do with that codegen test, or should I delete it?
|
It's fine to just remove it. We're changing the definition of |
Okay, thanks. :) |
☀️ Test successful - checks-actions |
Finished benchmarking commit (52dba5f): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 649.949s -> 649.986s (0.01%) |
As discussed in #77477 (see in particular here). This PR doesn't touch codegen yet -- the first step is to ensure that the indices are always constants; the second step is to then make use of this fact in backends.
Blocked on rust-lang/stdarch#1530 propagating to the rustc repo.