Skip to content

Move entirely to array-based SIMD #1624

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Aug 8, 2024
Merged

Conversation

scottmcm
Copy link
Member

@scottmcm scottmcm commented Aug 7, 2024

See MCP#621

This tries to be very mechanical. It's not doing anything particularly smart and it's not changing any function signatures. Just adding []s around things, or sometimes using array repeats splats instead of manual repeats.

@rustbot
Copy link
Collaborator

rustbot commented Aug 7, 2024

r? @Amanieu

rustbot has assigned @Amanieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@scottmcm scottmcm force-pushed the array-simd branch 8 times, most recently from a40f965 to fed65ae Compare August 7, 2024 09:21
@scottmcm scottmcm closed this Aug 7, 2024
@scottmcm scottmcm reopened this Aug 7, 2024
@scottmcm scottmcm force-pushed the array-simd branch 5 times, most recently from 320ab21 to 634fd95 Compare August 7, 2024 17:23
See MCP#621

This tries to make as few changes as possible -- it keeps the `new` functions taking all the parameters, for example.
@scottmcm scottmcm force-pushed the array-simd branch 2 times, most recently from db562ea to 56a05aa Compare August 7, 2024 19:38
This ended up way more annoying than expected, because I needed to refactor the `types!` macro to separate out the stability attributes to put those on the `Debug` impl without also copying all the `#[doc]`s.  But I like how it came out in the end, reducing duplication in the macro invocations.

But without it all the C-consistency tests fail.
@scottmcm scottmcm marked this pull request as ready for review August 7, 2024 20:08
@scottmcm
Copy link
Member Author

scottmcm commented Aug 7, 2024

Looks like I finally got this working! 🎉

Some context for the review:

  • While int32x4_t([a, b, c, d]) appears to work fine, int32x4_t([x; 4]) apparently doesn't, so I ended up adding more internal splat methods that go through swizzles to ensure such things are proper splats -- lots of tests failed without that.
  • A bunch of tests failed when it Debugged as int32x4_t([1, 2, 3, 4]) with square brackets there. While we're allowed to change debug like that, it wasn't clear that it was really better with square brackets, so I have the macro manually emitting an impl Debug, with a helper function to polymorphize just to the array type rather than monoing for every simd type.
  • The separate impl Debug wanted stability attributes, of course, which led to more refactoring of the macro so that I could get just the stability part and not all the docs too.

Overall, I'm super-happy to see diffs like

-    pub struct v32i8(
-        pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8,
-        pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8,
-        pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8,
-        pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8,
-    );
+    pub struct v32i8(32 x pub(crate) i8);

because man was that too much copy-paste for my taste.

@Amanieu Amanieu merged commit a3beb09 into rust-lang:master Aug 8, 2024
30 checks passed
@scottmcm scottmcm deleted the array-simd branch August 9, 2024 05:56
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 9, 2024
Update stdarch submodule

To pick up rust-lang/stdarch#1624 and unblock removing support for non-array-based-simd (rust-lang/compiler-team#621).

try-job: dist-aarch64-linux
try-job: dist-armv7-linux
try-job: dist-x86_64-linux
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 13, 2024
Update stdarch submodule

To pick up rust-lang/stdarch#1624 and unblock removing support for non-array-based-simd (rust-lang/compiler-team#621).

try-job: dist-aarch64-linux
try-job: dist-armv7-linux
try-job: dist-x86_64-linux
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 21, 2024
Update stdarch submodule

To pick up rust-lang/stdarch#1624 and unblock removing support for non-array-based-simd (rust-lang/compiler-team#621).
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants