diff options
author | Tim Murray <timmurray@google.com> | 2015-04-15 22:30:12 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-15 22:30:14 +0000 |
commit | 7f72f74766fed73ae9816fec6031a199f70d1428 (patch) | |
tree | f6a9487995a115e7e677932c8039c36b27e4591b /rs/java | |
parent | 71ba4e461f7a492b44632e282e6480345ac4b9c8 (diff) | |
parent | 9cb16a2f91c79845e5425fbf55f3b679fb18a4dd (diff) | |
download | frameworks_base-7f72f74766fed73ae9816fec6031a199f70d1428.zip frameworks_base-7f72f74766fed73ae9816fec6031a199f70d1428.tar.gz frameworks_base-7f72f74766fed73ae9816fec6031a199f70d1428.tar.bz2 |
Merge "Add BNNM intrinsic."
Diffstat (limited to 'rs/java')
-rw-r--r-- | rs/java/android/renderscript/RenderScript.java | 11 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptIntrinsicBLAS.java | 21 |
2 files changed, 32 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java index 9f3348c..6b1939c 100644 --- a/rs/java/android/renderscript/RenderScript.java +++ b/rs/java/android/renderscript/RenderScript.java @@ -951,6 +951,17 @@ public class RenderScript { rsnScriptIntrinsicBLAS_Z(mContext, id, func, TransA, TransB, Side, Uplo, Diag, M, N, K, alphaX, alphaY, A, B, betaX, betaY, C, incX, incY, KL, KU); } + native void rsnScriptIntrinsicBLAS_BNNM(long con, long id, int M, int N, int K, + long A, int a_offset, long B, int b_offset, long C, int c_offset, + int c_mult_int); + synchronized void nScriptIntrinsicBLAS_BNNM(long id, int M, int N, int K, + long A, int a_offset, long B, int b_offset, long C, int c_offset, + int c_mult_int) { + validate(); + rsnScriptIntrinsicBLAS_BNNM(mContext, id, M, N, K, A, a_offset, B, b_offset, C, c_offset, c_mult_int); + } + + long mDev; long mContext; diff --git a/rs/java/android/renderscript/ScriptIntrinsicBLAS.java b/rs/java/android/renderscript/ScriptIntrinsicBLAS.java index 90d2300..16b7033 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicBLAS.java +++ b/rs/java/android/renderscript/ScriptIntrinsicBLAS.java @@ -176,6 +176,9 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { private static final int RsBlas_zherk = 141; private static final int RsBlas_zher2k = 142; + // BLAS extensions start here + private static final int RsBlas_bnnm = 1000; + /** */ public static ScriptIntrinsicBLAS create(RenderScript rs) { @@ -1485,5 +1488,23 @@ public final class ScriptIntrinsicBLAS extends ScriptIntrinsic { } + /** + * + * 8-bit GEMM-like operation for neural networks + * + * @hide + **/ + public void BNNM(Allocation A, int a_offset, Allocation B, int b_offset, Allocation C, int c_offset, int c_mult) { + validateL3(Element.U8(mRS), NO_TRANSPOSE, TRANSPOSE, 0, A, B, C); + + int M = -1, N = -1, K = -1; + M = A.getType().getY(); + N = B.getType().getY(); + K = A.getType().getX(); + + + mRS.nScriptIntrinsicBLAS_BNNM(getID(mRS), M, N, K, A.getID(mRS), a_offset, B.getID(mRS), b_offset, C.getID(mRS), c_offset, c_mult); + + } } |