diff options
author | Jingyue Wu <jingyue@google.com> | 2015-08-22 05:49:28 +0000 |
---|---|---|
committer | Jingyue Wu <jingyue@google.com> | 2015-08-22 05:49:28 +0000 |
commit | 284ebe237ff277625caa23192f159a1be7d0a6d4 (patch) | |
tree | 2c0c5535653c752cdc6f108496ed8e5730509a24 /clang/lib/Serialization/Module.cpp | |
parent | fcec09866a12114cbcb2c0dd0457c36e83bd8d50 (diff) | |
download | bcm5719-llvm-284ebe237ff277625caa23192f159a1be7d0a6d4.tar.gz bcm5719-llvm-284ebe237ff277625caa23192f159a1be7d0a6d4.zip |
[CUDA] Change initializer for CUDA device code based on CUDA documentation.
Summary:
According to CUDA documentation, global variables declared with __device__,
__constant__ can be initialized from host code, so mark them as
externally initialized. Because __shared__ variables cannot have an
initialization as part of their declaration and since the value maybe kept
across different kernel invocation, the value of __shared__ is effectively
undefined instead of zero initialized.
Wrongly using zero initializer may cause illegitimate optimization, e.g.
removing unused __constant__ variable because it's not updated in the device
code and the value is initialized with zero.
Test Plan: test/CodeGenCUDA/address-spaces.cu
Patch by Xuetian Weng
Reviewers: jholewinski, eliben, tra, jingyue
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D12241
llvm-svn: 245786
Diffstat (limited to 'clang/lib/Serialization/Module.cpp')
0 files changed, 0 insertions, 0 deletions