Summary:
Hip texture type is equivalent to OpenCL image. So, we need to set the Image type for kernel arguments with __hip_texture type.
Differential revision: https://reviews.llvm.org/D63850
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365073
91177308-0d34-0410-b5e6-
96231b3b80d8
if (TypeQual.find("pipe") != StringRef::npos)
return ValueKind::Pipe;
+ if (isa<PointerType>(Ty) && Ty->getPointerElementType()->isStructTy() &&
+ Ty->getPointerElementType()->getStructName() == "struct.__hip_texture") {
+ return ValueKind::Image;
+ }
+
return StringSwitch<ValueKind>(BaseTypeName)
.Case("image1d_t", ValueKind::Image)
.Case("image1d_array_t", ValueKind::Image)
if (TypeQual.find("pipe") != StringRef::npos)
return "pipe";
+ if (isa<PointerType>(Ty) && Ty->getPointerElementType()->isStructTy() &&
+ Ty->getPointerElementType()->getStructName() == "struct.__hip_texture") {
+ return "image";
+ }
+
return StringSwitch<StringRef>(BaseTypeName)
.Case("image1d_t", "image")
.Case("image1d_array_t", "image")
%opencl.pipe_t = type opaque
%struct.B = type { i32 addrspace(1)*}
%opencl.clk_event_t = type opaque
+%struct.__hip_texture = type opaque
@__test_block_invoke_kernel_runtime_handle = external addrspace(1) externally_initialized constant i8 addrspace(1)*
ret void
}
+; CHECK: - .args:
+; CHECK-NEXT: - .address_space: generic
+; CHECK-NEXT: .offset: 0
+; CHECK-NEXT: .size: 8
+; CHECK-NEXT: .value_kind: image
+; CHECK-NEXT: .value_type: struct
+; CHECK: .name: _Z5EmptyP13__hip_texture
+; CHECK: .symbol: _Z5EmptyP13__hip_texture.kd
+define protected amdgpu_kernel void @_Z5EmptyP13__hip_texture(%struct.__hip_texture* nocapture) local_unnamed_addr #1 {
+ ret void
+}
+
; CHECK: amdhsa.printf:
; CHECK-NEXT: - '1:1:4:%d\n'
; CHECK-NEXT: - '2:1:8:%g\n'
%opencl.pipe_t = type opaque
%struct.B = type { i32 addrspace(1)*}
%opencl.clk_event_t = type opaque
+%struct.__hip_texture = type opaque
@__test_block_invoke_kernel_runtime_handle = external addrspace(1) externally_initialized constant i8 addrspace(1)*
ret void
}
+; CHECK: - Name: _Z5EmptyP13__hip_texture
+; CHECK: Args:
+; CHECK-NEXT: - Size: 8
+; CHECK-NEXT: Align: 8
+; CHECK-NEXT: ValueKind: Image
+; CHECK-NEXT: ValueType: Struct
+define protected amdgpu_kernel void @_Z5EmptyP13__hip_texture(%struct.__hip_texture* nocapture) local_unnamed_addr #1 {
+ ret void
+}
+
attributes #0 = { "amdgpu-implicitarg-num-bytes"="48" }
attributes #1 = { "amdgpu-implicitarg-num-bytes"="48" "runtime-handle"="__test_block_invoke_kernel_runtime_handle" }
attributes #2 = { "amdgpu-implicitarg-num-bytes"="48" "calls-enqueue-kernel" }