πŸš€ GPU Kernels Learning Journey

A 100-day journey of learning GPU programming and parallel computing with CUDA, HIP, and more

100 Days of GPU Programming

Day 1
**Summary:**
View Details β†’
Day 2
**Summary:**
View Details β†’
Day 3
**Summary:**
View Details β†’
Day 4
**Summary:**
View Details β†’
Day 5
**Summary:**
View Details β†’
Day 6
**Summary:**
View Details β†’
Day 7
**Summary:**
View Details β†’
Day 8
**Summary:**
View Details β†’
Day 9
Click to view details
View Details β†’
Day 10
Click to view details
View Details β†’
Day 11
Click to view details
View Details β†’
Day 12
**Summary:**
View Details β†’
Day 13
I coded a Breadth first search optimized kernel, check this for more details: [BFS](./day%2013/Bfs/README.md) .
View Details β†’
Day 14
**Summary:**
View Details β†’
Day 15
Click to view details
View Details β†’
Day 16
Click to view details
View Details β†’
Day 17
Click to view details
View Details β†’
Day 18
**Summary:**
View Details β†’
Day 19
**Summary:**
View Details β†’
Day 20
**Summary:**
View Details β†’
Day 21
**Summary:**
View Details β†’
Day 22
**Summary:**
View Details β†’
Day 23
**Summary:**
View Details β†’
Day 24
**Summary:**
View Details β†’
Day 25
**Summary:**
View Details β†’
Day 26
**Summary:**
View Details β†’
Day 27
**Summary:**
View Details β†’
Day 28
**Summary:**
View Details β†’
Day 29
**Summary:**
View Details β†’
Day 30
This is a special day as it marks one month of coding GPU kernels daily!
View Details β†’
Day 31
**Summary:**
View Details β†’
Day 32
**Summary:**
View Details β†’
Day 33
**Summary:**
View Details β†’
Day 34
**Summary:**
View Details β†’
Day 35
Implemented a CUDA-based simulation of the Three-Body Problem, a classical physics problem describing the motion of three celestial bodies under mutua...
View Details β†’
Day 36
Implemented a 2D heat diffusion simulation using HIP (Heterogeneous-Computing Interface for Portability). The simulation models how heat spreads acros...
View Details β†’
Day 37
Today, I implemented a basic ray tracing algorithm in CUDA to simulate optical phenomena. The kernel casts rays from a virtual camera and computes int...
View Details β†’
Day 38
Today I implemented the vector addition kernel in triton.
View Details β†’
Day 39
Today I implemented the matrix multiplication kernel in triton.
View Details β†’
Day 40
I implemented the softmax kernel in triton.
View Details β†’
Day 41
I implemented a fused Matrix Multiplication and ReLU kernel in triton.
View Details β†’
Day 42
I implemented a Triton kernel for 1D convolution.
View Details β†’
Day 43
I implemented Full Triton Matrix Multiplication Code with Autotuning.
View Details β†’
Day 44
I completed two challenges on leetgpu.com, both at the hardest level among all challenges.
View Details β†’
Day 45
I implemented a CUDA-based multi-agent flocking simulation (boids) using parallel computing. The simulation processes an array of agents, each represe...
View Details β†’
Day 46
I implemented the Muon optimization algorithm in CUDA, leveraging GPU parallelism for efficient gradient computation and parameter updates. The implem...
View Details β†’
Day 47
I implemented a multi-GPU Single-Parameter Bees Algorithm (SPBA) using HIP, which leverages parallel GPU execution to evaluate candidate solutions con...
View Details β†’
Day 48
I implemented a CUDA-based version of the L-BFGS optimization algorithm, leveraging GPU parallelism to accelerate the two-loop recursion for search di...
View Details β†’
Day 49
I implemented a CUDA-based Conjugate Gradient Method (CGM) solver to efficiently solve linear systems Ax=b by iteratively updating search directions w...
View Details β†’
Day 50
Today I implemented a comprehensive CUDA benchmark to explore the performance, memory efficiency, and accuracy tradeoffs between different floating-po...
View Details β†’
Day 51
Today I implemented a CUDA-based LSTM (Long Short-Term Memory) simulation that processes multiple timesteps on the GPU. The core of the implementation...
View Details β†’
Day 52
π–πžπ«πž 𝐑𝐍𝐍𝐬 𝐀π₯π₯ π–πž 𝐍𝐞𝐞𝐝𝐞𝐝?
View Details β†’
Day 53
I implemented the AdaHessian optimization algorithm using CUDA. AdaHessian is an adaptive optimizer that incorporates second-order information by appr...
View Details β†’
Day 54
I implemented a bidirectional Long Short-Term Memory (LSTM) network in CUDA, allowing for efficient parallel computation of recurrent neural networks ...
View Details β†’
Day 55
In this experiment, I implemented and benchmarked the DDPM (Denoising Diffusion Probabilistic Model) update step using both CUDA and PyTorch. The goal...
View Details β†’
Day 56
Based on the insightful feedback from my previous DDPM benchmark post, I've updated the code to ensure a fair, one-to-one comparison between the custo...
View Details β†’
Day 57
Implemented the mish activation function in cuda.
View Details β†’
Day 58
I implemented a GPU-accelerated Haar wavelet transform using Triton. The goal was to leverage Triton’s custom kernel capabilities to perform a 2Γ—2 Haa...
View Details β†’
Day 59
Implemented the Layer Normalization function in triton.
View Details β†’
Day 60
Today I implemented a Bitonic Sort algorithm in CUDA! This version is optimized for GPUs by leveraging shared memory to accelerate the sorting process...
View Details β†’
Day 61
I implemented a Simulated Annealing (SA) algorithm that leverages Triton to accelerate the evaluation of the objective function on the GPU.
View Details β†’
Day 62
I implemented Spectral Normalization (SN) using CUDA. Spectral Normalization is a technique used to stabilize the training of neural networks, particu...
View Details β†’
Day 63
I tackled the implementation of a Group Normalization forward pass using CUDA.
View Details β†’
Day 64
Today, I implemented the KL divergence loss (forward and backward passes) in CUDA, inspired by the Liger Triton kernel implementation. This CUDA versi...
View Details β†’
Day 65
I implemented GEGLU kernel in CUDA C++ for direct GPU execution inspired by the Liger Triton kernel implementation combining a gated linear unit with ...
View Details β†’
Day 66
I re-implemented the Liger Triton kernel in native CUDA C++ to perform a SwiGLU operation and its backward pass for gradient computation, where the fo...
View Details β†’
Day 67
Today I implemented a CUDA-accelerated Jacobi solver for the 2D Poisson equation. The goal was to solve βˆ‡Β²u=f using a finite-difference scheme and ite...
View Details β†’
Day 68
Today I implemented a LoRA (Low-Rank Adaptation) kernel in CUDA C++. This implementation fuses the low-rank update (AΓ—B) with the base weight matrix (...
View Details β†’
Day 69
Today, I implemented a CUDA-accelerated K-Means Clustering for 2D data points as part of the newly added hard challenge on LeetGPU.
View Details β†’
Day 70
Today I implemented the Total Variation Distance (TVD) Loss in CUDA C++ along with its backward pass for gradient computation. The kernel computes the...
View Details β†’
Day 71
In this implementation, I developed a CUDA C++ kernel for the generalized Jensen-Shannon Divergence (JSD) loss, including both forward and backward pa...
View Details β†’
Day 72
I implemented the DyT (Dynamic Tanh) operation in a standalone CUDA C++ file (`dyt.cu`) without using any external frameworks. The implementation incl...
View Details β†’
Day 73
Today, I implemented the Qwen2VL Multimodal Rotary Positional Embedding (M-RoPE) operation in pure CUDA C++. The implementation is self-contained and ...
View Details β†’
Day 74
Today, I implemented a fused Linear transformation and Softmax cross-entropy loss computation in pure CUDA C++. The kernel performs matrix multiplicat...
View Details β†’
Day 75
Today, I implemented the Contrastive Loss function in pure CUDA with both forward and backward passes. The forward kernel computes the loss for each s...
View Details β†’
Day 76
I implemented the Triplet Loss function in pure CUDA C++ with both forward and backward computations. This function is widely used in metric learning ...
View Details β†’
Day 77
I implemented a code that Performs matrix multiplication of two upper triangular matrices.
View Details β†’
Day 78
I implemented a code that Performs the element-wise Huber Loss (specifically, Smooth L1 Loss, which is Huber Loss with Ξ΄=1) between two input tensors.
View Details β†’
Day 79
I implemented a code that performs matrix multiplication followed by Swish activation and scaling.
View Details β†’
Day 80
I implemented a code that performs 3D average pooling on an input tensor.
View Details β†’
Day 81
I implemented a code that performs Softplus on an input tensor.
View Details β†’
Day 82
I implemented a code that performs the negative cosine similarity for each pair of vectors in the predictions and targets tensors.
View Details β†’
Day 83
I implemented a code that performs min reduction over a specified dimension of an input tensor.
View Details β†’
Day 84
I implemented a code that performs the cumulative product (also known as prefix product or scan) of an input array.
View Details β†’
Day 85
I implemented a code that performs 4D tensor-matrix multiplication of two tensors.
View Details β†’
Day 86
I implemented a code that performs the Hard Sigmoid activation function on an input matrix:
View Details β†’
Day 87
I implemented a code that performs the multiplication of two symmetric matrices.
View Details β†’
Day 88
I implemented a code that performs the Mean Squared Error.
View Details β†’
Day 89
I implemented a code that performs matrix multiplication of two lower triangular matrices.
View Details β†’
Day 90
I implemented a code that performs thee Frobenius Norm.
View Details β†’
Day 91
I implemented a code that performs the hinge loss.
View Details β†’
Day 92
I implemented a code that performs the 1D Convolution.
View Details β†’
Day 93
I implemented a code that performs the RMS (Root Mean Square) Normalization on a 2D tensor.
View Details β†’
Day 94
I implemented a code that performs the ELU (Exponential Linear Unit) activation function on an input matrix.
View Details β†’
Day 95
I implemented a code that performs the 2D max pooling on an input tensor.
View Details β†’
Day 96
I implemented a code that performs the product reduction over a specified dimension of an input tensor.
View Details β†’
Day 97
I optimized my previous code that applies the ELU (Exponential Linear Unit) activation function to an input matrix.
View Details β†’
Day 98
I optimized my previous code that applies the Leaky ReLU (Leaky Rectified Linear Unit) activation function on an input matrix.
View Details β†’
Day 99
I implemented a code that performs a matrix multiplication followed by bias addition and ReLU activation.
View Details β†’
Day 100
I implemented a code that compute the element-wise Kullback-Leibler Divergence between two probability distributions, predictions and targets.
View Details β†’