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

rewrite hello-neon as a generic vectorization sample #1011

Open
DanAlbert opened this issue May 3, 2024 · 1 comment
Open

rewrite hello-neon as a generic vectorization sample #1011

DanAlbert opened this issue May 3, 2024 · 1 comment

Comments

@DanAlbert
Copy link
Member

DanAlbert commented May 3, 2024

This sample probably made more sense back when it was written, but now it's not really guiding people toward doing the right thing.

Much more useful, I think would be rewriting it as a general purpose vectorization demo. Pick some sort of vectorization problem (probably something simple like a matrix multiply), and build an implementation for each of:

  • Neon intrinsics
  • Clang's arch-generic intrinsics
  • SVE
  • C++'s <algorithm> stuff, if the problem we pick is suitable for them
  • Plain old C++, letting the compiler autovectorize

And then the UI would show the benchmark results of each so people can see the differences.

@DanAlbert
Copy link
Member Author

After this merges and before I delete the old one, https://developer.android.com/ndk/guides/cpu-arm-neon will need to be updated since it points to hello-neon.

DanAlbert added a commit to DanAlbert/ndk-samples that referenced this issue Jun 12, 2024
This adds a new generic vectorization sample to replace hello-neon. Most
importantly, it covers non-Neon options for SIMD. One of the useful
things it shows, for example, is that there's actually no reason to
write SIMD code the way that hello-neon does any more.

This also solves a much simpler problem (small matrix multiplication),
which makes it easier to see how to deal with the SIMD features rather
than figuring out what a FIR filter is.

Finally, this sample benchmarks each of the implementations so it's
obvious what is and isn't worth doing. I was sort of surprised that
auto-vectorization didn't do better, and was pleased to learn that
there's no reason at all to write Neon intrinsics.

I'll delete hello-neon after this merges and I've fixed up the doc
links.

android#1011
DanAlbert added a commit to DanAlbert/ndk-samples that referenced this issue Jun 12, 2024
This adds a new generic vectorization sample to replace hello-neon. Most
importantly, it covers non-Neon options for SIMD. One of the useful
things it shows, for example, is that there's actually no reason to
write SIMD code the way that hello-neon does any more.

This also solves a much simpler problem (small matrix multiplication),
which makes it easier to see how to deal with the SIMD features rather
than figuring out what a FIR filter is.

Finally, this sample benchmarks each of the implementations so it's
obvious what is and isn't worth doing. I was sort of surprised that
auto-vectorization didn't do better, and was pleased to learn that
there's no reason at all to write Neon intrinsics.

I'll delete hello-neon after this merges and I've fixed up the doc
links.

android#1011
DanAlbert added a commit to DanAlbert/ndk-samples that referenced this issue Jun 12, 2024
This adds a new generic vectorization sample to replace hello-neon. Most
importantly, it covers non-Neon options for SIMD. One of the useful
things it shows, for example, is that there's actually no reason to
write SIMD code the way that hello-neon does any more.

This also solves a much simpler problem (small matrix multiplication),
which makes it easier to see how to deal with the SIMD features rather
than figuring out what a FIR filter is.

Finally, this sample benchmarks each of the implementations so it's
obvious what is and isn't worth doing. I was sort of surprised that
auto-vectorization didn't do better, and was pleased to learn that
there's no reason at all to write Neon intrinsics.

I'll delete hello-neon after this merges and I've fixed up the doc
links.

android#1011
DanAlbert added a commit to DanAlbert/ndk-samples that referenced this issue Jun 17, 2024
This adds a new generic vectorization sample to replace hello-neon. Most
importantly, it covers non-Neon options for SIMD. One of the useful
things it shows, for example, is that there's actually no reason to
write SIMD code the way that hello-neon does any more.

This also solves a much simpler problem (small matrix multiplication),
which makes it easier to see how to deal with the SIMD features rather
than figuring out what a FIR filter is.

Finally, this sample benchmarks each of the implementations so it's
obvious what is and isn't worth doing. I was sort of surprised that
auto-vectorization didn't do better, and was pleased to learn that
there's no reason at all to write Neon intrinsics.

I'll delete hello-neon after this merges and I've fixed up the doc
links.

android#1011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant