You are right. The function verify_matrix() from the original SGEMM_CUDA repository did not check for NANs. I deleted the repository. It was the 13th CUDA kernel I wrote in my life, and the whole endeavor teached me a lot. I appreciate the feedback.
It definitely sucks to be led astray and have time wasted by a bug inherited from the original repo though, sorry to hear that :/