38#include <hip/hip_runtime.h>
63 void *
dx,
void *
dy,
void *
dz,
void *
h1,
69 void *
u,
void *
v,
void *
w,
70 void *
dx,
void *
dy,
void *
dz,
void *
h1,
94#define CASE_1D(LX, C) \
95 hipLaunchKernelGGL(HIP_KERNEL_NAME( \
96 ax_helm_kernel_1d<real, LX, NEKO_CHUNKS(LX, C)> ), \
97 nblcks_1d, NEKO_CHUNKS_NTHRDS(LX, C), 0, \
98 (hipStream_t) glb_cmd_queue, \
99 (real *) w, (real *) u, \
100 (real *) dx, (real *) dy, (real *) dz, \
101 (real *) dxt, (real *) dyt, (real *) dzt, (real *) h1, \
102 (real *) g11, (real *) g22, (real *) g33, \
103 (real *) g12, (real *) g13, (real *) g23); \
104 HIP_CHECK(hipGetLastError());
107#define CASE_1D_SEL(LX, SEL) \
109 case 0: CASE_1D(LX, 0); break; \
110 case 1: CASE_1D(LX, 1); break; \
111 case 2: CASE_1D(LX, 2); break; \
112 default: CASE_1D(LX, 3); break; \
115#define CASE_KSTEP(LX, C) \
116 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
117 ax_helm_kernel_kstep<real, LX, NEKO_EB(LX, C)> ), \
118 NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, \
119 (hipStream_t) glb_cmd_queue, \
120 (real *) w, (real *) u, \
121 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
122 (real *) g11, (real *) g22, (real *) g33, \
123 (real *) g12, (real *) g13, (real *) g23, *nelv); \
124 HIP_CHECK(hipGetLastError());
126#define CASE_KSTEP_PADDED(LX, C) \
127 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
128 ax_helm_kernel_kstep_padded<real, LX, NEKO_EB(LX, C)> ),\
129 NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, \
130 (hipStream_t) glb_cmd_queue, \
131 (real *) w, (real *) u, \
132 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
133 (real *) g11, (real *) g22, (real *) g33, \
134 (real *) g12, (real *) g13, (real *) g23, *nelv); \
135 HIP_CHECK(hipGetLastError());
138#define CASE_KSTEP_SEL(LX, SEL) \
140 case 0: CASE_KSTEP(LX, 0); break; \
141 case 1: CASE_KSTEP(LX, 1); break; \
142 default: CASE_KSTEP(LX, 2); break; \
145#define CASE_KSTEP_PADDED_SEL(LX, SEL) \
147 case 0: CASE_KSTEP_PADDED(LX, 0); break; \
148 case 1: CASE_KSTEP_PADDED(LX, 1); break; \
149 default: CASE_KSTEP_PADDED(LX, 2); break; \
154 if(autotune[LX] == 0 ) { \
155 autotune[LX]=tune<LX>( w, u, \
159 g12, g13, g23, nelv, lx, \
160 &autotune_eb[LX], &autotune_ch[LX]); \
161 } else if (autotune[LX] == 1 ) { \
162 CASE_1D_SEL(LX, autotune_ch[LX]); \
163 } else if (autotune[LX] == 2 ) { \
164 CASE_KSTEP_SEL(LX, autotune_eb[LX]); \
168#define CASE_PADDED(LX) \
170 if(autotune[LX] == 0 ) { \
171 autotune[LX]=tune_padded<LX>(w, u, \
175 g12, g13, g23,nelv,lx, \
176 &autotune_eb[LX], &autotune_ch[LX]); \
177 } else if (autotune[LX] == 1 ) { \
178 CASE_1D_SEL(LX, autotune_ch[LX]); \
179 } else if (autotune[LX] == 2 ) { \
180 CASE_KSTEP_PADDED_SEL(LX, autotune_eb[LX]); \
189#define CASE_LARGE(LX) \
194#define CASE_LARGE_PADDED(LX) \
196 CASE_KSTEP_PADDED(LX, 0); \
237 void *
u,
void *
v,
void *
w,
238 void *
dx,
void *
dy,
void *
dz,
242 void *
g23,
int *
nelv,
int *lx) {
249#define CASE_VECTOR_KSTEP(LX, C) \
250 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
251 ax_helm_kernel_vector_kstep<real, LX, \
253 NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, \
254 (hipStream_t) glb_cmd_queue, \
255 (real *) au, (real *) av, (real *) aw, \
256 (real *) u, (real *) v, (real *) w, \
257 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
258 (real *) g11, (real *) g22, (real *) g33, \
259 (real *) g12, (real *) g13, (real *) g23, *nelv); \
260 HIP_CHECK(hipGetLastError());
262#define CASE_VECTOR_KSTEP_PADDED(LX, C) \
263 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
264 ax_helm_kernel_vector_kstep_padded<real, LX, \
266 NEKO_EB_NBLCKS(*nelv, LX, C), NEKO_EB_NTHRDS(LX, C), 0, \
267 (hipStream_t) glb_cmd_queue, \
268 (real *) au, (real *) av, (real *) aw, \
269 (real *) u, (real *) v, (real *) w, \
270 (real *) dx, (real *) dy, (real *) dz, (real *) h1, \
271 (real *) g11, (real *) g22, (real *) g33, \
272 (real *) g12, (real *) g13, (real *) g23, *nelv); \
273 HIP_CHECK(hipGetLastError());
275#define CASE_VECTOR_SEL(LX, SEL) \
277 case 0: CASE_VECTOR_KSTEP(LX, 0); break; \
278 case 1: CASE_VECTOR_KSTEP(LX, 1); break; \
279 default: CASE_VECTOR_KSTEP(LX, 2); break; \
282#define CASE_VECTOR_PADDED_SEL(LX, SEL) \
284 case 0: CASE_VECTOR_KSTEP_PADDED(LX, 0); break; \
285 case 1: CASE_VECTOR_KSTEP_PADDED(LX, 1); break; \
286 default: CASE_VECTOR_KSTEP_PADDED(LX, 2); break; \
289#define CASE_VECTOR(LX) \
291 if (autotune_v[LX] == 0) { \
292 autotune_v[LX] = 1 + tune_vector<LX>(au, av, aw, u, v, w, \
295 g12, g13, g23, nelv, lx); \
297 CASE_VECTOR_SEL(LX, autotune_v[LX] - 1); \
301#define CASE_VECTOR_PADDED(LX) \
303 if (autotune_v[LX] == 0) { \
304 autotune_v[LX] = 1 + tune_vector_padded<LX>(au, av, aw, u, v, w, \
307 g12, g13, g23, nelv, lx); \
309 CASE_VECTOR_PADDED_SEL(LX, autotune_v[LX] - 1); \
341 void *
u,
void *
v,
void *
w,
342 void *h2,
void *B,
int *n) {
345 const dim3 nblcks(((*n)+1024 - 1)/ 1024, 1, 1);
357template < const
int LX >
438 for (
int r = 0; r <
rounds; r++) {
486template < const
int LX >
567 for (
int r = 0; r <
rounds; r++) {
620template < const
int LX >
622 void *
dx,
void *
dy,
void *
dz,
void *
h1,
649 if (
getenv(
"NEKO_AUTOTUNE") ||
669 for (
int r = 0; r <
rounds; r++) {
695template < const
int LX >
697 void *
u,
void *
v,
void *
w,
698 void *
dx,
void *
dy,
void *
dz,
void *
h1,
725 if (
getenv(
"NEKO_AUTOTUNE") ||
745 for (
int r = 0; r <
rounds; r++) {
#define CASE_KSTEP_SEL(LX, SEL)
void hip_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(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)
#define CASE_VECTOR_KSTEP(LX, C)
#define CASE_VECTOR_PADDED_SEL(LX, SEL)
#define CASE_KSTEP(LX, C)
#define CASE_KSTEP_PADDED_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)
void hip_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)
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)
void hip_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)
#define CASE_LARGE_PADDED(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)
#define CASE_VECTOR_KSTEP_PADDED(LX, C)
#define CASE_VECTOR_PADDED(LX)
#define CASE_VECTOR_SEL(LX, SEL)
#define CASE_KSTEP_PADDED(LX, C)
__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 T *__restrict__ T *__restrict__ aw
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ u
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dx
__global__ void T *__restrict__ av
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ v
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dz
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ h1
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ 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__ const T *__restrict__ const T *__restrict__ const T *__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__ const T *__restrict__ const T *__restrict__ g23
__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 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__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ g33
__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__ const T *__restrict__ const T *__restrict__ dzt
__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__ dxt
#define NEKO_CHUNKS_CANDIDATES
#define NEKO_EB_CANDIDATES
#define NEKO_EB_SEL(LX, SEL)
#define NEKO_CHUNKS_SEL(LX, SEL)
#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()
static int neko_chunks_env()
static int neko_eb_sweep()
void log_error(char *msg)
void log_message(char *msg)
void log_section(char *msg)