[all-commits] [llvm/llvm-project] 47acde: [CUDA][HIP] Support accessing static device variab...

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Wed Feb 24 15:41:48 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 47acdec1dd5d6d4c279727a97313c586c20e9c6f
      https://github.com/llvm/llvm-project/commit/47acdec1dd5d6d4c279727a97313c586c20e9c6f
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2021-02-24 (Wed, 24 Feb 2021)

  Changed paths:
    M clang/include/clang/AST/ASTContext.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/CodeGen/CGCUDANV.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/CodeGenModule.h
    M clang/test/CodeGenCUDA/device-var-linkage.cu
    M clang/test/CodeGenCUDA/managed-var.cu
    A clang/test/CodeGenCUDA/static-device-var-rdc.cu
    A clang/test/SemaCUDA/static-device-var.cu

  Log Message:
  -----------
  [CUDA][HIP] Support accessing static device variable in host code for -fgpu-rdc

For -fgpu-rdc mode, static device vars in different TU's may have the same name.
To support accessing file-scope static device variables in host code, we need to give them
a distinct name and external linkage. This can be done by postfixing each static device variable with
a distinct CUID (Compilation Unit ID) hash.

Since the static device variables have different name across compilation units, now we let
them have external linkage so that they can be looked up by the runtime.

Reviewed by: Artem Belevich, and Jon Chesterfield

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




More information about the All-commits mailing list