================
@@ -18,9 +39,45 @@ struct __attribute__((device_builtin_texture_type)) texture
     : public textureReference {};
 
 texture<float, 2, NormalizedFloat> tex;
+texture<float, 1, ElementType> tex_element;
+
+//===----------------------------------------------------------------------===//
+// Device-side checks
+//===----------------------------------------------------------------------===//
 
 // CIR-DEVICE: cir.global external target_address_space(1) @tex = #cir.undef : 
!cir.cuda_texture
+// CIR-DEVICE: cir.global external target_address_space(1) @tex_element = 
#cir.undef : !cir.cuda_texture
 
 // CIR now matches OG CodeGen and emits undef for CUDA shadow variables.
 // LLVM-DEVICE: @tex ={{.*}} addrspace(1) externally_initialized global i64 
undef
+// LLVM-DEVICE: @tex_element ={{.*}} addrspace(1) externally_initialized 
global i64 undef
+
 // OGCG-DEVICE: @tex ={{.*}} addrspace(1) externally_initialized global i64 
undef
+// OGCG-DEVICE: @tex_element ={{.*}} addrspace(1) externally_initialized 
global i64 undef
+
+//===----------------------------------------------------------------------===//
+// Host-side checks
+//===----------------------------------------------------------------------===//
+
+// Check the CUDA texture registration runtime declaration.
+// CIR-HOST: cir.func private 
@__cudaRegisterTexture(!cir.ptr<!cir.ptr<!void>>, !cir.ptr<!void>, 
!cir.ptr<!void>, !cir.ptr<!void>, !s32i, !s32i, !s32i)
+
+// Check texture registration metadata.
+// CIR-HOST-DAG: @tex = {{.*}}cu.var_registration = 
#cir.cu.var_registration<tex, Texture, texture_type = 2, normalized>
+// CIR-HOST-DAG: @tex_element = {{.*}}cu.var_registration = 
#cir.cu.var_registration<tex_element, Texture, texture_type = 1>
+
+// Check that the host-side shadow variables are internalized.
+// LLVM-HOST-DAG: @tex = internal global
+// LLVM-HOST-DAG: @tex_element = internal global
+
+// Check the CIR-lowered LLVM registration calls.
+// LLVM-HOST-LABEL: define internal void @__cuda_register_globals
+// LLVM-HOST-SAME: (ptr %[[FATBIN:.*]])
+// LLVM-HOST: call void @__cudaRegisterTexture(ptr %[[FATBIN]], ptr @tex, ptr 
@[[TEX_NAME:.*]], ptr @[[TEX_NAME]], i32 2, i32 1, i32 0)
+// LLVM-HOST: call void @__cudaRegisterTexture(ptr %[[FATBIN]], ptr 
@tex_element, ptr @[[ELEMENT_NAME:.*]], ptr @[[ELEMENT_NAME]], i32 1, i32 0, 
i32 0)
+
+// Check original Clang CodeGen registration calls.
+// OGCG-HOST-LABEL: define internal void @__cuda_register_globals
----------------
RiverDave wrote:

given LLVM-HOST and OGCG-HOST checks are identical, you can merge those under 
LLVM-HOST and dropping the OGCG blocks.

https://github.com/llvm/llvm-project/pull/236849
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to