Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions driver/level3/gemm_batch_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,45 @@ static int inner_small_matrix_thread(blas_arg_t *args, BLASLONG *range_m, BLASLO
int CNAME(blas_arg_t * args_array, BLASLONG nums){
XFLOAT *buffer;
XFLOAT *sa, *sb;
blasint info;
int nthreads=1;
int (*routine)(blas_arg_t *, void *, void *, XFLOAT *, XFLOAT *, BLASLONG);
int i=0, /*j,*/ current_nums;

#ifndef COMPLEX
#ifdef XDOUBLE
#define ERROR_NAME "QGEMM_BATCH "
#elif defined(DOUBLE)
#define ERROR_NAME "DGEMM_BATCH "
#elif defined(BFLOAT16)
#define ERROR_NAME "SBGEMM_BATCH "
#else
#define ERROR_NAME "SGEMM_BATCH "
#endif
#else
#ifdef XDOUBLE
#define ERROR_NAME "XGEMM_BATCH "
#elif defined(DOUBLE)
#define ERROR_NAME "ZGEMM_BATCH "
#else
#define ERROR_NAME "CGEMM_BATCH "
#endif
#endif


#ifdef SMP
blas_queue_t * queue=NULL;
#endif

if(nums <=0 ) return 0;

buffer = (XFLOAT *)blas_memory_alloc(0);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return(1);
}

sa = (XFLOAT *)((BLASLONG)buffer +GEMM_OFFSET_A);
sb = (XFLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);

Expand Down Expand Up @@ -119,6 +147,9 @@ int CNAME(blas_arg_t * args_array, BLASLONG nums){
queue=(blas_queue_t *)malloc((nums+1) * sizeof(blas_queue_t));
if(queue == NULL){
openblas_warning(0, "memory alloc failed!\n");
if (buffer) blas_memory_free(buffer);
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return(1);
}
for(i=0; i<nums; i++){
Expand Down
5 changes: 5 additions & 0 deletions interface/gbmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incy < 0) y -= (leny-1)*incy;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
if (m * n < 250000 || kl+ku < 15 )
Expand Down
5 changes: 5 additions & 0 deletions interface/gemm.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,11 @@ else
#endif

buffer = (XFLOAT *)blas_memory_alloc(0);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

//For LOONGARCH64, applying an offset to the buffer is essential
//for minimizing cache conflicts and optimizing performance.
Expand Down
5 changes: 5 additions & 0 deletions interface/sbmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incy < 0 ) y -= (n - 1) * incy;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMPTEST
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/spmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incy < 0 ) y -= (n - 1) * incy;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMPTEST
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/spr.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incx < 0 ) x -= (n - 1) * incx;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/spr2.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incy < 0 ) y -= (n - 1) * incy;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/symm.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ if (strcmp(gotoblas_corename(), "armv9sme") == 0
FUNCTION_PROFILE_START();

buffer = (FLOAT *)blas_memory_alloc(0);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
Expand Down
5 changes: 5 additions & 0 deletions interface/symv.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha,
if (incy < 0 ) y -= (n - 1) * incy;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
if (n <200)
Expand Down
5 changes: 5 additions & 0 deletions interface/syr.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha,
if (incx < 0 ) x -= (n - 1) * incx;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/syr2.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha,
if (incy < 0 ) y -= (n - 1) * incy;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/syr2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,11 @@ if (strcmp(gotoblas_corename(), "armv9sme") == 0
FUNCTION_PROFILE_START();

buffer = (FLOAT *)blas_memory_alloc(0);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
Expand Down
5 changes: 5 additions & 0 deletions interface/syrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ if (strcmp(gotoblas_corename(), "armv9sme") == 0
FUNCTION_PROFILE_START();

buffer = (FLOAT *)blas_memory_alloc(0);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
Expand Down
5 changes: 5 additions & 0 deletions interface/tbmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
if (incx < 0 ) x -= (n - 1) * incx;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/tbsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
if (incx < 0 ) x -= (n - 1) * incx;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

(tbsv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer);

Expand Down
5 changes: 5 additions & 0 deletions interface/tpmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
if (incx < 0 ) x -= (n - 1) * incx;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/tpsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
if (incx < 0 ) x -= (n - 1) * incx;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

(tpsv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer);

Expand Down
5 changes: 5 additions & 0 deletions interface/trmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
if (incx < 0 ) x -= (n - 1) * incx;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/trsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ if (strcmp(gotoblas_corename(), "armv9sme") == 0
FUNCTION_PROFILE_START();

buffer = (FLOAT *)blas_memory_alloc(0);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
Expand Down
5 changes: 5 additions & 0 deletions interface/trsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
if (incx < 0 ) x -= (n - 1) * incx;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

(trsv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer);

Expand Down
5 changes: 5 additions & 0 deletions interface/zgbmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incy < 0) y -= (leny - 1) * incy * 2;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
if (m * n < 125000 || ku + kl < 15)
Expand Down
5 changes: 5 additions & 0 deletions interface/zhbmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incy < 0 ) y -= (n - 1) * incy * COMPSIZE;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMPBUG
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/zhemv.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, void *VALPHA
if (incy < 0 ) y -= (n - 1) * incy * 2;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
if (n<MULTI_THREAD_MINIMAL) {
Expand Down
5 changes: 5 additions & 0 deletions interface/zher.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha,
if (incx < 0 ) x -= (n - 1) * incx * 2;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
if (n < 100)
Expand Down
5 changes: 5 additions & 0 deletions interface/zher2.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, void *VALPHA
if (incy < 0 ) y -= (n - 1) * incy * 2;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
if (n < 100)
Expand Down
5 changes: 5 additions & 0 deletions interface/zhpmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incy < 0 ) y -= (n - 1) * incy * 2;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
nthreads = num_cpu_avail(2);
Expand Down
5 changes: 5 additions & 0 deletions interface/zhpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incx < 0 ) x -= (n - 1) * incx * 2;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
if (n < 100)
Expand Down
5 changes: 5 additions & 0 deletions interface/zhpr2.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ void CNAME(enum CBLAS_ORDER order,
if (incy < 0 ) y -= (n - 1) * incy * 2;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMP
if (n < 100)
Expand Down
5 changes: 5 additions & 0 deletions interface/zsbmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *
if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE;

buffer = (FLOAT *)blas_memory_alloc(1);
if (!buffer) {
info = -999;
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}

#ifdef SMPTEST
nthreads = num_cpu_avail(2);
Expand Down
Loading
Loading