You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android openblas: On entry to SGEMM parameter number 13 had an illegal value #1014
@ashwinyes ,thanks, yes, i have checked the parameters:
static void gemm(Stream<cpu> *stream,
bool transa, bool transb,
int m, int n, int k, float alpha,
const float *A, int lda, const float *B, int ldb,
float beta, float *C, int ldc) {
std::cout << "transa and transb is: "<<transa << " " << transb <<std::endl;
std::cout << "CblasColMajor is: " << CblasColMajor << std::endl;
std::cout << "m , n ,k , lda, ldb, ldc is " << m << " " << n << " " << k<< " "<< lda<<" "<<ldb << " "<< ldc << std::endl;
cblas_sgemm(CblasColMajor, GetT(transa), GetT(transb),
m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
if(m <= 36) {
for(int i = 0; i < m * n; i++) {
std::cout << C[i] << std::endl;
}
}
}
It print out like this:
transa and transb is: 0 0
CblasColMajor is: 102
m , n ,k , lda, ldb, ldc is 36 4 32 36 32 36
** On entry to SGEMM parameter number 13 had an illegal value
1.04778
1.04814
1.0485
Hm, strange. The coding in interface/gemm.c looks pretty much straightforward to me, the error message is generated before any significant computation or even shuffling of parameters has taken place. Also no other function called from there is even capable of generating this error message, and as it happens in generic code the problem would appear to affect all platforms - unless there is some memory corruption affecting the parameters "seen" by gemm.c.
Can you check if the same problem happens on other architectures (e.g. x86) as well, or provide a
standalone program that reproduces the error ? (Alternatively, try adding a printf statement before the
check(s) in interface/gemm.c that result in "info" being set to 13 and rebuild OpenBLAS to see what passes for m and ldc there. At the very least that should tell if your code actually calls the openblas sgemm function or if it picks up some other local implementation on your system by mistake)
@martin-frbg , thanks for your reply, i add such piece code to interface/gemm.c
nrowa = args.m;
if (transa & 1) nrowa = args.k;
nrowb = args.k;
if (transb & 1) nrowb = args.n;
info = -1;
if (args.ldc < args.m) {
fprintf(stderr, "error happens, m = %4d n = %d k = %d lda = %4d ldb = %4d ldc = %4d\n",
args.m, args.n, args.k, args.lda, args.ldb, args.ldc);
info = 13;
}
Then strange thing happens, it print out like this:
transa and transb is: 0 0
CblasColMajor is: 102
m , n ,k , lda, ldb, ldc is 36 2 32 36 32 36
error happens, m = 36 n = 2 k = 32 lda = 1117814816 ldb = 11109200 ldc = 0
** On entry to SGEMM parameter number 13 had an illegal value
1.04778
1.04814
1.0485
I don't know why the parameters value changed when they were passed to gemm.c.
@fengshikun any updates on this ? Without more information it is not even clear if this is an OpenBLAS issue at all, so I am inclined to close this ticket.
I have same problem, it is "On entry to SGEMM parameter number 10 had an illegal value", my m,n,k dim is 2,2,3. but when I set it to same dim, it will not cause this error, I need to calculate matrices of different shapes. How to fix it.
See the definition of SGEMM in e.g. the Reference BLAS https://netlib.org/lapack/explore-html-3.6.1/db/dc9/group__single__blas__level3_gafe51bacb54592ff5de056acabd83c260.html or the Intel MKL - "parameter number 10" is ldb, the first ("leading") dimension of your array b, which must be at least as large as 'k' (or as large as 'n' if you are using the transpose of b)
(I'm sure it would help if these functions would provide a clearer error message, but the standard was established over 40 years ago when computer hardware was quite different from today)
Activity
ashwinyes commentedon Nov 17, 2016
This error is hit at the following condition in interface/gemm.c
if (args.ldc < args.m)
Suggest you to check the values values of m and ldc. Make sure that ldc is not less than m.
Thanks.
fengshikun commentedon Nov 18, 2016
@ashwinyes ,thanks, yes, i have checked the parameters:
It print out like this:
looks like
ldcis already equal tom.martin-frbg commentedon Nov 18, 2016
Hm, strange. The coding in interface/gemm.c looks pretty much straightforward to me, the error message is generated before any significant computation or even shuffling of parameters has taken place. Also no other function called from there is even capable of generating this error message, and as it happens in generic code the problem would appear to affect all platforms - unless there is some memory corruption affecting the parameters "seen" by gemm.c.
Can you check if the same problem happens on other architectures (e.g. x86) as well, or provide a
standalone program that reproduces the error ? (Alternatively, try adding a printf statement before the
check(s) in interface/gemm.c that result in "info" being set to 13 and rebuild OpenBLAS to see what passes for m and ldc there. At the very least that should tell if your code actually calls the openblas sgemm function or if it picks up some other local implementation on your system by mistake)
fengshikun commentedon Nov 19, 2016
@martin-frbg , thanks for your reply, i add such piece code to interface/gemm.c
Then strange thing happens, it print out like this:
I don't know why the parameters value changed when they were passed to gemm.c.
ashwinyes commentedon Nov 19, 2016
This basically looks like stack corruption.
Which processor are you running this on? And can you print the values of all 14 arguments to SGEMM?
brada4 commentedon Nov 21, 2016
WHat netlib blas says about your call?
brada4 commentedon Nov 25, 2016
Looks like calling convention issue. Can you capture crash in gdb? (then t a a bt to get all backtraces)
martin-frbg commentedon Dec 21, 2016
@fengshikun did you manage to solve this ?
martin-frbg commentedon Apr 5, 2017
@fengshikun any updates on this ? Without more information it is not even clear if this is an OpenBLAS issue at all, so I am inclined to close this ticket.
martin-frbg commentedon Sep 29, 2017
Closing as the related mxnet issue has been closed as well for lack of feedback. Please reopen if and when there is more information available.
kyou2000 commentedon Oct 30, 2024
I have same problem, it is "On entry to SGEMM parameter number 10 had an illegal value", my m,n,k dim is 2,2,3. but when I set it to same dim, it will not cause this error, I need to calculate matrices of different shapes. How to fix it.
martin-frbg commentedon Oct 30, 2024
See the definition of SGEMM in e.g. the Reference BLAS https://netlib.org/lapack/explore-html-3.6.1/db/dc9/group__single__blas__level3_gafe51bacb54592ff5de056acabd83c260.html or the Intel MKL - "parameter number 10" is
ldb, the first ("leading") dimension of your arrayb, which must be at least as large as 'k' (or as large as 'n' if you are using the transpose ofb)(I'm sure it would help if these functions would provide a clearer error message, but the standard was established over 40 years ago when computer hardware was quite different from today)