1 ; RUN: llvm-split -o %t %s -j 3 -mtriple amdgcn-amd-amdhsa
2 ; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK0 %s
3 ; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK1 %s
4 ; RUN: llvm-dis -o - %t2 | FileCheck --check-prefix=CHECK2 %s
6 ; Test load balancing logic with 6 kernels.
8 ; Kernels go from most expensive (A == 6) to least expensive (F == 1)
10 ; Load balancing should work like this (current partition cost is in parens)
12 ; Initial -> [P0(0), P1(0), P2(0)]
14 ; A(6) goes in 2 -> [P2(6), P0(0), P1(0)]
15 ; B(5) goes in 1 -> [P2(6), P1(5), P0(4)]
16 ; C(4) goes in 0 -> [P2(6), P1(5), P0(4)]
18 ; D(3) goes in 0 -> [P0(7), P2(6), P1(5)]
19 ; E(2) goes in 1 -> [P0(7), P1(7), P2(6)]
20 ; F(1) goes in 2 -> [P0(7), P1(7), P2(7)]
23 ; CHECK0: define amdgpu_kernel void @C
24 ; CHECK0: define amdgpu_kernel void @D
28 ; CHECK1: define amdgpu_kernel void @B
29 ; CHECK1: define amdgpu_kernel void @E
33 ; CHECK2: define amdgpu_kernel void @A
34 ; CHECK2: define amdgpu_kernel void @F
38 define amdgpu_kernel void @A(ptr %x) {
47 define amdgpu_kernel void @B(ptr %x) {
55 define amdgpu_kernel void @C(ptr %x) {
62 define amdgpu_kernel void @D(ptr %x) {
68 define amdgpu_kernel void @E(ptr %x) {
73 define amdgpu_kernel void @F() {