Not sure if I've posted it in the right place. I'm stuck here for a long time....
The issue is, I tried many Renderscript apps with different kinds of APIs, but none of them runs on GPU(Adreno 330) on my Nexus 5. Here's my environment:
Device: Nexus 5, Adreno 330
Android: AOSP 4.4.2
What I want to do?
I want to develop a GPU benchmark in RenderScript which runs in background.
How I find that they not running in GPU?
I hooked the kgsl code in kernel. Actually I found there's a parameter in adreno_context(kernel/drivers/gpu/msm/adreno_drawctxt.c) called type, which specifies the context type as GL, CL or RS. What I see from the log is only OpenGL contexts, no CL or RS even when I run my Renderscript applications.
What kind of RS code I've tried?
Many APIs like ScriptIntrinsic for graphics processing, pow function for mathmatic processing, etc. Actually I noticed many people mentioned their codes run on GPU (like http://stackoverflow.com/questions/20487011/renderscript-pow-powr-and-po...), but not on my phone. I'm really stuck here so I made a registration in this forum and hoped somebody can help me about this.
Anyone can help me? :(
Renderscript doesn't take advantage of the GPU except on Nexus10 (not sure).
Google decided to drop any OpenCL support in favor of Renderscript long ago but Google has failed to actually make Renderscript a viable GPU language. Renderscript also seems to be poorly designed to take advantage of GPUs, i.e. no explicit barrier support and no support for GPU HW engines (rasterizers, scatter/gather, etc...)
For high-performance mobile compute you only really have iOS with Metal. Android is supposed to support Vulkan on some indeterminate future date. Google's mobile compute API is a mess... Sorry for the bad news.
RenderScript is now becoming a mature framework.
A new book, which talks about RenderScript, has just been published: RenderScript: parallel computing on Android, the easy way
Try it out :) There is a wide support for different devices. Vulkan is a good one, but it is not going to spread soon (API >= 23), and only high-end devices for now. RenderScript still rules.
Thanks for the link to the new book.
You stated Renderscript is "now becoming a mature framework". Can you be more clear what you mean here? Are there some new features?
From our work on mobile compute, Renderscript is probably the least mature and least robust in terms of features exported by GPUs. It is easy to program and use, but it really only solves a narrow scope of problems. Also, the biggest short-coming is the lack of actual graphics related primitive support for rasterization despite being called "Render" script.
Renderscript, like many things at Google, seems like a graduate student thesis trying to be a product/solution... When you talk to the people at Google, there isn't anyone really in charge so there's lots of hand-waving and excuses for why Renderscript actually stinks at rendering...
Hi, thank you for the observations!
By "mature" I mean its parallel computing side, not the graphics one (it has been even deprecated, starting from Android 23!). I've used it for really a lot of time, on the parallel computing side, and saw extremely good performance (of course, on good devices, it all depends on the provided drivers).
If you don't need the graphics side, you can really easily, for example, port other parallel computing libraries, e.g. built on CUDA, to RenderScript kernels. Mature means also that there is a broad driver support and performance is +1 on Maali, Adreno and PowerVR chipsets.
Opinion: I don't know the real reason why the rendering/graphics side has been deprecated, but probably because Vulkan was kicking in and, probably, Google wanted to just say "hey, for graphics use this one!".