Skip to content

Commit fd9fd42

Browse files
committed
Refs OpenMathLib#478, OpenMathLib#482. Fixed bug on previous commit.
1 parent 9798481 commit fd9fd42

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

interface/gemv.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void CNAME(enum CBLAS_ORDER order,
189189
}
190190

191191
#endif
192-
192+
//printf("m=%d, n=%d, trans=%d, incx=%d, incy=%d, alpha=%f, beta=%f\n", m, n, trans, incx, incy, alpha, beta);
193193
if ((m==0) || (n==0)) return;
194194

195195
lenx = n;
@@ -213,20 +213,21 @@ void CNAME(enum CBLAS_ORDER order,
213213
// do not restore all register
214214
volatile int stack_alloc_size = 0;
215215
if (trans == 0) {
216+
//for gemv_n, try to allocate on stack
217+
//for gemv_t, use malloc
218+
216219
stack_alloc_size = m + n;
217220
if(stack_alloc_size < 128)
218221
//dgemv_n.S require a 128 bytes buffer
219222
stack_alloc_size = 128;
220223

221224
if(stack_alloc_size > MAX_STACK_ALLOC / sizeof(FLOAT))
222225
stack_alloc_size = 0;
223-
FLOAT stack_buffer[stack_alloc_size];
224-
buffer = stack_alloc_size ? stack_buffer : (FLOAT *)blas_memory_alloc_nolock(1);
225-
226-
}else{
227-
//for gemv_t, only malloc
228-
buffer = (FLOAT *)blas_memory_alloc_nolock(1);
229226
}
227+
228+
FLOAT stack_buffer[stack_alloc_size];
229+
buffer = stack_alloc_size ? stack_buffer : (FLOAT *)blas_memory_alloc_nolock(1);
230+
// printf("stack_alloc_size=%d\n", stack_alloc_size);
230231
#else
231232
//Original OpenBLAS/GotoBLAS codes.
232233
buffer = (FLOAT *)blas_memory_alloc(1);

0 commit comments

Comments
 (0)