]> granicus.if.org Git - llvm/commitdiff
AMDGPU: Start generating metadata for MaxFlatWorkGroupSize
authorKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Tue, 17 Oct 2017 20:03:21 +0000 (20:03 +0000)
committerKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Tue, 17 Oct 2017 20:03:21 +0000 (20:03 +0000)
Differential Revision: https://reviews.llvm.org/D38958

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316024 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 1adede07ed1fc85451e6072f9377f196e3786e3f..52ac53260b00920c1db786cc25ca2142e36fc8fe 100644 (file)
@@ -1179,7 +1179,7 @@ AMDGPU::HSAMD::Kernel::CodeProps::Metadata AMDGPUAsmPrinter::getHSACodeProps(
   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();
 
index a0694fb1e3c91b53a62381ba679d98168258c218..3e2a5d2e4cc5fa9121fdc6df460fcea032a2e2f3 100644 (file)
@@ -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 @@ define amdgpu_kernel void @min_1024_max_2048() #3 {
   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 ae839bb079a715c734133bdf809cd103da3f80ec..177dbd78a5f56b064203c6ced0cc6549eed2c9df 100644 (file)
@@ -9,17 +9,18 @@
 ; CHECK:    - Name:       test
 ; CHECK:      SymbolName: 'test@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 e290235b16c82dc2d43a9b130c68b18f699ddf73..d56fcfcf064ecca35ce60f2709f29265c3d50284 100644 (file)
@@ -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