I’m observing uninitialized global reads in a kernel that does a simple summation of all of its input elements while also using vector data types to load data from device memory to local memory. I tried getting to the bottom of this using Compute Sanitizer, but so far I was not able to understand what’s causing the uninitialized read.
This is my setup:
- NVIDIA GeForce GTX 1080 Ti
- Driver Version: 580.82.07
- CUDA Version: 13.0
- NVCC Build: cuda_12.9.r12.9/compiler.36037853_0
- Compilation command:
nvcc host.cpp -o host -lcuda -lnvrtc - Execution command:
compute-sanitizer --tool initcheck ./host
I have attached the host and kernel code I am using. The kernel might look a bit unintuitive, because it’s automatically generated code. I am aware that it is not properly optimized. Also, I have reduced the thread configuration to a single thread and block to simplify debugging.
What I have found so far:
- The kernel produces correct results.
- Some line of the kernel produces instructions that try to read from
x_deviceat index68, although that index is never written. - None of the lines in
kernel.cudirectly calculate index68, so it seems to me that something goes wrong during compilation to PTX or onwards.- I tried checking this with
printfs, interestingly adding certain prints make the uninitialized reads go away.
- I tried checking this with
- I tried checking the PTX. I am not much familiar with PTX, but as far as I understand, none of the loads from
x_devicein the PTX code access index68either.
Any help to further debug this would be greatly appreciated, many thanks in advance!
kernel.txt (1.5 KB)
host.txt (5.1 KB)