summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2016-10-06 10:41:57 -0700
committerMiao Wang <miaowang@google.com>2016-10-07 12:16:47 -0700
commit107ff9e12bfc76e414f37fae0fcda25f13c12970 (patch)
tree903597052a2af982e8d0591954633dd1740af04e
parent89caa609295f2222661b319e5a197ae6ce184579 (diff)
Correctly pass number of input allocations for RS NDK BLAS.
Bug: 31992305 Test: Build and CTS RsCpp test pass. Change-Id: I5d55dd3cfa1b6eff1c4d9dfa5315e7e962bf6588 (cherry picked from commit 93ddf62ab18ed17d96189a602a8cbde83712a3e9)
-rw-r--r--cpp/ScriptIntrinsicBLAS.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/cpp/ScriptIntrinsicBLAS.cpp b/cpp/ScriptIntrinsicBLAS.cpp
index 63a8f0c9..e1ac85a1 100644
--- a/cpp/ScriptIntrinsicBLAS.cpp
+++ b/cpp/ScriptIntrinsicBLAS.cpp
@@ -18,6 +18,8 @@
#include "RenderScript.h"
#include "rsCppInternal.h"
+#define NELEM(m) (sizeof(m) / sizeof((m)[0]))
+
using namespace android;
using namespace RSC;
@@ -104,7 +106,7 @@ nScriptIntrinsicBLAS_Single(RS* mRS, RsContext con, RsScript id, RsBlasFunction
M, N, K, incX, incY, KL, KU, alpha, beta, 0.0, 0.0,
0.0f, 0.0f, 0.0f, 0.0f, 0.0, 0.0, 0.0, 0.0);
RsAllocation in_allocs[3] = {A, B, C};
- tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, sizeof(in_allocs), nullptr,
+ tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr,
&call, sizeof(call), nullptr, 0));
}
@@ -118,7 +120,7 @@ nScriptIntrinsicBLAS_Double(RS* mRS, RsContext con, RsScript id, RsBlasFunction
M, N, K, incX, incY, KL, KU, 0.0f, 0.0f, alpha, beta,
0.0f, 0.0f, 0.0f, 0.0f, 0.0, 0.0, 0.0, 0.0);
RsAllocation in_allocs[3] = {A, B, C};
- tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, sizeof(in_allocs), nullptr,
+ tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr,
&call, sizeof(call), nullptr, 0));
}
@@ -131,7 +133,7 @@ nScriptIntrinsicBLAS_Complex(RS* mRS, RsContext con, RsScript id, RsBlasFunction
M, N, K, incX, incY, KL, KU, 0.0f, 0.0f, 0.0, 0.0,
alphaX, alphaY, betaX, betaY, 0.0, 0.0, 0.0, 0.0);
RsAllocation in_allocs[3] = {A, B, C};
- tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, sizeof(in_allocs), nullptr,
+ tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr,
&call, sizeof(call), nullptr, 0));
}
@@ -144,7 +146,7 @@ nScriptIntrinsicBLAS_Z(RS* mRS, RsContext con, RsScript id, RsBlasFunction func,
M, N, K, incX, incY, KL, KU, 0.0f, 0.0f, 0.0, 0.0,
0.0f, 0.0f, 0.0f, 0.0f, alphaX, alphaY, betaX, betaY);
RsAllocation in_allocs[3] = {A, B, C};
- tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, sizeof(in_allocs), nullptr,
+ tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr,
&call, sizeof(call), nullptr, 0));
}
@@ -165,7 +167,7 @@ nScriptIntrinsicBLAS_BNNM(RS* mRS, RsContext con, RsScript id, int M, int N, int
call.c_mult_int = c_mult_int;
RsAllocation in_allocs[3] = {A, B, C};
- tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, sizeof(in_allocs), nullptr,
+ tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr,
&call, sizeof(call), nullptr, 0));
}