This revision was automatically updated to reflect the committed changes.
Closed by commit rG6ec36d18ec7b: [cuda] Mark builtin texture/surface reference 
variable as… (authored by hliao).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107718/new/

https://reviews.llvm.org/D107718

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenCUDA/surface.cu
  clang/test/CodeGenCUDA/texture.cu


Index: clang/test/CodeGenCUDA/texture.cu
===================================================================
--- clang/test/CodeGenCUDA/texture.cu
+++ clang/test/CodeGenCUDA/texture.cu
@@ -19,8 +19,8 @@
 };
 
 // On the device side, texture references are represented as `i64` handles.
-// DEVICE: @tex ={{.*}} addrspace(1) global i64 undef, align 4
-// DEVICE: @norm ={{.*}} addrspace(1) global i64 undef, align 4
+// DEVICE: @tex ={{.*}} addrspace(1) externally_initialized global i64 undef, 
align 4
+// DEVICE: @norm ={{.*}} addrspace(1) externally_initialized global i64 undef, 
align 4
 // On the host side, they remain in the original type.
 // HOST: @tex = internal global %struct.texture
 // HOST: @norm = internal global %struct.texture
Index: clang/test/CodeGenCUDA/surface.cu
===================================================================
--- clang/test/CodeGenCUDA/surface.cu
+++ clang/test/CodeGenCUDA/surface.cu
@@ -19,7 +19,7 @@
 };
 
 // On the device side, surface references are represented as `i64` handles.
-// DEVICE: @surf ={{.*}} addrspace(1) global i64 undef, align 4
+// DEVICE: @surf ={{.*}} addrspace(1) externally_initialized global i64 undef, 
align 4
 // On the host side, they remain in the original type.
 // HOST: @surf = internal global %struct.surface
 // HOST: @0 = private unnamed_addr constant [5 x i8] c"surf\00"
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -4438,7 +4438,9 @@
   if (GV && LangOpts.CUDA) {
     if (LangOpts.CUDAIsDevice) {
       if (Linkage != llvm::GlobalValue::InternalLinkage &&
-          (D->hasAttr<CUDADeviceAttr>() || D->hasAttr<CUDAConstantAttr>()))
+          (D->hasAttr<CUDADeviceAttr>() || D->hasAttr<CUDAConstantAttr>() ||
+           D->getType()->isCUDADeviceBuiltinSurfaceType() ||
+           D->getType()->isCUDADeviceBuiltinTextureType()))
         GV->setExternallyInitialized(true);
     } else {
       getCUDARuntime().internalizeDeviceSideVar(D, Linkage);


Index: clang/test/CodeGenCUDA/texture.cu
===================================================================
--- clang/test/CodeGenCUDA/texture.cu
+++ clang/test/CodeGenCUDA/texture.cu
@@ -19,8 +19,8 @@
 };
 
 // On the device side, texture references are represented as `i64` handles.
-// DEVICE: @tex ={{.*}} addrspace(1) global i64 undef, align 4
-// DEVICE: @norm ={{.*}} addrspace(1) global i64 undef, align 4
+// DEVICE: @tex ={{.*}} addrspace(1) externally_initialized global i64 undef, align 4
+// DEVICE: @norm ={{.*}} addrspace(1) externally_initialized global i64 undef, align 4
 // On the host side, they remain in the original type.
 // HOST: @tex = internal global %struct.texture
 // HOST: @norm = internal global %struct.texture
Index: clang/test/CodeGenCUDA/surface.cu
===================================================================
--- clang/test/CodeGenCUDA/surface.cu
+++ clang/test/CodeGenCUDA/surface.cu
@@ -19,7 +19,7 @@
 };
 
 // On the device side, surface references are represented as `i64` handles.
-// DEVICE: @surf ={{.*}} addrspace(1) global i64 undef, align 4
+// DEVICE: @surf ={{.*}} addrspace(1) externally_initialized global i64 undef, align 4
 // On the host side, they remain in the original type.
 // HOST: @surf = internal global %struct.surface
 // HOST: @0 = private unnamed_addr constant [5 x i8] c"surf\00"
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -4438,7 +4438,9 @@
   if (GV && LangOpts.CUDA) {
     if (LangOpts.CUDAIsDevice) {
       if (Linkage != llvm::GlobalValue::InternalLinkage &&
-          (D->hasAttr<CUDADeviceAttr>() || D->hasAttr<CUDAConstantAttr>()))
+          (D->hasAttr<CUDADeviceAttr>() || D->hasAttr<CUDAConstantAttr>() ||
+           D->getType()->isCUDADeviceBuiltinSurfaceType() ||
+           D->getType()->isCUDADeviceBuiltinTextureType()))
         GV->setExternallyInitialized(true);
     } else {
       getCUDARuntime().internalizeDeviceSideVar(D, Linkage);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to