38#include <hip/hip_runtime.h>
75 void *
dx,
void *
dy,
void *
dz,
void *
h1,
82 void *
u,
void *
v,
void *
w,
83 void *
dx,
void *
dy,
void *
dz,
void *
h1,
110#define CASE_1D(LX, C) \
111 hipLaunchKernelGGL(HIP_KERNEL_NAME( \
112 ax_helm_compr_kernel_1d<real, LX, NEKO_CHUNKS(LX, C)> ), \
113 nblcks_1d, NEKO_CHUNKS_NTHRDS(LX, C), 0, \
114 (hipStream_t) glb_cmd_queue, \
115 (real *) w, (real *) u, \
116 (real *) dx, (real *) dy, (real *) dz, \
117 (real *) dxt, (real *) dyt, (real *) dzt, (real *) h1, \
118 (real *) g11, (real *) g22, (real *) g33, \
119 (real *) g12, (real *) g13, (real *) g23, (int *) ind); \
120 HIP_CHECK(hipGetLastError());
123#define CASE_1D_SEL(LX, SEL) \
125 case 0: CASE_1D(LX, 0); break; \
126 case 1: CASE_1D(LX, 1); break; \
127 case 2: CASE_1D(LX, 2); break; \
128 default: CASE_1D(LX, 3); break; \
131#define CASE_KSTEP(LX, C) \
132 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
133 ax_helm_compr_kernel_kstep<real, LX, \
135 NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, \
136 (hipStream_t) glb_cmd_queue, \
137 (real *) w, (real *) u, \
138 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
139 (real *) g11, (real *) g22, (real *) g33, \
140 (real *) g12, (real *) g13, (real *) g23, \
141 (int *) ind, *nelv); \
142 HIP_CHECK(hipGetLastError());
144#define CASE_KSTEP_PADDED(LX, C) \
145 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
146 ax_helm_compr_kernel_kstep_padded<real, LX, \
148 NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, \
149 (hipStream_t) glb_cmd_queue, \
150 (real *) w, (real *) u, \
151 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
152 (real *) g11, (real *) g22, (real *) g33, \
153 (real *) g12, (real *) g13, (real *) g23, \
154 (int *) ind, *nelv); \
155 HIP_CHECK(hipGetLastError());
157#define CASE_MFMA(LX, C) \
158 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
159 ax_helm_compr_kernel_mfma<real, LX, NEKO_MFMA_NWF(C), \
160 NEKO_MFMA_TILE(C)> ), \
161 NEKO_MFMA_NBLCKS(*nelv, LX, C), NEKO_MFMA_NTHRDS(C), 0, \
162 (hipStream_t) glb_cmd_queue, \
163 (real *) w, (real *) u, \
164 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
165 (real *) g11, (real *) g22, (real *) g33, \
166 (real *) g12, (real *) g13, (real *) g23, \
167 (int *) ind, *nelv); \
168 HIP_CHECK(hipGetLastError());
172#define CASE_MFMA_SEL(LX, SEL) \
174 case 0: CASE_MFMA(LX, 0); break; \
175 case 1: CASE_MFMA(LX, 1); break; \
176 case 2: CASE_MFMA(LX, 2); break; \
177 case 3: CASE_MFMA(LX, 3); break; \
178 case 4: CASE_MFMA(LX, 4); break; \
179 case 5: CASE_MFMA(LX, 5); break; \
180 case 6: CASE_MFMA(LX, 6); break; \
181 case 7: CASE_MFMA(LX, 7); break; \
182 case 8: CASE_MFMA(LX, 8); break; \
183 default: CASE_MFMA(LX, 9); break; \
193 "CASE_MFMA_SEL does not cover the candidate space");
196#define CASE_KSTEP_SEL(LX, SEL) \
198 case 0: CASE_KSTEP(LX, 0); break; \
199 case 1: CASE_KSTEP(LX, 1); break; \
200 default: CASE_KSTEP(LX, 2); break; \
203#define CASE_KSTEP_PADDED_SEL(LX, SEL) \
205 case 0: CASE_KSTEP_PADDED(LX, 0); break; \
206 case 1: CASE_KSTEP_PADDED(LX, 1); break; \
207 default: CASE_KSTEP_PADDED(LX, 2); break; \
212 if(autotune[LX] == 0 ) { \
213 autotune[LX]=tune_compr<LX>( w, u, \
217 g12, g13, g23, ind, nelv, lx, \
218 &autotune_eb[LX], &autotune_ch[LX], \
219 &autotune_nwf[LX]); \
220 } else if (autotune[LX] == 1 ) { \
221 CASE_1D_SEL(LX, autotune_ch[LX]); \
222 } else if (autotune[LX] == 2 ) { \
223 CASE_KSTEP_SEL(LX, autotune_eb[LX]); \
224 } else if (autotune[LX] == 3 ) { \
225 CASE_MFMA_SEL(LX, autotune_nwf[LX]); \
229#define CASE_PADDED(LX) \
231 if(autotune[LX] == 0 ) { \
232 autotune[LX]=tune_compr_padded<LX>(w, u, \
236 g12, g13, g23, ind, nelv,lx, \
237 &autotune_eb[LX], &autotune_ch[LX], \
238 &autotune_nwf[LX]); \
239 } else if (autotune[LX] == 1 ) { \
240 CASE_1D_SEL(LX, autotune_ch[LX]); \
241 } else if (autotune[LX] == 2 ) { \
242 CASE_KSTEP_PADDED_SEL(LX, autotune_eb[LX]); \
243 } else if (autotune[LX] == 3 ) { \
244 CASE_MFMA_SEL(LX, autotune_nwf[LX]); \
253#define CASE_LARGE(LX) \
258#define CASE_LARGE_PADDED(LX) \
260 CASE_KSTEP_PADDED(LX, 0); \
302 void *
u,
void *
v,
void *
w,
303 void *
dx,
void *
dy,
void *
dz,
318#define CASE_VECTOR_KSTEP(LX, C) \
319 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
320 ax_helm_compr_kernel_vector_kstep<real, LX, \
322 NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, \
323 (hipStream_t) glb_cmd_queue, \
324 (real *) au, (real *) av, (real *) aw, \
325 (real *) u, (real *) v, (real *) w, \
326 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
327 (real *) g11, (real *) g22, (real *) g33, \
328 (real *) g12, (real *) g13, (real *) g23, \
329 (int *) ind, *nelv); \
330 HIP_CHECK(hipGetLastError());
332#define CASE_VECTOR_KSTEP_PADDED(LX, C) \
333 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
334 ax_helm_compr_kernel_vector_kstep_padded< \
335 real, LX, NEKO_EB(LX, C)> ), \
336 NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, \
337 (hipStream_t) glb_cmd_queue, \
338 (real *) au, (real *) av, (real *) aw, \
339 (real *) u, (real *) v, (real *) w, \
340 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
341 (real *) g11, (real *) g22, (real *) g33, \
342 (real *) g12, (real *) g13, (real *) g23, \
343 (int *) ind, *nelv); \
344 HIP_CHECK(hipGetLastError());
348#define CASE_VECTOR_MFMA(LX, C) \
349 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
350 ax_helm_compr_kernel_mfma_vector< \
351 real, LX, NEKO_MFMA_NWF(C), NEKO_MFMA_TILE(C)> ), \
352 NEKO_MFMA_NBLCKS(*nelv, LX, C), NEKO_MFMA_NTHRDS(C), 0, \
353 (hipStream_t) glb_cmd_queue, \
354 (real *) au, (real *) av, (real *) aw, \
355 (real *) u, (real *) v, (real *) w, \
356 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
357 (real *) g11, (real *) g22, (real *) g33, \
358 (real *) g12, (real *) g13, (real *) g23, \
359 (int *) ind, *nelv); \
360 HIP_CHECK(hipGetLastError());
362#define CASE_VECTOR_KSTEP_SEL(LX, SEL) \
364 case 0: CASE_VECTOR_KSTEP(LX, 0); break; \
365 case 1: CASE_VECTOR_KSTEP(LX, 1); break; \
366 default: CASE_VECTOR_KSTEP(LX, 2); break; \
369#define CASE_VECTOR_KSTEP_PADDED_SEL(LX, SEL) \
371 case 0: CASE_VECTOR_KSTEP_PADDED(LX, 0); break; \
372 case 1: CASE_VECTOR_KSTEP_PADDED(LX, 1); break; \
373 default: CASE_VECTOR_KSTEP_PADDED(LX, 2); break; \
377#define CASE_VECTOR_MFMA_SEL(LX, SEL) \
379 case 0: CASE_VECTOR_MFMA(LX, 0); break; \
380 case 1: CASE_VECTOR_MFMA(LX, 1); break; \
381 case 2: CASE_VECTOR_MFMA(LX, 2); break; \
382 case 3: CASE_VECTOR_MFMA(LX, 3); break; \
383 case 4: CASE_VECTOR_MFMA(LX, 4); break; \
384 case 5: CASE_VECTOR_MFMA(LX, 5); break; \
385 case 6: CASE_VECTOR_MFMA(LX, 6); break; \
386 case 7: CASE_VECTOR_MFMA(LX, 7); break; \
387 case 8: CASE_VECTOR_MFMA(LX, 8); break; \
388 default: CASE_VECTOR_MFMA(LX, 9); break; \
398 "CASE_VECTOR_MFMA_SEL does not cover the candidate space");
400#define CASE_VECTOR(LX) \
402 if (autotune_v[LX] == 0) { \
403 autotune_v[LX] = tune_compr_vector<LX>(au, av, aw, u, v, w, \
406 g12, g13, g23, ind, nelv, lx, \
407 &autotune_v_eb[LX], \
408 &autotune_v_nwf[LX]); \
409 } else if (autotune_v[LX] == 2) { \
410 CASE_VECTOR_KSTEP_SEL(LX, autotune_v_eb[LX]); \
411 } else if (autotune_v[LX] == 3) { \
412 CASE_VECTOR_MFMA_SEL(LX, autotune_v_nwf[LX]); \
416#define CASE_VECTOR_PADDED(LX) \
418 if (autotune_v[LX] == 0) { \
419 autotune_v[LX] = tune_compr_vector_padded<LX>(au, av, aw, u, v, w, \
422 g12, g13, g23, ind, \
424 &autotune_v_eb[LX], \
425 &autotune_v_nwf[LX]); \
426 } else if (autotune_v[LX] == 2) { \
427 CASE_VECTOR_KSTEP_PADDED_SEL(LX, autotune_v_eb[LX]); \
428 } else if (autotune_v[LX] == 3) { \
429 CASE_VECTOR_MFMA_SEL(LX, autotune_v_nwf[LX]); \
461template < const
int LX >
608 for (
int r = 0; r <
rounds; r++) {
671template < const
int LX >
806 for (
int r = 0; r <
rounds; r++) {
883template < const
int LX >
885 void *
dx,
void *
dy,
void *
dz,
void *
h1,
1006 for (
int r = 0; r <
rounds; r++) {
1051template < const
int LX >
1053 void *
u,
void *
v,
void *
w,
1054 void *
dx,
void *
dy,
void *
dz,
void *
h1,
1174 for (
int r = 0; r <
rounds; r++) {
#define CASE_VECTOR_MFMA_SEL(LX, SEL)
#define CASE_KSTEP_SEL(LX, SEL)
#define CASE_1D_SEL(LX, SEL)
#define CASE_VECTOR_KSTEP(LX, C)
#define CASE_MFMA_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 *nwf_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 *nwf_sel)
#define CASE_KSTEP_PADDED_SEL(LX, SEL)
void hip_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_LARGE_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 *nwf_sel)
#define CASE_VECTOR_KSTEP_PADDED(LX, C)
void hip_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_VECTOR_KSTEP_SEL(LX, SEL)
#define CASE_VECTOR_PADDED(LX)
#define CASE_VECTOR_KSTEP_PADDED_SEL(LX, 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 *nwf_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)
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_TUNE_LOG_KSTEP(LX, T2)
#define NEKO_TUNE_LOG_MFMA_VEC(LX, T3)
#define NEKO_TUNE_LOG_MFMA(LX, T3)
static const char * mfma_tile_name(const int c)
#define NEKO_MFMA_CANDIDATES
static int neko_mfma_pin()
static int neko_mfma_candidates()
static bool hip_have_mfma()
#define NEKO_MFMA_EB(LX, C)
static int neko_mfma_sweep()
void log_error(char *msg)
void log_message(char *msg)
void log_section(char *msg)