38#include <hip/hip_runtime.h>
50 void *
dx,
void *
dy,
void *
dz,
63 void *
dx,
void *
dy,
void *
dz,
67 void *
w3,
int *nel,
int *lx) {
81#define CASE_1D(LX, C) \
82 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
83 opgrad_kernel_1d<real, LX, NEKO_CHUNKS(LX, C)> ), \
84 nblcks, NEKO_CHUNKS_NTHRDS(LX, C), 0, \
85 (hipStream_t) glb_cmd_queue, \
86 (real *) ux, (real *) uy, (real *) uz, (real *) u, \
87 (real *) dx, (real *) dy, (real *) dz, \
88 (real *) drdx, (real *) dsdx, (real *) dtdx, \
89 (real *) drdy, (real *) dsdy, (real *) dtdy, \
90 (real *) drdz, (real *) dsdz, (real *) dtdz, \
92 HIP_CHECK(hipGetLastError());
95#define CASE_1D_SEL(LX, SEL) \
97 case 0: CASE_1D(LX, 0); break; \
98 case 1: CASE_1D(LX, 1); break; \
99 case 2: CASE_1D(LX, 2); break; \
100 default: CASE_1D(LX, 3); break; \
104#define CASE_KSTEP(LX, C) \
105 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
106 opgrad_kernel_kstep<real, LX, NEKO_EB(LX, C)> ), \
107 NEKO_EB_NBLCKS(*nel, LX, C), NEKO_EB_NTHRDS(LX, C), 0, \
108 (hipStream_t) glb_cmd_queue, \
109 (real *) ux, (real *) uy, (real *) uz, (real *) u, \
110 (real *) dx, (real *) dy, (real *) dz, \
111 (real *) drdx, (real *) dsdx, (real *) dtdx, \
112 (real *) drdy, (real *) dsdy, (real *) dtdy, \
113 (real *) drdz, (real *) dsdz, (real *) dtdz, \
114 (real *) w3, *nel); \
115 HIP_CHECK(hipGetLastError());
118#define CASE_KSTEP_SEL(LX, SEL) \
120 case 0: CASE_KSTEP(LX, 0); break; \
121 case 1: CASE_KSTEP(LX, 1); break; \
122 default: CASE_KSTEP(LX, 2); break; \
125#define CASE_MFMA(LX, C) \
126 hipLaunchKernelGGL( HIP_KERNEL_NAME( \
127 opgrad_kernel_mfma<real, LX, NEKO_MFMA_NWF(C), \
128 NEKO_MFMA_TILE(C)> ), \
129 NEKO_MFMA_NBLCKS(*nel, LX, C), NEKO_MFMA_NTHRDS(C), 0, \
130 (hipStream_t) glb_cmd_queue, \
131 (real *) ux, (real *) uy, (real *) uz, (real *) u, \
132 (real *) dx, (real *) dy, (real *) dz, \
133 (real *) drdx, (real *) dsdx, (real *) dtdx, \
134 (real *) drdy, (real *) dsdy, (real *) dtdy, \
135 (real *) drdz, (real *) dsdz, (real *) dtdz, \
136 (real *) w3, *nel); \
137 HIP_CHECK(hipGetLastError());
141#define CASE_MFMA_SEL(LX, SEL) \
143 case 0: CASE_MFMA(LX, 0); break; \
144 case 1: CASE_MFMA(LX, 1); break; \
145 case 2: CASE_MFMA(LX, 2); break; \
146 case 3: CASE_MFMA(LX, 3); break; \
147 case 4: CASE_MFMA(LX, 4); break; \
148 case 5: CASE_MFMA(LX, 5); break; \
149 case 6: CASE_MFMA(LX, 6); break; \
150 case 7: CASE_MFMA(LX, 7); break; \
151 case 8: CASE_MFMA(LX, 8); break; \
152 default: CASE_MFMA(LX, 9); break; \
159 "CASE_MFMA_SEL does not cover the candidate space");
163 if(autotune[LX] == 0 ) { \
164 autotune[LX]=tune_opgrad<LX>(ux, uy, uz, u, \
169 w3, nel, lx, &autotune_eb[LX], \
171 &autotune_nwf[LX]); \
172 } else if (autotune[LX] == 1 ) { \
173 CASE_1D_SEL(LX, autotune_ch[LX]); \
174 } else if (autotune[LX] == 2 ) { \
175 CASE_KSTEP_SEL(LX, autotune_eb[LX]); \
176 } else if (autotune[LX] == 3 ) { \
177 CASE_MFMA_SEL(LX, autotune_nwf[LX]); \
208template < const
int LX >
210 void *
dx,
void *
dy,
void *
dz,
349 void **
vins[] = { &
u };
351 (*nel) *
LX *
LX *
LX, stream)) {
369 "skipped, no memory for it" :
"off (NEKO_TUNE_VERIFY=0)");
390 for (
int r = 0; r <
rounds; r++) {
__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__ dz
__global__ void const T *__restrict__ const T *__restrict__ dx
__global__ void const T *__restrict__ u
__global__ void const T *__restrict__ const T *__restrict__ const T *__restrict__ dy
__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__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dtdy
__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__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dtdx
__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__ 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__ dtdz
__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__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dsdz
__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__ const T *__restrict__ const T *__restrict__ const T *__restrict__ drdz
__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__ const T *__restrict__ drdx
__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__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dsdx
__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__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ dsdy
__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__ const T *__restrict__ const T *__restrict__ drdy
__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__ w3
#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()
__global__ void T *__restrict__ uy
__global__ void T *__restrict__ T *__restrict__ uz
static void neko_tune_verify_ref(neko_tune_verify_t *v, hipStream_t stream)
#define NEKO_TUNE_VERIFY_CAND(VF, REJ, LAUNCH, LX, C, NAME)
static void neko_tune_verify_end(neko_tune_verify_t *v, hipStream_t stream)
static int neko_tune_verify_on()
static int neko_tune_verify_begin(neko_tune_verify_t *v, real **outs, const int nout, void ***ins, const int nin, const int n, hipStream_t stream)
#define NEKO_TUNE_APPLY_REJ(T, REJ, N)
#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)
#define CASE_KSTEP_SEL(LX, SEL)
int tune_opgrad(void *ux, void *uy, void *uz, void *u, void *dx, void *dy, void *dz, void *drdx, void *dsdx, void *dtdx, void *drdy, void *dsdy, void *dtdy, void *drdz, void *dsdz, void *dtdz, void *w3, int *nel, int *lx, int *eb_sel, int *ch_sel, int *nwf_sel)
#define CASE_1D_SEL(LX, SEL)
#define CASE_MFMA_SEL(LX, SEL)
void hip_opgrad(void *ux, void *uy, void *uz, void *u, void *dx, void *dy, void *dz, void *drdx, void *dsdx, void *dtdx, void *drdy, void *dsdy, void *dtdy, void *drdz, void *dsdz, void *dtdz, void *w3, int *nel, int *lx)