1; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -amdgpu-propagate-attributes-late %s | FileCheck %s
2
3; CHECK: define internal void @max_flat_1_1024() #0 {
4define internal void @max_flat_1_1024() #0 {
5  ret void
6}
7
8; CHECK: define internal void @max_flat_1_256() #1 {
9define internal void @max_flat_1_256() #1 {
10  ret void
11}
12
13; CHECK: define amdgpu_kernel void @kernel_1_256_call_default() #1 {
14define amdgpu_kernel void @kernel_1_256_call_default() #1 {
15  call void @default()
16  ret void
17}
18
19; CHECK: define amdgpu_kernel void @kernel_1_256_call_1_256() #1 {
20define amdgpu_kernel void @kernel_1_256_call_1_256() #1 {
21  call void @max_flat_1_256()
22  ret void
23}
24
25; CHECK: define amdgpu_kernel void @kernel_1_256_call_64_64() #1 {
26define amdgpu_kernel void @kernel_1_256_call_64_64() #1 {
27  call void @max_flat_64_64()
28  ret void
29}
30
31; CHECK: define internal void @max_flat_64_64() #2 {
32define internal void @max_flat_64_64() #2 {
33  ret void
34}
35
36; CHECK: define internal void @default() #2 {
37define internal void @default() #3 {
38  ret void
39}
40
41attributes #0 = { noinline "amdgpu-flat-work-group-size"="1,1024" }
42attributes #1 = { noinline "amdgpu-flat-work-group-size"="1,256" }
43attributes #2 = { noinline "amdgpu-flat-work-group-size"="64,64" }
44attributes #3 = { noinline }
45
46; CHECK: attributes #0 = { noinline "amdgpu-flat-work-group-size"="1,1024"
47; CHECK-NEXT: attributes #1 = { noinline "amdgpu-flat-work-group-size"="1,256"
48; CHECK-NEXT: attributes #2 = { noinline "amdgpu-flat-work-group-size"="1,256"
49