HomePhabricator

[CUDA][HIP] Fix static device var used by host code only

Authored by yaxunl on Sep 22 2020, 9:52 AM.

Description

[CUDA][HIP] Fix static device var used by host code only

A static device variable may be accessed in host code through
cudaMemCpyFromSymbol etc. Currently clang does not
emit the static device variable if it is only referenced by
host code, which causes host code to fail at run time.

This patch fixes that.

Differential Revision: https://reviews.llvm.org/D88115

Details