Implement RMSNorm (root-mean-square normalization) as a single fused CUDA kernel, one independent row at a time.
You are given a matrix input of shape (rows, cols) stored row-major, a scale vector gamma of length cols, and a small constant eps. For each row compute
Fusion requirement: the sum-of-squares reduction, the reciprocal RMS, the scale, and the store must all happen inside one __global__ kernel. Do not launch a separate kernel for the reduction. Suggested launch: one thread block per row. You may assume 1 <= cols <= 1024 so a single block covers the row (use a power-of-two block size >= cols; out-of-range threads contribute to the sum of squares).
Complete:
__global__ kernel that computes fused row-wise RMSNorm.void solve(const float* input, const float* gamma, float* output, int rows, int cols, float eps) where every pointer is a host pointer. input and output have rows * cols elements; gamma has cols. Allocate, copy in, launch, copy out, and free.Do not write a main() in your solution.