I'd start with the example of implementing the fastest reduction you possibly can. Pretty much all complexity in every kernel used in ML extends from this concept (reductions with addition).
https://developer.download.nvidia.com/assets/cuda/files/redu...