[llvm] r365073 - [AMDGPU] Kernel arg metadata: added support for "__hip_texture" type.
Konstantin Pyzhov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 3 12:11:35 PDT 2019
Author: kpyzhov
Date: Wed Jul 3 12:11:35 2019
New Revision: 365073
URL: http://llvm.org/viewvc/llvm-project?rev=365073&view=rev
Log:
[AMDGPU] Kernel arg metadata: added support for "__hip_texture" type.
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
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full-v3.ll
llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp?rev=365073&r1=365072&r2=365073&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp Wed Jul 3 12:11:35 2019
@@ -104,6 +104,11 @@ ValueKind MetadataStreamerV2::getValueKi
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)
@@ -541,6 +546,11 @@ StringRef MetadataStreamerV3::getValueKi
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")
Modified: llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full-v3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full-v3.ll?rev=365073&r1=365072&r2=365073&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full-v3.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full-v3.ll Wed Jul 3 12:11:35 2019
@@ -13,6 +13,7 @@
%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)*
@@ -1496,6 +1497,18 @@ define amdgpu_kernel void @unknown_addrs
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'
Modified: llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll?rev=365073&r1=365072&r2=365073&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-from-llvm-ir-full.ll Wed Jul 3 12:11:35 2019
@@ -13,6 +13,7 @@
%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)*
@@ -1484,6 +1485,16 @@ define amdgpu_kernel void @unknown_addrs
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" }
More information about the llvm-commits
mailing list