85 void *
w,
void *
dx,
void *
dy,
void *
dz,
void *
h1,
100 void *
ind,
int *
nelv,
int *lx) {
116#define CASE_1D(LX, C) \
117 ax_helm_compr_kernel_1d<real, LX, NEKO_CHUNKS(LX, C)> \
118 <<<nblcks_1d, NEKO_CHUNKS_NTHRDS(LX, C), 0, stream>>> \
119 ((real *) w, (real *) u, \
120 (real *) dx, (real *) dy, (real *) dz, \
121 (real *) dxt, (real *) dyt, (real *) dzt, (real *) h1,\
122 (real *) g11, (real *) g22, (real *) g33, \
123 (real *) g12, (real *) g13, (real *) g23, \
124 (const int *) ind); \
125 CUDA_CHECK(cudaGetLastError());
128#define CASE_1D_SEL(LX, SEL) \
130 case 0: CASE_1D(LX, 0); break; \
131 case 1: CASE_1D(LX, 1); break; \
132 case 2: CASE_1D(LX, 2); break; \
133 default: CASE_1D(LX, 3); break; \
136#define CASE_KSTEP(LX, C) \
137 ax_helm_compr_kernel_kstep<real, LX, NEKO_EB(LX, C)> \
138 <<<NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, stream>>> \
139 ((real *) w, (real *) u, \
140 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
141 (real *) g11, (real *) g22, (real *) g33, \
142 (real *) g12, (real *) g13, (real *) g23, \
143 (const int *) ind, *nelv); \
144 CUDA_CHECK(cudaGetLastError());
146#define CASE_KSTEP_PADDED(LX, C) \
147 ax_helm_compr_kernel_kstep_padded<real, LX, NEKO_EB(LX, C)> \
148 <<<NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, stream>>> \
149 ((real *) w, (real *) u, \
150 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
151 (real *) g11, (real *) g22, (real *) g33, \
152 (real *) g12, (real *) g13, (real *) g23, \
153 (const int *) ind, *nelv); \
154 CUDA_CHECK(cudaGetLastError());
157#define CASE_KSTEP_SEL(LX, SEL) \
159 case 0: CASE_KSTEP(LX, 0); break; \
160 case 1: CASE_KSTEP(LX, 1); break; \
161 default: CASE_KSTEP(LX, 2); break; \
164#define CASE_KSTEP_PADDED_SEL(LX, SEL) \
166 case 0: CASE_KSTEP_PADDED(LX, 0); break; \
167 case 1: CASE_KSTEP_PADDED(LX, 1); break; \
168 default: CASE_KSTEP_PADDED(LX, 2); break; \
171#define CASE_DMMA(LX, C) \
172 ax_helm_compr_kernel_dmma<real, LX, NEKO_DMMA_NW(C)> \
173 <<<NEKO_DMMA_NBLCKS(*nelv, LX), NEKO_DMMA_NTHRDS(C), 0, stream>>> \
174 ((real *) w, (real *) u, \
175 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
176 (real *) g11, (real *) g22, (real *) g33, \
177 (real *) g12, (real *) g13, (real *) g23, \
178 (const int *) ind, *nelv); \
179 CUDA_CHECK(cudaGetLastError());
182#define CASE_DMMA_SEL(LX, SEL) \
184 case 0: CASE_DMMA(LX, 0); break; \
185 case 1: CASE_DMMA(LX, 1); break; \
186 default: CASE_DMMA(LX, 2); break; \
195#define CASE_DMMA_TMA(LX, C) \
196 ax_helm_compr_kernel_dmma_tma<real, LX, NEKO_DMMA_NW(C)> \
197 <<<NEKO_DMMA_NBLCKS(*nelv, LX), NEKO_DMMA_NTHRDS(C), 0, stream>>> \
198 ((real *) w, (real *) u, \
199 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
200 (real *) g11, (real *) g22, (real *) g33, \
201 (real *) g12, (real *) g13, (real *) g23, \
202 (const int *) ind); \
203 CUDA_CHECK(cudaGetLastError());
206#define CASE_DMMA_TMA_SEL(LX, SEL) \
208 case 0: CASE_DMMA_TMA(LX, 0); break; \
209 case 1: CASE_DMMA_TMA(LX, 1); break; \
210 default: CASE_DMMA_TMA(LX, 2); break; \
215 if(autotune[LX] == 0 ) { \
216 autotune[LX]=tune_compr<LX>( w, u, \
220 g12, g13, g23, ind, nelv, lx, \
221 &autotune_eb[LX], &autotune_ch[LX], \
222 &autotune_nw[LX], &autotune_tw[LX]); \
223 } else if (autotune[LX] == 1 ) { \
224 CASE_1D_SEL(LX, autotune_ch[LX]); \
225 } else if (autotune[LX] == 2 ) { \
226 CASE_KSTEP_SEL(LX, autotune_eb[LX]); \
227 } else if (autotune[LX] == 3 ) { \
228 CASE_DMMA_SEL(LX, autotune_nw[LX]); \
229 } else if (autotune[LX] == 4 ) { \
230 CASE_DMMA_TMA_SEL(LX, autotune_tw[LX]); \
234#define CASE_PADDED(LX) \
236 if(autotune[LX] == 0 ) { \
237 autotune[LX]=tune_compr_padded<LX>(w, u, \
241 g12, g13, g23, ind,nelv,lx, \
242 &autotune_eb[LX], &autotune_ch[LX], \
243 &autotune_nw[LX], &autotune_tw[LX]); \
244 } else if (autotune[LX] == 1 ) { \
245 CASE_1D_SEL(LX, autotune_ch[LX]); \
246 } else if (autotune[LX] == 2 ) { \
247 CASE_KSTEP_PADDED_SEL(LX, autotune_eb[LX]); \
248 } else if (autotune[LX] == 3 ) { \
249 CASE_DMMA_SEL(LX, autotune_nw[LX]); \
250 } else if (autotune[LX] == 4 ) { \
251 CASE_DMMA_TMA_SEL(LX, autotune_tw[LX]); \
260#define CASE_LARGE(LX) \
265#define CASE_LARGE_PADDED(LX) \
267 CASE_KSTEP_PADDED(LX, 0); \
310 void *
w,
void *
dx,
void *
dy,
void *
dz,
342#define CASE_VECTOR_KSTEP(LX, C) \
343 ax_helm_compr_kernel_vector_kstep<real, LX, NEKO_EB(LX, C)> \
344 <<<NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, stream>>> \
345 ((real *) au, (real *) av, (real *) aw, \
346 (real *) u, (real *) v, (real *) w, \
347 (real *) dx, (real *) dy, (real *) dz, \
348 (real *) h1, (real *) g11, (real *) g22, \
349 (real *) g33, (real *) g12, (real *) g13, \
351 (const int *) ind, *nelv); \
352 CUDA_CHECK(cudaGetLastError());
354#define CASE_VECTOR_KSTEP_PADDED(LX, C) \
355 ax_helm_compr_kernel_vector_kstep_padded<real, LX, NEKO_EB(LX, C)> \
356 <<<NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, stream>>> \
357 ((real *) au, (real *) av, (real *) aw, \
358 (real *) u, (real *) v, (real *) w, \
359 (real *) dx, (real *) dy, (real *) dz, \
360 (real *) h1, (real *) g11, (real *) g22, \
361 (real *) g33, (real *) g12, (real *) g13, \
363 (const int *) ind, *nelv); \
364 CUDA_CHECK(cudaGetLastError());
367#define CASE_VECTOR_KSTEP_SEL(LX, SEL) \
369 case 0: CASE_VECTOR_KSTEP(LX, 0); break; \
370 case 1: CASE_VECTOR_KSTEP(LX, 1); break; \
371 default: CASE_VECTOR_KSTEP(LX, 2); break; \
374#define CASE_VECTOR_KSTEP_PADDED_SEL(LX, SEL) \
376 case 0: CASE_VECTOR_KSTEP_PADDED(LX, 0); break; \
377 case 1: CASE_VECTOR_KSTEP_PADDED(LX, 1); break; \
378 default: CASE_VECTOR_KSTEP_PADDED(LX, 2); break; \
381#define CASE_VECTOR_DMMA(LX, C) \
382 ax_helm_compr_kernel_dmma_vector<real, LX, NEKO_DMMA_NW(C)> \
383 <<<nblcks_dmma, NEKO_DMMA_NTHRDS(C), 0, stream>>> \
384 ((real *) au, (real *) av, (real *) aw, \
385 (real *) u, (real *) v, (real *) w, \
386 (real *) dx, (real *) dy, (real *) dz, \
387 (real *) h1, (real *) g11, (real *) g22, \
388 (real *) g33, (real *) g12, (real *) g13, \
390 (const int *) ind); \
391 CUDA_CHECK(cudaGetLastError());
394#define CASE_VECTOR_DMMA_SEL(LX, SEL) \
396 case 0: CASE_VECTOR_DMMA(LX, 0); break; \
397 case 1: CASE_VECTOR_DMMA(LX, 1); break; \
398 default: CASE_VECTOR_DMMA(LX, 2); break; \
403#define CASE_VECTOR_DMMA_TMA(LX, C) \
404 ax_helm_compr_kernel_dmma_tma_vector<real, LX, NEKO_DMMA_NW(C)> \
405 <<<nblcks_dmma, NEKO_DMMA_NTHRDS(C), 0, stream>>> \
406 ((real *) au, (real *) av, (real *) aw, \
407 (real *) u, (real *) v, (real *) w, \
408 (real *) dx, (real *) dy, (real *) dz, \
409 (real *) h1, (real *) g11, (real *) g22, \
410 (real *) g33, (real *) g12, (real *) g13, \
412 (const int *) ind); \
413 CUDA_CHECK(cudaGetLastError());
416#define CASE_VECTOR_DMMA_TMA_SEL(LX, SEL) \
418 case 0: CASE_VECTOR_DMMA_TMA(LX, 0); break; \
419 case 1: CASE_VECTOR_DMMA_TMA(LX, 1); break; \
420 default: CASE_VECTOR_DMMA_TMA(LX, 2); break; \
430#define CASE_VECTOR_DMMA_TMA_BATCH(LX, C) \
431 (void) ax_helm_compr_dmma_tma_batch_optin<real, LX, NEKO_DMMA_NW(C)>(); \
432 ax_helm_compr_kernel_dmma_tma_batch<real, LX, NEKO_DMMA_NW(C)> \
433 <<<nblcks_dmma, NEKO_DMMA_NTHRDS(C), \
434 NEKO_DMMA_TMA_BATCH_SMEM, stream>>> \
435 ((real *) au, (real *) av, (real *) aw, \
436 (real *) u, (real *) v, (real *) w, \
437 (real *) dx, (real *) dy, (real *) dz, \
438 (real *) h1, (real *) g11, (real *) g22, \
439 (real *) g33, (real *) g12, (real *) g13, \
441 (const int *) ind); \
442 CUDA_CHECK(cudaGetLastError());
445#define CASE_VECTOR_DMMA_TMA_BATCH_SEL(LX, SEL) \
447 case 0: CASE_VECTOR_DMMA_TMA_BATCH(LX, 0); break; \
448 case 1: CASE_VECTOR_DMMA_TMA_BATCH(LX, 1); break; \
449 default: CASE_VECTOR_DMMA_TMA_BATCH(LX, 2); break; \
452#define CASE_VECTOR(LX) \
454 if (autotune_vec[LX] == 0 ) { \
455 autotune_vec[LX] = tune_compr_vector<LX>(au, av, aw, u, v, w, dx, dy, \
456 dz, h1, g11, g22, g33, g12, \
457 g13, g23, ind, nelv, lx, \
458 &autotune_vec_eb[LX], \
459 &autotune_vec_nw[LX], \
460 &autotune_vec_tw[LX], \
461 &autotune_vec_bw[LX]); \
462 } else if (autotune_vec[LX] == 2 ) { \
463 CASE_VECTOR_KSTEP_SEL(LX, autotune_vec_eb[LX]); \
464 } else if (autotune_vec[LX] == 3 ) { \
465 CASE_VECTOR_DMMA_SEL(LX, autotune_vec_nw[LX]); \
466 } else if (autotune_vec[LX] == 4 ) { \
467 CASE_VECTOR_DMMA_TMA_SEL(LX, autotune_vec_tw[LX]); \
468 } else if (autotune_vec[LX] == 5 ) { \
469 CASE_VECTOR_DMMA_TMA_BATCH_SEL(LX, autotune_vec_bw[LX]); \
473#define CASE_VECTOR_PADDED(LX) \
475 if (autotune_vec[LX] == 0 ) { \
476 autotune_vec[LX] = tune_compr_vector_padded<LX>(au, av, aw, u, v, w, \
479 g12, g13, g23, ind, \
481 &autotune_vec_eb[LX], \
482 &autotune_vec_nw[LX], \
483 &autotune_vec_tw[LX], \
484 &autotune_vec_bw[LX]); \
485 } else if (autotune_vec[LX] == 2 ) { \
486 CASE_VECTOR_KSTEP_PADDED_SEL(LX, autotune_vec_eb[LX]); \
487 } else if (autotune_vec[LX] == 3 ) { \
488 CASE_VECTOR_DMMA_SEL(LX, autotune_vec_nw[LX]); \
489 } else if (autotune_vec[LX] == 4 ) { \
490 CASE_VECTOR_DMMA_TMA_SEL(LX, autotune_vec_tw[LX]); \
491 } else if (autotune_vec[LX] == 5 ) { \
492 CASE_VECTOR_DMMA_TMA_BATCH_SEL(LX, autotune_vec_bw[LX]); \
521template < const
int LX >
607 "DMMA_TMA strategy not available for this config");
688 for (
int r = 0; r <
rounds; r++) {
767template < const
int LX >
846 "DMMA_TMA strategy not available for this config");
925 for (
int r = 0; r <
rounds; r++) {
1019template < const
int LX >
1021 void *
dx,
void *
dy,
void *
dz,
void *
h1,
void *
g11,
1100 "DMMA_TMA strategy not available for this config");
1108 "DMMA_TMA_BATCH strategy not available for this config");
1184 for (
int r = 0; r <
rounds; r++) {
1237 }
else if (
retval == 3) {
1241 }
else if (
retval == 4) {
1257template < const
int LX >
1259 void *
w,
void *
dx,
void *
dy,
void *
dz,
void *
h1,
1339 "DMMA_TMA strategy not available for this config");
1347 "DMMA_TMA_BATCH strategy not available for this config");
1423 for (
int r = 0; r <
rounds; r++) {
1474 }
else if (
retval == 3) {
1478 }
else if (
retval == 4) {
void cuda_ax_helm_compr_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, void *ind, int *nelv, int *lx)
#define CASE_DMMA_SEL(LX, SEL)
#define CASE_KSTEP_SEL(LX, SEL)
int tune_compr_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, void *ind, int *nelv, int *lx, int *eb_sel, int *nw_sel, int *tw_sel, int *bw_sel)
int tune_compr(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, void *ind, int *nelv, int *lx, int *eb_sel, int *ch_sel, int *nw_sel, int *tw_sel)
#define CASE_1D_SEL(LX, SEL)
#define CASE_KSTEP_PADDED_SEL(LX, SEL)
#define CASE_DMMA_TMA_SEL(LX, SEL)
#define CASE_LARGE_PADDED(LX)
void cuda_ax_helm_compr(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, void *ind, int *nelv, int *lx)
#define CASE_VECTOR_DMMA_TMA_SEL(LX, SEL)
#define CASE_VECTOR_KSTEP_SEL(LX, SEL)
#define CASE_VECTOR_PADDED(LX)
int tune_compr_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, void *ind, int *nelv, int *lx, int *eb_sel, int *ch_sel, int *nw_sel, int *tw_sel)
int tune_compr_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, void *ind, int *nelv, int *lx, int *eb_sel, int *nw_sel, int *tw_sel, int *bw_sel)
#define CASE_VECTOR_KSTEP_PADDED_SEL(LX, SEL)
#define CASE_VECTOR_DMMA_TMA_BATCH_SEL(LX, SEL)
#define CASE_VECTOR_DMMA_SEL(LX, SEL)
__global__ void ale_add_kinematics_kernel(const int n, T *__restrict__ wx, T *__restrict__ wy, T *__restrict__ wz, const T *__restrict__ x_ref, const T *__restrict__ y_ref, const T *__restrict__ z_ref, const T *__restrict__ phi, const T *__restrict__ x, const T *__restrict__ y, const T *__restrict__ z, const kinematics_params_t kin_params)
__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__ const T *__restrict__ const int *__restrict__ ind
__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 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 cuda_have_dmma()
#define NEKO_DMMA_PACK(LX)
#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()
#define NEKO_TUNE_LOG_DMMA_TMA(LX, T4)
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)