#ifndef RESIDUAL_KERNEL_CUH_ #define RESIDUAL_KERNEL_CUH_ #include #include "../utils/cuda_utils.cuh" __global__ void residual_forward_kernel(float* out, float* inp1, float* inp2, int N) { // Implement this int x = blockDim.x * blockIdx.x + threadIdx.x; if(x < N){ out[x] = inp1[x] + inp2[x]; } } // Launch kernel here void residual_forward(float* out, float* inp1, float* inp2, int N) { // Implement this dim3 block(32,1,1); dim3 grid((N + block.x - 1)/ block.x); residual_forward_kernel<<>>(out, inp1, inp2, N); } #endif // RESIDUAL_KERNEL_CUH_