Merge "Add BLAS intrinsic."
This commit is contained in:
@@ -887,6 +887,55 @@ public class RenderScript {
|
|||||||
return rsnPathCreate(mContext, prim, isStatic, vtx, loop, q);
|
return rsnPathCreate(mContext, prim, isStatic, vtx, loop, q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
native void rsnScriptIntrinsicBLAS_Single(long con, long id, int func, int TransA,
|
||||||
|
int TransB, int Side, int Uplo, int Diag, int M, int N, int K,
|
||||||
|
float alpha, long A, long B, float beta, long C, int incX, int incY,
|
||||||
|
int KL, int KU);
|
||||||
|
synchronized void nScriptIntrinsicBLAS_Single(long id, int func, int TransA,
|
||||||
|
int TransB, int Side, int Uplo, int Diag, int M, int N, int K,
|
||||||
|
float alpha, long A, long B, float beta, long C, int incX, int incY,
|
||||||
|
int KL, int KU) {
|
||||||
|
validate();
|
||||||
|
rsnScriptIntrinsicBLAS_Single(mContext, id, func, TransA, TransB, Side, Uplo, Diag, M, N, K, alpha, A, B, beta, C, incX, incY, KL, KU);
|
||||||
|
}
|
||||||
|
|
||||||
|
native void rsnScriptIntrinsicBLAS_Double(long con, long id, int func, int TransA,
|
||||||
|
int TransB, int Side, int Uplo, int Diag, int M, int N, int K,
|
||||||
|
double alpha, long A, long B, double beta, long C, int incX, int incY,
|
||||||
|
int KL, int KU);
|
||||||
|
synchronized void nScriptIntrinsicBLAS_Double(long id, int func, int TransA,
|
||||||
|
int TransB, int Side, int Uplo, int Diag, int M, int N, int K,
|
||||||
|
double alpha, long A, long B, double beta, long C, int incX, int incY,
|
||||||
|
int KL, int KU) {
|
||||||
|
validate();
|
||||||
|
rsnScriptIntrinsicBLAS_Double(mContext, id, func, TransA, TransB, Side, Uplo, Diag, M, N, K, alpha, A, B, beta, C, incX, incY, KL, KU);
|
||||||
|
}
|
||||||
|
|
||||||
|
native void rsnScriptIntrinsicBLAS_Complex(long con, long id, int func, int TransA,
|
||||||
|
int TransB, int Side, int Uplo, int Diag, int M, int N, int K,
|
||||||
|
float alphaX, float alphaY, long A, long B, float betaX, float betaY, long C, int incX, int incY,
|
||||||
|
int KL, int KU);
|
||||||
|
synchronized void nScriptIntrinsicBLAS_Complex(long id, int func, int TransA,
|
||||||
|
int TransB, int Side, int Uplo, int Diag, int M, int N, int K,
|
||||||
|
float alphaX, float alphaY, long A, long B, float betaX, float betaY, long C, int incX, int incY,
|
||||||
|
int KL, int KU) {
|
||||||
|
validate();
|
||||||
|
rsnScriptIntrinsicBLAS_Complex(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_Z(long con, long id, int func, int TransA,
|
||||||
|
int TransB, int Side, int Uplo, int Diag, int M, int N, int K,
|
||||||
|
double alphaX, double alphaY, long A, long B, double betaX, double betaY, long C, int incX, int incY,
|
||||||
|
int KL, int KU);
|
||||||
|
synchronized void nScriptIntrinsicBLAS_Z(long id, int func, int TransA,
|
||||||
|
int TransB, int Side, int Uplo, int Diag, int M, int N, int K,
|
||||||
|
double alphaX, double alphaY, long A, long B, double betaX, double betaY, long C, int incX, int incY,
|
||||||
|
int KL, int KU) {
|
||||||
|
validate();
|
||||||
|
rsnScriptIntrinsicBLAS_Z(mContext, id, func, TransA, TransB, Side, Uplo, Diag, M, N, K, alphaX, alphaY, A, B, betaX, betaY, C, incX, incY, KL, KU);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
long mDev;
|
long mDev;
|
||||||
long mContext;
|
long mContext;
|
||||||
@SuppressWarnings({"FieldCanBeLocal"})
|
@SuppressWarnings({"FieldCanBeLocal"})
|
||||||
|
|||||||
1489
rs/java/android/renderscript/ScriptIntrinsicBLAS.java
Normal file
1489
rs/java/android/renderscript/ScriptIntrinsicBLAS.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -309,6 +309,143 @@ nScriptGroup2Execute(JNIEnv *_env, jobject _this, jlong con, jlong groupID) {
|
|||||||
rsScriptGroupExecute((RsContext)con, (RsScriptGroup2)groupID);
|
rsScriptGroupExecute((RsContext)con, (RsScriptGroup2)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
|
static void
|
||||||
nAssignName(JNIEnv *_env, jobject _this, jlong con, jlong obj, jbyteArray str)
|
nAssignName(JNIEnv *_env, jobject _this, jlong con, jlong obj, jbyteArray str)
|
||||||
{
|
{
|
||||||
@@ -2094,6 +2231,11 @@ static JNINativeMethod methods[] = {
|
|||||||
{"rsnScriptGroupExecute", "(JJ)V", (void*)nScriptGroupExecute },
|
{"rsnScriptGroupExecute", "(JJ)V", (void*)nScriptGroupExecute },
|
||||||
{"rsnScriptGroup2Execute", "(JJ)V", (void*)nScriptGroup2Execute },
|
{"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 },
|
{"rsnProgramStoreCreate", "(JZZZZZZIII)J", (void*)nProgramStoreCreate },
|
||||||
|
|
||||||
{"rsnProgramBindConstants", "(JJIJ)V", (void*)nProgramBindConstants },
|
{"rsnProgramBindConstants", "(JJIJ)V", (void*)nProgramBindConstants },
|
||||||
|
|||||||
Reference in New Issue
Block a user