Refs #478,#482, Enable stack alloc for s/dgemv_t.(revert 9798491)

This commit is contained in:
Zhang Xianyi 2015-04-20 23:22:40 -05:00
parent 9da555e5f7
commit 847e19c04e
1 changed files with 9 additions and 13 deletions

View File

@ -212,21 +212,17 @@ void CNAME(enum CBLAS_ORDER order,
// make it volatile because some gemv implementation (ex: dgemv_n.S) // make it volatile because some gemv implementation (ex: dgemv_n.S)
// do not restore all register // do not restore all register
volatile int stack_alloc_size = 0; volatile int stack_alloc_size = 0;
if (trans == 0) { //for gemv_n and gemv_t, try to allocate on stack
//for gemv_n, try to allocate on stack stack_alloc_size = m + n;
//for gemv_t, use malloc if(stack_alloc_size < 128)
//dgemv_n.S require a 128 bytes buffer
stack_alloc_size = 128;
stack_alloc_size = m + n; if(stack_alloc_size > MAX_STACK_ALLOC / sizeof(FLOAT))
if(stack_alloc_size < 128) stack_alloc_size = 0;
//dgemv_n.S require a 128 bytes buffer
stack_alloc_size = 128;
if(stack_alloc_size > MAX_STACK_ALLOC / sizeof(FLOAT))
stack_alloc_size = 0;
}
FLOAT stack_buffer[stack_alloc_size]; FLOAT stack_buffer[stack_alloc_size];
buffer = stack_alloc_size ? stack_buffer : (FLOAT *)blas_memory_alloc_nolock(1); buffer = stack_alloc_size ? stack_buffer : (FLOAT *)blas_memory_alloc(1);
// printf("stack_alloc_size=%d\n", stack_alloc_size); // printf("stack_alloc_size=%d\n", stack_alloc_size);
#else #else
//Original OpenBLAS/GotoBLAS codes. //Original OpenBLAS/GotoBLAS codes.
@ -262,7 +258,7 @@ void CNAME(enum CBLAS_ORDER order,
#ifdef MAX_STACK_ALLOC #ifdef MAX_STACK_ALLOC
if(!stack_alloc_size){ if(!stack_alloc_size){
blas_memory_free_nolock(buffer); blas_memory_free(buffer);
} }
#else #else
blas_memory_free(buffer); blas_memory_free(buffer);