Android GPU Compute Going Ahead

Posted by Dan Galpin, Developer Advocate

Illustration of image rendering with character

We launched RenderScript in Android 3.0 as a manner for purposes to run computationally-intensive code on the CPU or GPU with out having to utilize the NDK or GPU-specific APIs. As Android has advanced, the NDK tooling and APIs for GPU compute using OpenGL have dramatically improved. In Android 7.0 (API stage 24), we added the Vulkan API, which permits for low-level entry to GPU {hardware} options. In Android 10.0 (API stage 29) we added the aptitude to simply share Bitmap hardware buffers between Android SDK and NDK code to hurry picture processing.

We not advocate RenderScript because the optimum strategy to accomplish these performance-critical duties, and can be deprecating the APIs in Android 12. We would like you to trust that your high-performance workloads will run on GPU {hardware}, and plenty of gadgets are already transport with solely CPU help for RenderScript. The APIs will proceed to perform, however compiling RenderScript code when concentrating on Android 12 will give a warning.

How we’re addressing RenderScript intrinsics

The RenderScript subsystem was additionally used to implement a variety of helpful image-processing intrinsics. We’re offering an open-source library that accommodates the highly-tuned CPU implementations for all however the Fundamental Linear Algebra Subprograms (BLAS) intrinsics. For the instances that we now have measured, intrinsics execute quicker (usually considerably so) on the CPU utilizing our library than working inside RenderScript, even on gadgets the place GPU help was attainable.

For BLAS, we recommend utilizing one of many many libraries that already present this performance, comparable to netlib’s libblas.

Please file points with the library here.

If you happen to use RenderScript scripts:

To take full benefit of GPU acceleration, we advocate migrating RenderScript scripts to the cross-platform Vulkan API. To assist get you began with this transition, we now have supplied a sample app that demonstrates two RenderScript scripts with Vulkan equivalents.

  • The primary script is the “howdy world” of RenderScript; it rotates the hue of the picture.
  • The second script implements blur, utilizing a number of cells of the enter allocation to determine one cell of the output allocation. (Observe that the highly-optimized blur in our static library has broader system compatibility and quicker efficiency than this pattern script in lots of instances.)

As a result of Vulkan isn’t obtainable on older gadgets, you might have to handle two code paths: RenderScript on older gadgets and Vulkan on newer ones. Our documentation has more details on how to migrate.

You may file points with the pattern here.

Thanks

We on the RenderScript crew thanks in your help over time. We perceive that transitions are by no means straightforward; our deal with cross-platform APIs comparable to Vulkan will imply even higher instruments and help in your GPU-accelerated purposes.

Recent Articles

You informed us: You do not agree with Tim Cook dinner’s stance on side-loading apps

Every week in the past, Apple CEO Tim Cook dinner spoke about iPhone safety in an interview. He deemed the observe of side-loading apps...

Samsung Galaxy M22 Anticipated to Help 25W Quick Charging

Samsung Galaxy M22 will include 25W quick charging assist, an inventory on the US Federal Communications Fee (FCC) website has advised. The unannounced...

Related Stories

Stay on op - Ge the daily news in your inbox