1#ifndef __KRYLOV_FUSEDCG_KERNEL_H__
2#define __KRYLOV_FUSEDCG_KERNEL_H__
45 const T * __restrict__ z,
46 const T * __restrict__ po,
50 const int idx = blockIdx.x * blockDim.x + threadIdx.x;
51 const int str = blockDim.x * gridDim.x;
53 for (
int i = idx;
i < n;
i+= str) {
54 p[
i] = beta*po[
i] + z[
i];
65 const T * __restrict__ alpha,
69 const int idx = blockIdx.x * blockDim.x + threadIdx.x;
70 const int str = blockDim.x * gridDim.x;
72 for (
int i = idx;
i < n;
i+= str) {
74 for (
int j = 0;
j < p_cur;
j ++) {
75 tmp += p[
j][
i] * alpha[
j];
87 const T * __restrict__ b,
88 const T * __restrict__ c,
93 const int idx = blockIdx.x * blockDim.x + threadIdx.x;
94 const int str = blockDim.x * gridDim.x;
102 for (
int i = idx;
i < n;
i+= str) {
103 T rt = a[
i] - alpha * c[
i];
104 tmp = tmp + rt * b[
i] * rt;
114 tmp = (threadIdx.x < blockDim.x /
NEKO_WAVE_SIZE) ? buf[lane] : 0;
119 if (threadIdx.x == 0) {
120 buf_h[blockIdx.x] = tmp;
__global__ void const T *__restrict__ x
__global__ void fusedcg_update_p_kernel(T *__restrict__ p, const T *__restrict__ z, const T *__restrict__ po, const T beta, const int n)
__global__ void fusedcg_part2_kernel(T *__restrict__ a, const T *__restrict__ b, const T *__restrict__ c, const T alpha, T *buf_h, const int n)
__global__ void fusedcg_update_x_kernel(T *__restrict__ x, const T **p, const T *__restrict__ alpha, const int p_cur, const int n)
__inline__ __device__ T reduce_warp(T val)