0

I am building a cross platform app that is powered by a common c++ backend. Right now I am only working on the iOS side but before I get to far I wanted to check if simd was available on Android as well.

I currently use simd for their float3 and float2 structs that way I am using the same structs between my backend code and the Metal shader.

Will I be able to use simd when I start using this c/c++ code on Android?

J.Doe
  • 1,502
  • 13
  • 47
  • related: this question about `simd/simd.h` from the same user [Simd not on my Linux machine: fatal error: simd/simd.h: No such file or directory](https://stackoverflow.com/q/51921366). – Peter Cordes Aug 19 '18 at 20:12
  • Looks like SIMD is optional (and not quite the same) on Android and depends on the CPU https://developer.android.com/ndk/guides/cpu-arm-neon – Richard Critten Aug 19 '18 at 20:17
  • CPU SIMD doesn't do well with xy or xyz geometry vectors stored in a SIMD vector, unless you're just adding or subtracting them (not dot or cross product). For CPU SIMD, you want an array of x, and a separate array of y, so you can do 4 vector-length calculations in parallel with no shuffling. See [Explaining the different types in Metal and SIMD](https://stackoverflow.com/a/51797942). But if you're mostly just setting up for a GPU, you might be ok. – Peter Cordes Aug 19 '18 at 20:38
  • I am not really using SIMD for performance reasons it is mostly so that the backend and my Metal shader can be speaking about the same data structures. – J.Doe Aug 19 '18 at 20:40

1 Answers1

1

Yes, The NDK supports ARM Advanced SIMD, commonly known as NEON, an optional instruction set extension for ARMv7 and ARMv8. ... Not all ARMv7-based Android devices support NEON, but devices that do may benefit significantly from its support for scalar/vector instructions.