52 int *eb_sel,
int *ch_sel,
int *nw_sel,
int *tw_sel);
59 int *eb_sel,
int *ch_sel,
int *nw_sel,
int *tw_sel);
63 void *
dx,
void *
dy,
void *
dz,
void *
h1,
66 int *eb_sel,
int *nw_sel,
int *tw_sel,
71 void *
dx,
void *
dy,
void *
dz,
void *
h1,
74 int *eb_sel,
int *nw_sel,
int *tw_sel,
87 static int autotune[17] = { 0 };
90 static int autotune_eb[17] = { 0 };
92 static int autotune_ch[17] = { 0 };
94 static int autotune_nw[17] = { 0 };
96 static int autotune_tw[17] = { 0 };
98 const dim3 nblcks_1d((*
nelv), 1, 1);
101#define CASE_1D(LX, C) \
102 ax_helm_kernel_1d<real, LX, NEKO_CHUNKS(LX, C)> \
103 <<<nblcks_1d, NEKO_CHUNKS_NTHRDS(LX, C), 0, stream>>> \
104 ((real *) w, (real *) u, \
105 (real *) dx, (real *) dy, (real *) dz, \
106 (real *) dxt, (real *) dyt, (real *) dzt, (real *) h1,\
107 (real *) g11, (real *) g22, (real *) g33, \
108 (real *) g12, (real *) g13, (real *) g23); \
109 CUDA_CHECK(cudaGetLastError());
112#define CASE_1D_SEL(LX, SEL) \
114 case 0: CASE_1D(LX, 0); break; \
115 case 1: CASE_1D(LX, 1); break; \
116 case 2: CASE_1D(LX, 2); break; \
117 default: CASE_1D(LX, 3); break; \
120#define CASE_KSTEP(LX, C) \
121 ax_helm_kernel_kstep<real, LX, NEKO_EB(LX, C)> \
122 <<<NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, stream>>> \
123 ((real *) w, (real *) u, \
124 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
125 (real *) g11, (real *) g22, (real *) g33, \
126 (real *) g12, (real *) g13, (real *) g23, *nelv); \
127 CUDA_CHECK(cudaGetLastError());
129#define CASE_KSTEP_PADDED(LX, C) \
130 ax_helm_kernel_kstep_padded<real, LX, NEKO_EB(LX, C)> \
131 <<<NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, stream>>> \
132 ((real *) w, (real *) u, \
133 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
134 (real *) g11, (real *) g22, (real *) g33, \
135 (real *) g12, (real *) g13, (real *) g23, *nelv); \
136 CUDA_CHECK(cudaGetLastError());
139#define CASE_KSTEP_SEL(LX, SEL) \
141 case 0: CASE_KSTEP(LX, 0); break; \
142 case 1: CASE_KSTEP(LX, 1); break; \
143 default: CASE_KSTEP(LX, 2); break; \
146#define CASE_KSTEP_PADDED_SEL(LX, SEL) \
148 case 0: CASE_KSTEP_PADDED(LX, 0); break; \
149 case 1: CASE_KSTEP_PADDED(LX, 1); break; \
150 default: CASE_KSTEP_PADDED(LX, 2); break; \
153#define CASE_DMMA(LX, C) \
154 ax_helm_kernel_dmma<real, LX, NEKO_DMMA_NW(C)> \
155 <<<NEKO_DMMA_NBLCKS(*nelv, LX), NEKO_DMMA_NTHRDS(C), 0, stream>>> \
156 ((real *) w, (real *) u, \
157 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
158 (real *) g11, (real *) g22, (real *) g33, \
159 (real *) g12, (real *) g13, (real *) g23, *nelv); \
160 CUDA_CHECK(cudaGetLastError());
163#define CASE_DMMA_SEL(LX, SEL) \
165 case 0: CASE_DMMA(LX, 0); break; \
166 case 1: CASE_DMMA(LX, 1); break; \
167 default: CASE_DMMA(LX, 2); break; \
176#define CASE_DMMA_TMA(LX, C) \
177 ax_helm_kernel_dmma_tma<real, LX, NEKO_DMMA_NW(C)> \
178 <<<NEKO_DMMA_NBLCKS(*nelv, LX), NEKO_DMMA_NTHRDS(C), 0, stream>>> \
179 ((real *) w, (real *) u, \
180 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
181 (real *) g11, (real *) g22, (real *) g33, \
182 (real *) g12, (real *) g13, (real *) g23); \
183 CUDA_CHECK(cudaGetLastError());
186#define CASE_DMMA_TMA_SEL(LX, SEL) \
188 case 0: CASE_DMMA_TMA(LX, 0); break; \
189 case 1: CASE_DMMA_TMA(LX, 1); break; \
190 default: CASE_DMMA_TMA(LX, 2); break; \
195 if(autotune[LX] == 0 ) { \
196 autotune[LX]=tune<LX>( w, u, \
200 g12, g13, g23, nelv, lx, \
201 &autotune_eb[LX], &autotune_ch[LX], \
202 &autotune_nw[LX], &autotune_tw[LX]); \
203 } else if (autotune[LX] == 1 ) { \
204 CASE_1D_SEL(LX, autotune_ch[LX]); \
205 } else if (autotune[LX] == 2 ) { \
206 CASE_KSTEP_SEL(LX, autotune_eb[LX]); \
207 } else if (autotune[LX] == 3 ) { \
208 CASE_DMMA_SEL(LX, autotune_nw[LX]); \
209 } else if (autotune[LX] == 4 ) { \
210 CASE_DMMA_TMA_SEL(LX, autotune_tw[LX]); \
214#define CASE_PADDED(LX) \
216 if(autotune[LX] == 0 ) { \
217 autotune[LX]=tune_padded<LX>(w, u, \
221 g12, g13, g23,nelv,lx, \
222 &autotune_eb[LX], &autotune_ch[LX], \
223 &autotune_nw[LX], &autotune_tw[LX]); \
224 } else if (autotune[LX] == 1 ) { \
225 CASE_1D_SEL(LX, autotune_ch[LX]); \
226 } else if (autotune[LX] == 2 ) { \
227 CASE_KSTEP_PADDED_SEL(LX, autotune_eb[LX]); \
228 } else if (autotune[LX] == 3 ) { \
229 CASE_DMMA_SEL(LX, autotune_nw[LX]); \
230 } else if (autotune[LX] == 4 ) { \
231 CASE_DMMA_TMA_SEL(LX, autotune_tw[LX]); \
240#define CASE_LARGE(LX) \
245#define CASE_LARGE_PADDED(LX) \
247 CASE_KSTEP_PADDED(LX, 0); \
264 fprintf(stderr, __FILE__
": size not supported: %d\n", *lx);
278 fprintf(stderr, __FILE__
": size not supported: %d\n", *lx);
289 void *
u,
void *
v,
void *
w,
290 void *
dx,
void *
dy,
void *
dz,
294 void *
g23,
int *
nelv,
int *lx) {
297 static int autotune_vec[17] = { 0 };
299 static int autotune_vec_eb[17] = { 0 };
301 static int autotune_vec_nw[17] = { 0 };
303 static int autotune_vec_tw[17] = { 0 };
305 static int autotune_vec_bw[17] = { 0 };
307 const dim3 nblcks_dmma((*
nelv), 1, 1);
322#define CASE_VECTOR_KSTEP(LX, C) \
323 ax_helm_kernel_vector_kstep<real, LX, NEKO_EB(LX, C)> \
324 <<<NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, stream>>> \
325 ((real *) au, (real *) av, (real *) aw, \
326 (real *) u, (real *) v, (real *) w, \
327 (real *) dx, (real *) dy, (real *) dz, \
328 (real *) h1, (real *) g11, (real *) g22, \
329 (real *) g33, (real *) g12, (real *) g13, \
330 (real *) g23, *nelv); \
331 CUDA_CHECK(cudaGetLastError());
333#define CASE_VECTOR_KSTEP_PADDED(LX, C) \
334 ax_helm_kernel_vector_kstep_padded<real, LX, NEKO_EB(LX, C)> \
335 <<<NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, stream>>> \
336 ((real *) au, (real *) av, (real *) aw, \
337 (real *) u, (real *) v, (real *) w, \
338 (real *) dx, (real *) dy, (real *) dz, \
339 (real *) h1, (real *) g11, (real *) g22, \
340 (real *) g33, (real *) g12, (real *) g13, \
341 (real *) g23, *nelv); \
342 CUDA_CHECK(cudaGetLastError());
345#define CASE_VECTOR_KSTEP_SEL(LX, SEL) \
347 case 0: CASE_VECTOR_KSTEP(LX, 0); break; \
348 case 1: CASE_VECTOR_KSTEP(LX, 1); break; \
349 default: CASE_VECTOR_KSTEP(LX, 2); break; \
352#define CASE_VECTOR_KSTEP_PADDED_SEL(LX, SEL) \
354 case 0: CASE_VECTOR_KSTEP_PADDED(LX, 0); break; \
355 case 1: CASE_VECTOR_KSTEP_PADDED(LX, 1); break; \
356 default: CASE_VECTOR_KSTEP_PADDED(LX, 2); break; \
359#define CASE_VECTOR_DMMA(LX, C) \
360 ax_helm_kernel_dmma_vector<real, LX, NEKO_DMMA_NW(C)> \
361 <<<nblcks_dmma, NEKO_DMMA_NTHRDS(C), 0, stream>>> \
362 ((real *) au, (real *) av, (real *) aw, \
363 (real *) u, (real *) v, (real *) w, \
364 (real *) dx, (real *) dy, (real *) dz, \
365 (real *) h1, (real *) g11, (real *) g22, \
366 (real *) g33, (real *) g12, (real *) g13, \
368 CUDA_CHECK(cudaGetLastError());
371#define CASE_VECTOR_DMMA_SEL(LX, SEL) \
373 case 0: CASE_VECTOR_DMMA(LX, 0); break; \
374 case 1: CASE_VECTOR_DMMA(LX, 1); break; \
375 default: CASE_VECTOR_DMMA(LX, 2); break; \
380#define CASE_VECTOR_DMMA_TMA(LX, C) \
381 ax_helm_kernel_dmma_tma_vector<real, LX, NEKO_DMMA_NW(C)> \
382 <<<nblcks_dmma, NEKO_DMMA_NTHRDS(C), 0, stream>>> \
383 ((real *) au, (real *) av, (real *) aw, \
384 (real *) u, (real *) v, (real *) w, \
385 (real *) dx, (real *) dy, (real *) dz, \
386 (real *) h1, (real *) g11, (real *) g22, \
387 (real *) g33, (real *) g12, (real *) g13, \
389 CUDA_CHECK(cudaGetLastError());
392#define CASE_VECTOR_DMMA_TMA_SEL(LX, SEL) \
394 case 0: CASE_VECTOR_DMMA_TMA(LX, 0); break; \
395 case 1: CASE_VECTOR_DMMA_TMA(LX, 1); break; \
396 default: CASE_VECTOR_DMMA_TMA(LX, 2); break; \
405#define CASE_VECTOR_DMMA_TMA_BATCH(LX, C) \
406 (void) ax_helm_dmma_tma_batch_optin<real, LX, NEKO_DMMA_NW(C)>(); \
407 ax_helm_kernel_dmma_tma_batch<real, LX, NEKO_DMMA_NW(C)> \
408 <<<nblcks_dmma, NEKO_DMMA_NTHRDS(C), \
409 NEKO_DMMA_TMA_BATCH_SMEM, stream>>> \
410 ((real *) au, (real *) av, (real *) aw, \
411 (real *) u, (real *) v, (real *) w, \
412 (real *) dx, (real *) dy, (real *) dz, \
413 (real *) h1, (real *) g11, (real *) g22, \
414 (real *) g33, (real *) g12, (real *) g13, \
416 CUDA_CHECK(cudaGetLastError());
419#define CASE_VECTOR_DMMA_TMA_BATCH_SEL(LX, SEL) \
421 case 0: CASE_VECTOR_DMMA_TMA_BATCH(LX, 0); break; \
422 case 1: CASE_VECTOR_DMMA_TMA_BATCH(LX, 1); break; \
423 default: CASE_VECTOR_DMMA_TMA_BATCH(LX, 2); break; \
426#define CASE_VECTOR(LX) \
428 if (autotune_vec[LX] == 0 ) { \
429 autotune_vec[LX] = tune_vector<LX>(au, av, aw, u, v, w, \
431 g11, g22, g33, g12, g13, g23, \
432 nelv, lx, &autotune_vec_eb[LX], \
433 &autotune_vec_nw[LX], \
434 &autotune_vec_tw[LX], \
435 &autotune_vec_bw[LX]); \
436 } else if (autotune_vec[LX] == 2 ) { \
437 CASE_VECTOR_KSTEP_SEL(LX, autotune_vec_eb[LX]); \
438 } else if (autotune_vec[LX] == 3 ) { \
439 CASE_VECTOR_DMMA_SEL(LX, autotune_vec_nw[LX]); \
440 } else if (autotune_vec[LX] == 4 ) { \
441 CASE_VECTOR_DMMA_TMA_SEL(LX, autotune_vec_tw[LX]); \
442 } else if (autotune_vec[LX] == 5 ) { \
443 CASE_VECTOR_DMMA_TMA_BATCH_SEL(LX, autotune_vec_bw[LX]); \
447#define CASE_VECTOR_PADDED(LX) \
449 if (autotune_vec[LX] == 0 ) { \
450 autotune_vec[LX] = tune_vector_padded<LX>(au, av, aw, u, v, w, \
455 &autotune_vec_eb[LX], \
456 &autotune_vec_nw[LX], \
457 &autotune_vec_tw[LX], \
458 &autotune_vec_bw[LX]); \
459 } else if (autotune_vec[LX] == 2 ) { \
460 CASE_VECTOR_KSTEP_PADDED_SEL(LX, autotune_vec_eb[LX]); \
461 } else if (autotune_vec[LX] == 3 ) { \
462 CASE_VECTOR_DMMA_SEL(LX, autotune_vec_nw[LX]); \
463 } else if (autotune_vec[LX] == 4 ) { \
464 CASE_VECTOR_DMMA_TMA_SEL(LX, autotune_vec_tw[LX]); \
465 } else if (autotune_vec[LX] == 5 ) { \
466 CASE_VECTOR_DMMA_TMA_BATCH_SEL(LX, autotune_vec_bw[LX]); \
488 fprintf(stderr, __FILE__
": size not supported: %d\n", *lx);
498 void *
u,
void *
v,
void *
w,
499 void *h2,
void *B,
int *n) {
501 const dim3 nthrds(1024, 1, 1);
502 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
512template < const
int LX >
517 int *eb_sel,
int *ch_sel,
int *nw_sel,
int *tw_sel) {
518 cudaEvent_t start,stop;
558 const dim3 nblcks_1d((*
nelv), 1, 1);
561 char *env_value = NULL;
562 char neko_log_buf[80];
564 env_value=getenv(
"NEKO_AUTOTUNE");
566 sprintf(neko_log_buf,
"Autotune Ax helm (lx: %d)", *lx);
582 if( !strcmp(env_value,
"1D") ) {
584 }
else if( !strcmp(env_value,
"KSTEP") ) {
586 }
else if( !strcmp(env_value,
"DMMA") ) {
590 sprintf(neko_log_buf,
"DMMA strategy not available for this config");
593 }
else if( !strcmp(env_value,
"DMMA_TMA") ) {
597 sprintf(neko_log_buf,
598 "DMMA_TMA strategy not available for this config");
602 sprintf(neko_log_buf,
"Invalid value set for NEKO_AUTOTUNE");
610 const int pin = (strat == 1) ? ch_pin : (strat == 2) ? eb_pin :
611 (strat == 3) ? nw_pin : (strat == 4) ? tw_pin : -1;
618 sprintf(neko_log_buf,
"Set by env : 1 (1D, %d chunk)",
624 sprintf(neko_log_buf,
"Set by env : 2 (KSTEP, %d elem/block)",
630 sprintf(neko_log_buf,
"Set by env : 3 (DMMA, %d warps)",
636 sprintf(neko_log_buf,
"Set by env : 4 (DMMA_TMA, %d warps)",
646 sprintf(neko_log_buf,
"Set by env : %d (%s)", strat, env_value);
651 const bool try_1d = (strat == 0 || strat == 1);
652 const bool try_kstep = (strat == 0 || strat == 2);
653 const bool try_dmma = dmma && (strat == 0 || strat == 3);
654 const bool try_tma = tma && (strat == 0 || strat == 4);
656 cudaEventCreate(&start);
657 cudaEventCreate(&stop);
679 for (
int r = 0; r < rounds; r++) {
707 if (time1[best1] < time2[best]) {
715 float tbest = (retval == 1) ? time1[best1] : time2[best];
717 if (time3[best3] < tbest) {
719 tbest = time3[best3];
721 if (time4[best4] < tbest) {
725 cudaEventDestroy(start);
726 cudaEventDestroy(stop);
732 }
else if (retval == 2) {
734 }
else if (retval == 3) {
741 sprintf(neko_log_buf,
"Chose : 1 (1D, %d chunk)",
743 }
else if (retval == 2) {
744 sprintf(neko_log_buf,
"Chose : 2 (KSTEP, %d elem/block)",
746 }
else if (retval == 3) {
747 sprintf(neko_log_buf,
"Chose : 3 (DMMA, %d warps, %d elem/blk)",
750 sprintf(neko_log_buf,
"Chose : 4 (DMMA_TMA, %d warps)",
758template < const
int LX >
763 int *eb_sel,
int *ch_sel,
int *nw_sel,
int *tw_sel) {
764 cudaEvent_t start, stop;
803 const dim3 nblcks_1d((*
nelv), 1, 1);
806 char *env_value = NULL;
807 char neko_log_buf[80];
809 env_value=getenv(
"NEKO_AUTOTUNE");
811 sprintf(neko_log_buf,
"Autotune Ax helm (lx: %d)", *lx);
821 if( !strcmp(env_value,
"1D") ) {
823 }
else if( !strcmp(env_value,
"KSTEP") ) {
825 }
else if( !strcmp(env_value,
"DMMA") ) {
829 sprintf(neko_log_buf,
"DMMA strategy not available for this config");
832 }
else if( !strcmp(env_value,
"DMMA_TMA") ) {
836 sprintf(neko_log_buf,
837 "DMMA_TMA strategy not available for this config");
841 sprintf(neko_log_buf,
"Invalid value set for NEKO_AUTOTUNE");
847 const int pin = (strat == 1) ? ch_pin : (strat == 2) ? eb_pin :
848 (strat == 3) ? nw_pin : (strat == 4) ? tw_pin : -1;
855 sprintf(neko_log_buf,
"Set by env : 1 (1D, %d chunk)",
861 sprintf(neko_log_buf,
"Set by env : 2 (KSTEP, %d elem/block)",
867 sprintf(neko_log_buf,
"Set by env : 3 (DMMA, %d warps)",
873 sprintf(neko_log_buf,
"Set by env : 4 (DMMA_TMA, %d warps)",
883 sprintf(neko_log_buf,
"Set by env : %d (%s)", strat, env_value);
888 const bool try_1d = (strat == 0 || strat == 1);
889 const bool try_kstep = (strat == 0 || strat == 2);
890 const bool try_dmma = dmma && (strat == 0 || strat == 3);
891 const bool try_tma = tma && (strat == 0 || strat == 4);
893 cudaEventCreate(&start);
894 cudaEventCreate(&stop);
916 for (
int r = 0; r < rounds; r++) {
944 if (time1[best1] < time2[best]) {
952 float tbest = (retval == 1) ? time1[best1] : time2[best];
954 if (time3[best3] < tbest) {
956 tbest = time3[best3];
958 if (time4[best4] < tbest) {
962 cudaEventDestroy(start);
963 cudaEventDestroy(stop);
968 }
else if (retval == 2) {
970 }
else if (retval == 3) {
977 sprintf(neko_log_buf,
"Chose : 1 (1D, %d chunk)",
979 }
else if (retval == 2) {
980 sprintf(neko_log_buf,
"Chose : 2 (KSTEP, %d elem/block)",
982 }
else if (retval == 3) {
983 sprintf(neko_log_buf,
"Chose : 3 (DMMA, %d warps, %d elem/blk)",
986 sprintf(neko_log_buf,
"Chose : 4 (DMMA_TMA, %d warps)",
1010template < const
int LX >
1012 void *
dx,
void *
dy,
void *
dz,
void *
h1,
1015 int *eb_sel,
int *nw_sel,
int *tw_sel,
1017 cudaEvent_t start, stop;
1059 const dim3 nblcks_dmma((*
nelv), 1, 1);
1062 char *env_value = NULL;
1063 char neko_log_buf[80];
1065 env_value=getenv(
"NEKO_AUTOTUNE");
1067 sprintf(neko_log_buf,
"Autotune Ax vector (lx: %d)", *lx);
1077 if( !strcmp(env_value,
"KSTEP") || !strcmp(env_value,
"1D") ) {
1080 }
else if( !strcmp(env_value,
"DMMA") ) {
1084 sprintf(neko_log_buf,
"DMMA strategy not available for this config");
1087 }
else if( !strcmp(env_value,
"DMMA_TMA") ) {
1091 sprintf(neko_log_buf,
1092 "DMMA_TMA strategy not available for this config");
1095 }
else if( !strcmp(env_value,
"DMMA_TMA_BATCH") ) {
1099 sprintf(neko_log_buf,
1100 "DMMA_TMA_BATCH strategy not available for this config");
1104 sprintf(neko_log_buf,
"Invalid value set for NEKO_AUTOTUNE");
1111 const int pin = (strat == 2) ? eb_pin : (strat == 3) ? nw_pin :
1112 (strat == 4 || strat == 5) ? tw_pin : -1;
1119 sprintf(neko_log_buf,
"Set by env : 2 (KSTEP, %d elem/block)",
1125 sprintf(neko_log_buf,
"Set by env : 3 (DMMA, %d warps)",
1131 sprintf(neko_log_buf,
"Set by env : 4 (DMMA_TMA, %d warps)",
1137 sprintf(neko_log_buf,
"Set by env : 5 (DMMA_TMA_BATCH, %d warps)",
1147 sprintf(neko_log_buf,
"Set by env : %d (%s)", strat, env_value);
1152 const bool try_kstep = (strat == 0 || strat == 2);
1153 const bool try_dmma = dmma && (strat == 0 || strat == 3);
1154 const bool try_tma = tma && (strat == 0 || strat == 4);
1155 const bool try_batch = batch && (strat == 0 || strat == 5);
1157 cudaEventCreate(&start);
1158 cudaEventCreate(&stop);
1176 for (
int r = 0; r < rounds; r++) {
1193 sprintf(neko_log_buf,
"KSTEP eb=%-4d: %9.2f us/call",
1212 float tbest = time2[best2];
1215 if (time3[best3] < tbest) { retval = 3; tbest = time3[best3]; }
1216 if (time4[best4] < tbest) { retval = 4; tbest = time4[best4]; }
1217 if (time5[best5] < tbest) { retval = 5; }
1219 cudaEventDestroy(start);
1220 cudaEventDestroy(stop);
1227 sprintf(neko_log_buf,
"Chose : 2 (KSTEP, %d elem/block)",
1229 }
else if (retval == 3) {
1231 sprintf(neko_log_buf,
"Chose : 3 (DMMA, %d warps, %d elem/blk)",
1233 }
else if (retval == 4) {
1235 sprintf(neko_log_buf,
"Chose : 4 (DMMA_TMA, %d warps)",
1239 sprintf(neko_log_buf,
"Chose : 5 (DMMA_TMA_BATCH, %d warps)",
1248template < const
int LX >
1250 void *
dx,
void *
dy,
void *
dz,
void *
h1,
1253 int *eb_sel,
int *nw_sel,
int *tw_sel,
1255 cudaEvent_t start, stop;
1297 const dim3 nblcks_dmma((*
nelv), 1, 1);
1300 char *env_value = NULL;
1301 char neko_log_buf[80];
1303 env_value=getenv(
"NEKO_AUTOTUNE");
1305 sprintf(neko_log_buf,
"Autotune Ax vector (lx: %d)", *lx);
1315 if( !strcmp(env_value,
"KSTEP") || !strcmp(env_value,
"1D") ) {
1318 }
else if( !strcmp(env_value,
"DMMA") ) {
1322 sprintf(neko_log_buf,
"DMMA strategy not available for this config");
1325 }
else if( !strcmp(env_value,
"DMMA_TMA") ) {
1329 sprintf(neko_log_buf,
1330 "DMMA_TMA strategy not available for this config");
1333 }
else if( !strcmp(env_value,
"DMMA_TMA_BATCH") ) {
1337 sprintf(neko_log_buf,
1338 "DMMA_TMA_BATCH strategy not available for this config");
1342 sprintf(neko_log_buf,
"Invalid value set for NEKO_AUTOTUNE");
1349 const int pin = (strat == 2) ? eb_pin : (strat == 3) ? nw_pin :
1350 (strat == 4 || strat == 5) ? tw_pin : -1;
1357 sprintf(neko_log_buf,
"Set by env : 2 (KSTEP, %d elem/block)",
1363 sprintf(neko_log_buf,
"Set by env : 3 (DMMA, %d warps)",
1369 sprintf(neko_log_buf,
"Set by env : 4 (DMMA_TMA, %d warps)",
1375 sprintf(neko_log_buf,
"Set by env : 5 (DMMA_TMA_BATCH, %d warps)",
1385 sprintf(neko_log_buf,
"Set by env : %d (%s)", strat, env_value);
1390 const bool try_kstep = (strat == 0 || strat == 2);
1391 const bool try_dmma = dmma && (strat == 0 || strat == 3);
1392 const bool try_tma = tma && (strat == 0 || strat == 4);
1393 const bool try_batch = batch && (strat == 0 || strat == 5);
1395 cudaEventCreate(&start);
1396 cudaEventCreate(&stop);
1414 for (
int r = 0; r < rounds; r++) {
1431 sprintf(neko_log_buf,
"KSTEP eb=%-4d: %9.2f us/call",
1450 float tbest = time2[best2];
1453 if (time3[best3] < tbest) { retval = 3; tbest = time3[best3]; }
1454 if (time4[best4] < tbest) { retval = 4; tbest = time4[best4]; }
1455 if (time5[best5] < tbest) { retval = 5; }
1457 cudaEventDestroy(start);
1458 cudaEventDestroy(stop);
1463 sprintf(neko_log_buf,
"Chose : 2 (KSTEP, %d elem/block)",
1465 }
else if (retval == 3) {
1467 sprintf(neko_log_buf,
"Chose : 3 (DMMA, %d warps, %d elem/blk)",
1469 }
else if (retval == 4) {
1471 sprintf(neko_log_buf,
"Chose : 4 (DMMA_TMA, %d warps)",
1475 sprintf(neko_log_buf,
"Chose : 5 (DMMA_TMA_BATCH, %d warps)",
#define CASE_DMMA_SEL(LX, SEL)
#define CASE_KSTEP_SEL(LX, SEL)
void cuda_ax_helm_vector_part2(void *au, void *av, void *aw, void *u, void *v, void *w, void *h2, void *B, int *n)
#define CASE_1D_SEL(LX, SEL)
int tune_vector(void *au, void *av, void *aw, void *u, void *v, void *w, void *dx, void *dy, void *dz, void *h1, void *g11, void *g22, void *g33, void *g12, void *g13, void *g23, int *nelv, int *lx, int *eb_sel, int *nw_sel, int *tw_sel, int *bw_sel)
void cuda_ax_helm(void *w, void *u, void *dx, void *dy, void *dz, void *dxt, void *dyt, void *dzt, void *h1, void *g11, void *g22, void *g33, void *g12, void *g13, void *g23, int *nelv, int *lx)
int tune_padded(void *w, void *u, void *dx, void *dy, void *dz, void *dxt, void *dyt, void *dzt, void *h1, void *g11, void *g22, void *g33, void *g12, void *g13, void *g23, int *nelv, int *lx, int *eb_sel, int *ch_sel, int *nw_sel, int *tw_sel)
void cuda_ax_helm_vector(void *au, void *av, void *aw, void *u, void *v, void *w, void *dx, void *dy, void *dz, void *dxt, void *dyt, void *dzt, void *h1, void *g11, void *g22, void *g33, void *g12, void *g13, void *g23, int *nelv, int *lx)
#define CASE_KSTEP_PADDED_SEL(LX, SEL)
#define CASE_DMMA_TMA_SEL(LX, SEL)
#define CASE_LARGE_PADDED(LX)
#define CASE_VECTOR_DMMA_TMA_SEL(LX, SEL)
int tune(void *w, void *u, void *dx, void *dy, void *dz, void *dxt, void *dyt, void *dzt, void *h1, void *g11, void *g22, void *g33, void *g12, void *g13, void *g23, int *nelv, int *lx, int *eb_sel, int *ch_sel, int *nw_sel, int *tw_sel)
#define CASE_VECTOR_KSTEP_SEL(LX, SEL)
#define CASE_VECTOR_PADDED(LX)
#define CASE_VECTOR_KSTEP_PADDED_SEL(LX, SEL)
#define CASE_VECTOR_DMMA_TMA_BATCH_SEL(LX, SEL)
#define CASE_VECTOR_DMMA_SEL(LX, SEL)
int tune_vector_padded(void *au, void *av, void *aw, void *u, void *v, void *w, void *dx, void *dy, void *dz, void *h1, void *g11, void *g22, void *g33, void *g12, void *g13, void *g23, int *nelv, int *lx, int *eb_sel, int *nw_sel, int *tw_sel, int *bw_sel)
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ g23
__global__ void T *__restrict__ T *__restrict__ aw
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ g22
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ g13
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const int *__restrict__ const int nelv
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ g12
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dz
__global__ void const T *__restrict__ const T *__restrict__ dx
__global__ void const T *__restrict__ u
__global__ void T *__restrict__ av
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ dy
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ g33
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ v
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ g11
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ h1
__global__ void ax_helm_kernel_vector_part2(T *__restrict__ au, T *__restrict__ av, T *__restrict__ aw, const T *__restrict__ u, const T *__restrict__ v, const T *__restrict__ w, const T *__restrict__ h2, const T *__restrict__ B, const int n)
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dyt
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dzt
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dxt
#define NEKO_CHUNKS_CANDIDATES
#define NEKO_EB_CANDIDATES
#define NEKO_EB_SEL(LX, SEL)
#define NEKO_CHUNKS_SEL(LX, SEL)
static int neko_chunks_pin()
#define NEKO_TUNE_TIME(T, LAUNCH, LX, C, ITERS)
#define NEKO_TUNE_US(T, ITERS)
static int neko_tune_rounds()
#define NEKO_TUNE_LOG(LX, T1, T2)
#define NEKO_TUNE_BEST(T, BEST, N)
static int neko_tune_iters()
#define NEKO_TUNE_FOR(C, ON, PIN, N)
static int neko_eb_sweep()
#define NEKO_DMMA_CANDIDATES
static bool dmma_vector_lx_supported()
static bool cuda_have_dmma()
#define NEKO_DMMA_PACK(LX)
static bool dmma_lx_supported()
#define NEKO_TUNE_LOG_DMMA(LX, T3)
static int neko_dmma_pin()
#define NEKO_TUNE_LOG_DMMA_TMA_BATCH(LX, T5)
static bool dmma_tma_aligned(const void *w, const void *u, const void *h1, const void *g11, const void *g22, const void *g33, const void *g12, const void *g13, const void *g23)
static bool dmma_tma_vector_aligned(const void *au, const void *av, const void *aw, const void *u, const void *v, const void *w, const void *h1, const void *g11, const void *g22, const void *g33, const void *g12, const void *g13, const void *g23)
static bool cuda_have_tma_batch()
static bool dmma_tma_batch_lx_supported()
#define NEKO_TUNE_LOG_DMMA_TMA(LX, T4)
static bool dmma_tma_vector_lx_supported()
static bool dmma_tma_lx_supported()
static int neko_dmma_tma_pin()
static bool cuda_have_tma()
void log_error(char *msg)
void log_message(char *msg)
void log_section(char *msg)