diff options
| author | Tim Murray <timmurray@google.com> | 2015-02-18 00:44:08 +0000 |
|---|---|---|
| committer | Tim Murray <timmurray@google.com> | 2015-02-18 00:44:08 +0000 |
| commit | 3d8215a0709785dd5f4c55ce6a85a4a5b7182f2d (patch) | |
| tree | b129fc34560a1b76c2a83d1da46e34473234acca /rs/jni/android_renderscript_RenderScript.cpp | |
| parent | aaab02a91fcb33388d958a6402b2e77481a0d5b2 (diff) | |
| download | frameworks_base-3d8215a0709785dd5f4c55ce6a85a4a5b7182f2d.zip frameworks_base-3d8215a0709785dd5f4c55ce6a85a4a5b7182f2d.tar.gz frameworks_base-3d8215a0709785dd5f4c55ce6a85a4a5b7182f2d.tar.bz2 | |
Revert "Revert "Add BLAS intrinsic.""
This reverts commit aaab02a91fcb33388d958a6402b2e77481a0d5b2.
Change-Id: Iabc3684a9a8c2f9a781029f55120f0346ee9b289
Diffstat (limited to 'rs/jni/android_renderscript_RenderScript.cpp')
| -rw-r--r-- | rs/jni/android_renderscript_RenderScript.cpp | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp index 198cabe..2612323 100644 --- a/rs/jni/android_renderscript_RenderScript.cpp +++ b/rs/jni/android_renderscript_RenderScript.cpp @@ -310,6 +310,143 @@ nScriptGroup2Execute(JNIEnv *_env, jobject _this, jlong con, jlong groupID) { } static void +nScriptIntrinsicBLAS_Single(JNIEnv *_env, jobject _this, jlong con, jlong id, jint func, jint TransA, + jint TransB, jint Side, jint Uplo, jint Diag, jint M, jint N, jint K, + jfloat alpha, jlong A, jlong B, jfloat beta, jlong C, jint incX, jint incY, + jint KL, jint KU) { + RsBlasCall call; + memset(&call, 0, sizeof(call)); + call.func = (RsBlasFunction)func; + call.transA = (RsBlasTranspose)TransA; + call.transB = (RsBlasTranspose)TransB; + call.side = (RsBlasSide)Side; + call.uplo = (RsBlasUplo)Uplo; + call.diag = (RsBlasDiag)Diag; + call.M = M; + call.N = N; + call.K = K; + call.alpha.f = alpha; + call.beta.f = beta; + call.incX = incX; + call.incY = incY; + call.KL = KL; + call.KU = KU; + + RsAllocation in_allocs[3]; + in_allocs[0] = (RsAllocation)A; + in_allocs[1] = (RsAllocation)B; + in_allocs[2] = (RsAllocation)C; + + rsScriptForEachMulti((RsContext)con, (RsScript)id, 0, + in_allocs, sizeof(in_allocs), nullptr, + &call, sizeof(call), nullptr, 0); +} + +static void +nScriptIntrinsicBLAS_Double(JNIEnv *_env, jobject _this, jlong con, jlong id, jint func, jint TransA, + jint TransB, jint Side, jint Uplo, jint Diag, jint M, jint N, jint K, + jdouble alpha, jlong A, jlong B, jdouble beta, jlong C, jint incX, jint incY, + jint KL, jint KU) { + RsBlasCall call; + memset(&call, 0, sizeof(call)); + call.func = (RsBlasFunction)func; + call.transA = (RsBlasTranspose)TransA; + call.transB = (RsBlasTranspose)TransB; + call.side = (RsBlasSide)Side; + call.uplo = (RsBlasUplo)Uplo; + call.diag = (RsBlasDiag)Diag; + call.M = M; + call.N = N; + call.K = K; + call.alpha.d = alpha; + call.beta.d = beta; + call.incX = incX; + call.incY = incY; + call.KL = KL; + call.KU = KU; + + RsAllocation in_allocs[3]; + in_allocs[0] = (RsAllocation)A; + in_allocs[1] = (RsAllocation)B; + in_allocs[2] = (RsAllocation)C; + + rsScriptForEachMulti((RsContext)con, (RsScript)id, 0, + in_allocs, sizeof(in_allocs), nullptr, + &call, sizeof(call), nullptr, 0); +} + +static void +nScriptIntrinsicBLAS_Complex(JNIEnv *_env, jobject _this, jlong con, jlong id, jint func, jint TransA, + jint TransB, jint Side, jint Uplo, jint Diag, jint M, jint N, jint K, + jfloat alphaX, jfloat alphaY, jlong A, jlong B, jfloat betaX, + jfloat betaY, jlong C, jint incX, jint incY, jint KL, jint KU) { + RsBlasCall call; + memset(&call, 0, sizeof(call)); + call.func = (RsBlasFunction)func; + call.transA = (RsBlasTranspose)TransA; + call.transB = (RsBlasTranspose)TransB; + call.side = (RsBlasSide)Side; + call.uplo = (RsBlasUplo)Uplo; + call.diag = (RsBlasDiag)Diag; + call.M = M; + call.N = N; + call.K = K; + call.alpha.c.r = alphaX; + call.alpha.c.i = alphaY; + call.beta.c.r = betaX; + call.beta.c.r = betaY; + call.incX = incX; + call.incY = incY; + call.KL = KL; + call.KU = KU; + + RsAllocation in_allocs[3]; + in_allocs[0] = (RsAllocation)A; + in_allocs[1] = (RsAllocation)B; + in_allocs[2] = (RsAllocation)C; + + rsScriptForEachMulti((RsContext)con, (RsScript)id, 0, + in_allocs, sizeof(in_allocs), nullptr, + &call, sizeof(call), nullptr, 0); +} + +static void +nScriptIntrinsicBLAS_Z(JNIEnv *_env, jobject _this, jlong con, jlong id, jint func, jint TransA, + jint TransB, jint Side, jint Uplo, jint Diag, jint M, jint N, jint K, + jdouble alphaX, jdouble alphaY, jlong A, jlong B, jdouble betaX, + jdouble betaY, jlong C, jint incX, jint incY, jint KL, jint KU) { + RsBlasCall call; + memset(&call, 0, sizeof(call)); + call.func = (RsBlasFunction)func; + call.transA = (RsBlasTranspose)TransA; + call.transB = (RsBlasTranspose)TransB; + call.side = (RsBlasSide)Side; + call.uplo = (RsBlasUplo)Uplo; + call.diag = (RsBlasDiag)Diag; + call.M = M; + call.N = N; + call.K = K; + call.alpha.z.r = alphaX; + call.alpha.z.i = alphaY; + call.beta.z.r = betaX; + call.beta.z.r = betaY; + call.incX = incX; + call.incY = incY; + call.KL = KL; + call.KU = KU; + + RsAllocation in_allocs[3]; + in_allocs[0] = (RsAllocation)A; + in_allocs[1] = (RsAllocation)B; + in_allocs[2] = (RsAllocation)C; + + rsScriptForEachMulti((RsContext)con, (RsScript)id, 0, + in_allocs, sizeof(in_allocs), nullptr, + &call, sizeof(call), nullptr, 0); +} + + +static void nAssignName(JNIEnv *_env, jobject _this, jlong con, jlong obj, jbyteArray str) { if (kLogApi) { @@ -2094,6 +2231,11 @@ static JNINativeMethod methods[] = { {"rsnScriptGroupExecute", "(JJ)V", (void*)nScriptGroupExecute }, {"rsnScriptGroup2Execute", "(JJ)V", (void*)nScriptGroup2Execute }, +{"rsnScriptIntrinsicBLAS_Single", "(JJIIIIIIIIIFJJFJIIII)V", (void*)nScriptIntrinsicBLAS_Single }, +{"rsnScriptIntrinsicBLAS_Double", "(JJIIIIIIIIIDJJDJIIII)V", (void*)nScriptIntrinsicBLAS_Double }, +{"rsnScriptIntrinsicBLAS_Complex", "(JJIIIIIIIIIFFJJFFJIIII)V", (void*)nScriptIntrinsicBLAS_Complex }, +{"rsnScriptIntrinsicBLAS_Z", "(JJIIIIIIIIIDDJJDDJIIII)V", (void*)nScriptIntrinsicBLAS_Z }, + {"rsnProgramStoreCreate", "(JZZZZZZIII)J", (void*)nProgramStoreCreate }, {"rsnProgramBindConstants", "(JJIJ)V", (void*)nProgramBindConstants }, |
