#endif
#ifndef ASSEMBLER
-#if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_IA64)
+#if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_IA64) || defined(ARCH_MIPS64)
+extern BLASLONG gemm_offset_a;
+extern BLASLONG gemm_offset_b;
extern BLASLONG sgemm_p;
extern BLASLONG sgemm_q;
extern BLASLONG sgemm_r;
blas_cpu_number = num_threads;
+#if defined(ARCH_MIPS64)
+ //set parameters for different number of threads.
+ blas_set_parameter();
+#endif
+
}
void openblas_set_num_threads(int num_threads) {
omp_set_num_threads(blas_cpu_number);
+#if defined(ARCH_MIPS64)
+ //set parameters for different number of threads.
+ blas_set_parameter();
+#endif
+
}
void openblas_set_num_threads(int num_threads) {
if (!blas_num_threads) blas_cpu_number = blas_get_cpu_number();
#endif
-#if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_IA64)
+#if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_IA64) || defined(ARCH_MIPS64)
#ifndef DYNAMIC_ARCH
blas_set_parameter();
#endif
#define DEFAULT_GEMM_P 128
#define DEFAULT_GEMM_Q 128
#define DEFAULT_GEMM_R 128
+#define DEFAULT_GEMM_OFFSET_A 0
+#define DEFAULT_GEMM_OFFSET_B 0
/* Global Parameter */
+#if GEMM_OFFSET_A == gemm_offset_a
+BLASLONG gemm_offset_a = DEFAULT_GEMM_OFFSET_A;
+#else
+BLASLONG gemm_offset_a = GEMM_OFFSET_A;
+#endif
+
+#if GEMM_OFFSET_B == gemm_offset_b
+BLASLONG gemm_offset_b = DEFAULT_GEMM_OFFSET_B;
+#else
+BLASLONG gemm_offset_b = GEMM_OFFSET_B;
+#endif
+
#if SGEMM_P == sgemm_p
BLASLONG sgemm_p = DEFAULT_GEMM_P;
#else
#endif
#endif
+
+#if defined(ARCH_MIPS64)
+void blas_set_parameter(void){
+#if defined(LOONGSON3A)
+ if(blas_num_threads == 1){
+ //single thread
+ dgemm_r = 1000;
+ }else{
+ //multi thread
+ dgemm_r = 300;
+ }
+#endif
+}
+#endif
//#define DGEMM_DEFAULT_R 200
//#define DGEMM_DEFAULT_R 400
//#define DGEMM_DEFAULT_R 192
-#define DGEMM_DEFAULT_R 1000
+#define DGEMM_DEFAULT_R dgemm_r
+//1000
//#define DGEMM_DEFAULT_R 160
//#define DGEMM_DEFAULT_R 270
#define CGEMM_DEFAULT_R 1000