在 RenderScript 中减少来自单源的内核调用

Reduction kernel call from Single-Source in RenderScript

我在 Single-Source 中实现了一个算法。现在,我想减少算法的处理时间。

可以从 RenderScript 中的单源调用缩减内核吗?

简而言之,没有。来自 Renderscript 文档(粗体是我的):

Android 7.0 (API level 24) introduces a new programming feature called Single-Source RenderScript, in which kernels are launched from the script where they are defined, rather than from Java. This approach is currently limited to mapping kernels, which are simply referred to as "kernels" in this section for conciseness.

不过,我想您可能也对什么是缩减内核感到困惑。缩减内核是一种接受输入 Allocation 并输出单个值(例如最小值或最大值、总和等)的内核。它与优化内核不同,这听起来像你正在努力做。

不,很遗憾你不能,对不起。