diff --git a/kernel/setparam-ref.c b/kernel/setparam-ref.c index a6959f2599..bc030a29ea 100644 --- a/kernel/setparam-ref.c +++ b/kernel/setparam-ref.c @@ -2206,7 +2206,32 @@ static void init_parameter(void) { #endif +int l3_kb = get_l3_size(); +unsigned int eax, ebx, ecx, edx; +cpuid(0, &eax, &ebx, &ecx, &edx); +if ((ebx == 0x68747541) && (l3_kb > 0) && (l3_kb % 32768 == 0)) { +#if BUILD_SINGLE == 1 + TABLE_NAME.sgemm_p = 384; + TABLE_NAME.sgemm_q = 512; + TABLE_NAME.sgemm_r = 5936; +#endif +#if BUILD_DOUBLE == 1 + TABLE_NAME.dgemm_p = 512; + TABLE_NAME.dgemm_q = 512; + TABLE_NAME.dgemm_r = 2288; +#endif +#if BUILD_COMPLEX == 1 + TABLE_NAME.cgemm_p = 160; + TABLE_NAME.cgemm_q = 480; + TABLE_NAME.cgemm_r = 528; +#endif +#if BUILD_COMPLEX16 == 1 + TABLE_NAME.zgemm_p = 176; + TABLE_NAME.zgemm_q = 256; + TABLE_NAME.zgemm_r = 1520; +#endif +} } #endif //RISCV64 diff --git a/param.h b/param.h index 8e7ab29f24..dc04de2b4e 100644 --- a/param.h +++ b/param.h @@ -1996,6 +1996,25 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #else +#if L3_SIZE > 0 && L3_SIZE % 33554432 == 0 + +#define SGEMM_DEFAULT_P 384 +#define DGEMM_DEFAULT_P 512 +#define CGEMM_DEFAULT_P 160 +#define ZGEMM_DEFAULT_P 176 + +#define SGEMM_DEFAULT_Q 512 +#define DGEMM_DEFAULT_Q 512 +#define CGEMM_DEFAULT_Q 480 +#define ZGEMM_DEFAULT_Q 256 + +#define SGEMM_DEFAULT_R 5936 +#define DGEMM_DEFAULT_R 2288 +#define CGEMM_DEFAULT_R 528 +#define ZGEMM_DEFAULT_R 1520 + +#else + #define SGEMM_DEFAULT_P 640 #define DGEMM_DEFAULT_P 192 #define CGEMM_DEFAULT_P 384 @@ -2011,6 +2030,8 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define CGEMM_DEFAULT_R cgemm_r #define ZGEMM_DEFAULT_R zgemm_r +#endif + #define QGEMM_DEFAULT_Q 128 #define QGEMM_DEFAULT_P 504 #define QGEMM_DEFAULT_R qgemm_r