[PATCH] D12241: [CUDA] Change initializer for CUDA device code based on CUDA documentation.

Jingyue Wu via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 11:44:13 PDT 2015


jingyue added a comment.

OK. Then some rewording needs to be done.

The reason shared variables should be initialized as undef is that CUDA's language manual explicitly says that it can't be initialized.

The reason they shouldn't be initialized as zero is sort of what you explained in the second paragraph: compilers might perform optimizations that leverage the zero initializer. However, such optimizations are illegimate because, at runtime, data previously stored to shared memory might be left over.

Is this more accurate?


http://reviews.llvm.org/D12241





More information about the llvm-commits mailing list