Correctly pass number of input allocations for RS NDK BLAS.
Bug: 31992305
Test: Build and CTS RsCpp test pass.
Change-Id: I5d55dd3cfa1b6eff1c4d9dfa5315e7e962bf6588
diff --git a/cpp/ScriptIntrinsicBLAS.cpp b/cpp/ScriptIntrinsicBLAS.cpp
index 027b8d8..dd31f81 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 @@
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 @@
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 @@
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 @@
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 @@
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));
}