A basic question about CUDA compiler


I have a cuda kernel, I do the clean-compile multiple times, the report of stack frame (as well as pill load and spill stores) are different.

Anyone can help me to understand postential reasons?


Compilation should be deterministic, that is, using the exact same source code and compiling with the exact same tool chain with the exact same compiler switches on the exact same OS you should result in the exact same machine code being emitted. There is a slim chance of a compiler bug where the compiler operates on uninitialized or out-of-range data internally. However, experience and Occam’s razor tell me that you would first want to examine your local build environment:

(1) Were all build cycles performed on the same build machine?
(2) Are there multiple versions of CUDA installed on the build machine(s)?
(3) Are all PATHs set up correctly and consistently between build cycles? Incorrect PATHs could cause different compiler versions to be used, or cause different header files to be pulled in etc.
(4) Does the clean or clobber step of the build system work correctly, or could there be left over files from prior builds (maybe due to a permission issues)?
(5) Did all builds use the correct source files, and were these files identical for all build cycles (use of a revision control system can help ensure this is the case)
(6) Are compiler switches set up correctly and consistently for all build cycles? Different switches, e.g. to specify target architecture or optimization level, could obviously lead to different machine code.
(7) Is it possible that the build log inspected did not correspond to each of the build cycles?

Thank you.