[PATCH] D38958: AMDGPU: Start generating metadata for MaxFlatWorkGroupSize

Konstantin Zhuravlyov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 13:03:44 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL316024: AMDGPU: Start generating metadata for MaxFlatWorkGroupSize (authored by kzhuravl).

Changed prior to commit:
  https://reviews.llvm.org/D38958?vs=119167&id=119380#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38958

Files:
  llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
  llvm/trunk/test/CodeGen/AMDGPU/attr-amdgpu-flat-work-group-size.ll
  llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-kernel-code-props.ll
  llvm/trunk/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s


Index: llvm/trunk/test/CodeGen/AMDGPU/attr-amdgpu-flat-work-group-size.ll
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/attr-amdgpu-flat-work-group-size.ll
+++ llvm/trunk/test/CodeGen/AMDGPU/attr-amdgpu-flat-work-group-size.ll
@@ -1,4 +1,5 @@
-; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=fiji -verify-machineinstrs < %s | FileCheck %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 < %s | FileCheck --check-prefix=CHECK %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -filetype=obj -o - < %s | llvm-readobj -elf-output-style=GNU -notes | FileCheck --check-prefix=HSAMD %s
 
 ; CHECK-LABEL: {{^}}min_64_max_64:
 ; CHECK: SGPRBlocks: 0
@@ -127,3 +128,15 @@
   ret void
 }
 attributes #3 = {"amdgpu-flat-work-group-size"="1024,2048"}
+
+; HSAMD: NT_AMD_AMDGPU_HSA_METADATA (HSA Metadata)
+; HSAMD: Version: [ 1, 0 ]
+; HSAMD: Kernels:
+; HSAMD: - Name:                 min_64_max_64
+; HSAMD:   MaxFlatWorkgroupSize: 64
+; HSAMD: - Name:                 min_64_max_128
+; HSAMD:   MaxFlatWorkgroupSize: 128
+; HSAMD: - Name:                 min_128_max_128
+; HSAMD:   MaxFlatWorkgroupSize: 128
+; HSAMD: - Name:                 min_1024_max_2048
+; HSAMD:   MaxFlatWorkgroupSize: 2048
Index: llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-kernel-code-props.ll
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-kernel-code-props.ll
+++ llvm/trunk/test/CodeGen/AMDGPU/hsa-metadata-kernel-code-props.ll
@@ -9,17 +9,18 @@
 ; CHECK:    - Name:       test
 ; CHECK:      SymbolName: 'test at kd'
 ; CHECK:      CodeProps:
-; CHECK:        KernargSegmentSize:  24
-; CHECK:        GroupSegmentFixedSize: 0
+; CHECK:        KernargSegmentSize:      24
+; CHECK:        GroupSegmentFixedSize:   0
 ; CHECK:        PrivateSegmentFixedSize: 0
-; CHECK:        KernargSegmentAlign: 8
-; CHECK:        WavefrontSize: 64
-; GFX700:       NumSGPRs: 6
-; GFX800:       NumSGPRs: 96
-; GFX900:       NumSGPRs: 6
-; GFX700:       NumVGPRs: 4
-; GFX800:       NumVGPRs: 6
-; GFX900:       NumVGPRs: 6
+; CHECK:        KernargSegmentAlign:     8
+; CHECK:        WavefrontSize:           64
+; GFX700:       NumSGPRs:                6
+; GFX800:       NumSGPRs:                96
+; GFX900:       NumSGPRs:                6
+; GFX700:       NumVGPRs:                4
+; GFX800:       NumVGPRs:                6
+; GFX900:       NumVGPRs:                6
+; CHECK:        MaxFlatWorkgroupSize:    256
 define amdgpu_kernel void @test(
     half addrspace(1)* %r,
     half addrspace(1)* %a,
Index: llvm/trunk/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s
===================================================================
--- llvm/trunk/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s
+++ llvm/trunk/test/MC/AMDGPU/hsa-metadata-kernel-code-props.s
@@ -13,6 +13,7 @@
 // CHECK:          PrivateSegmentFixedSize: 16
 // CHECK:          KernargSegmentAlign:     16
 // CHECK:          WavefrontSize:           64
+// CHECK:          MaxFlatWorkgroupSize:    256
 .amd_amdgpu_hsa_metadata
   Version: [ 1, 0 ]
   Printf: [ '1:1:4:%d\n', '2:1:8:%g\n' ]
@@ -25,4 +26,5 @@
         PrivateSegmentFixedSize: 16
         KernargSegmentAlign:     16
         WavefrontSize:           64
+        MaxFlatWorkgroupSize:    256
 .end_amd_amdgpu_hsa_metadata
Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -1179,7 +1179,7 @@
   HSACodeProps.mWavefrontSize = STM.getWavefrontSize();
   HSACodeProps.mNumSGPRs = CurrentProgramInfo.NumSGPR;
   HSACodeProps.mNumVGPRs = CurrentProgramInfo.NumVGPR;
-  // TODO: Emit HSACodeProps.mMaxFlatWorkgroupSize.
+  HSACodeProps.mMaxFlatWorkgroupSize = MFI.getMaxFlatWorkGroupSize();
   HSACodeProps.mIsDynamicCallStack = ProgramInfo.DynamicCallStack;
   HSACodeProps.mIsXNACKEnabled = STM.isXNACKEnabled();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38958.119380.patch
Type: text/x-patch
Size: 4027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171017/9a651d94/attachment.bin>


More information about the llvm-commits mailing list