Fast Fourier transforms on GPU on iOS

2019-04-28 08:31发布

I am implementing compute intensive applications for iOS (i.e., iPhone or iPad) that heavily use fast Fourier transforms (and some signal processing operations such as interpolations and resampling). What are the best libraries and API that allows for running FFTs on iOS?

I have briefly looked into Apple Metal as well as Apple vDSP. I wasn't sure that vDSP utilizes GPUs although it seems to be highly parallelized and utilizes SIMD. Metal seems to allow to access GPU for compute intensive apps, but I am not able to find libraries for FFT and basic signal processing operations (something like AMD's clFFT). Does Apple provide such libraries?

Are there other APIs and libraries utilizing GPUs for iOS that are suitable for compute intensive apps?

Thanks.

标签: ios fft gpgpu vdsp
4条回答
乱世女痞
2楼-- · 2019-04-28 09:09

vDSP and Accelerate use vector instructions on the CPU to parallelize and speed up signal processing tasks.

Regarding FFT via GPGPU on iOS systems, I think there is currently no such library available. Many signal processing algorithms are implemented in the GPGPU framework GPUImage but it looks like FFT is not supported, since these algorithms are implemented with OpenGL ES 2.0 shaders. The same goes for ogles_gpgpu.

OpenGL ES 3.1 Compute Shaders are not supported on iOS systems, so you should check out Metal then.

查看更多
冷血范
3楼-- · 2019-04-28 09:10

Take a look at my answer here: https://stackoverflow.com/a/19966776/468812

Although the code in there uses FFT for audio processing, it can be applied to any signal.

查看更多
Ridiculous、
4楼-- · 2019-04-28 09:16

vDSP actually uses the builtin (from iPhone 3GS onward) NEON vector arithmetic processor, which is, as you already said a SIMD engine and is really fast for certain tasks, including FFT.

I have no experience with computing an FFT on the GPU but i doubt it will be faster as the NEON instructions in vDSP, as its only purpose are these media and signal processing related tasks.

vDSP uses Arm NEON instructions under the hood and makes using them really easy. If you want to get down and dirty you could also use the NEON instruction set manually, but i think even getting on par with vDSP runtime wise will be a challenge, especially if you only need out of the box functions like FFT.

If you want to test the NEON engine yourself there is a great benchmark as APK for Android devices which tests regular vs NEON computation. The only thing you have to notice is, that if your data is larger than the L1 Cache the L2 Cache accessing becomes the limiting factor and if you even exceed this, there wont be a noticable runtime advantage.

查看更多
Deceive 欺骗
5楼-- · 2019-04-28 09:25

You'll find Surge to be precisely what you need. And it's written in pure Swift!

查看更多
登录 后发表回答