2019-07-02 15:34:40 +00:00
|
|
|
# RUN: llc -march=amdgcn -mcpu=gfx803 -run-pass si-insert-waitcnts %s -o - | FileCheck -check-prefixes=CHECK,GFX89 %s
|
|
|
|
# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass si-insert-waitcnts %s -o - | FileCheck -check-prefixes=CHECK,GFX89 %s
|
2016-10-28 23:53:48 +00:00
|
|
|
|
|
|
|
--- |
|
2017-03-21 21:39:51 +00:00
|
|
|
define amdgpu_kernel void @flat_zero_waitcnt(i32 addrspace(1)* %global4,
|
2016-10-28 23:53:48 +00:00
|
|
|
<4 x i32> addrspace(1)* %global16,
|
2018-02-02 16:07:16 +00:00
|
|
|
i32* %flat4,
|
|
|
|
<4 x i32>* %flat16) {
|
2016-10-28 23:53:48 +00:00
|
|
|
ret void
|
|
|
|
}
|
2017-03-08 01:06:58 +00:00
|
|
|
|
2017-03-21 21:39:51 +00:00
|
|
|
define amdgpu_kernel void @single_fallthrough_successor_no_end_block_wait() {
|
2017-03-08 01:06:58 +00:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-03-21 21:39:51 +00:00
|
|
|
define amdgpu_kernel void @single_branch_successor_not_next_block() {
|
2017-03-08 01:06:58 +00:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2019-07-03 00:30:44 +00:00
|
|
|
define amdgpu_kernel void @preexisting_waitcnt() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define amdgpu_kernel void @bundle_no_waitcnt() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define amdgpu_kernel void @preexisting_waitcnt_in_bundle() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define amdgpu_kernel void @insert_in_bundle() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define amdgpu_kernel void @exit_bundle() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define amdgpu_kernel void @cross_bundle() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-10-28 23:53:48 +00:00
|
|
|
...
|
|
|
|
---
|
|
|
|
|
|
|
|
# CHECK-LABEL: name: flat_zero_waitcnt
|
|
|
|
|
|
|
|
# CHECK-LABEL: bb.0:
|
|
|
|
# CHECK: FLAT_LOAD_DWORD
|
|
|
|
# CHECK: FLAT_LOAD_DWORDX4
|
|
|
|
# Global loads will return in order so we should:
|
2018-05-07 14:43:28 +00:00
|
|
|
# s_waitcnt vmcnt(1) lgkmcnt(1)
|
|
|
|
# CHECK-NEXT: S_WAITCNT 369
|
2016-10-28 23:53:48 +00:00
|
|
|
|
|
|
|
# CHECK-LABEL: bb.1:
|
|
|
|
# CHECK: FLAT_LOAD_DWORD
|
2018-06-04 16:51:59 +00:00
|
|
|
# GFX89: S_WAITCNT 112
|
2016-10-28 23:53:48 +00:00
|
|
|
# CHECK: FLAT_LOAD_DWORDX4
|
|
|
|
|
|
|
|
# CHECK-LABEL: bb.2:
|
|
|
|
# CHECK: FLAT_LOAD_DWORD
|
2018-06-04 16:51:59 +00:00
|
|
|
# GFX89: S_WAITCNT 112
|
2016-10-28 23:53:48 +00:00
|
|
|
# CHECK: FLAT_LOAD_DWORDX4
|
2017-03-08 01:06:58 +00:00
|
|
|
|
2016-10-28 23:53:48 +00:00
|
|
|
name: flat_zero_waitcnt
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
successors: %bb.1
|
2019-04-30 22:08:23 +00:00
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 4 from %ir.global4)
|
|
|
|
$vgpr3_vgpr4_vgpr5_vgpr6 = FLAT_LOAD_DWORDX4 $vgpr7_vgpr8, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 16 from %ir.global16)
|
2018-01-31 22:04:26 +00:00
|
|
|
$vgpr0 = V_MOV_B32_e32 $vgpr1, implicit $exec
|
2016-10-28 23:53:48 +00:00
|
|
|
S_BRANCH %bb.1
|
|
|
|
|
|
|
|
bb.1:
|
|
|
|
successors: %bb.2
|
2019-04-30 22:08:23 +00:00
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
$vgpr3_vgpr4_vgpr5_vgpr6 = FLAT_LOAD_DWORDX4 $vgpr7_vgpr8, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 16 from %ir.global16)
|
2018-01-31 22:04:26 +00:00
|
|
|
$vgpr0 = V_MOV_B32_e32 $vgpr1, implicit $exec
|
2016-10-28 23:53:48 +00:00
|
|
|
S_BRANCH %bb.2
|
|
|
|
|
|
|
|
bb.2:
|
2019-04-30 22:08:23 +00:00
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 4 from %ir.flat4)
|
|
|
|
$vgpr3_vgpr4_vgpr5_vgpr6 = FLAT_LOAD_DWORDX4 $vgpr7_vgpr8, 0, 0, 0, 0, implicit $exec, implicit $flat_scr :: (load 16 from %ir.flat16)
|
2018-01-31 22:04:26 +00:00
|
|
|
$vgpr0 = V_MOV_B32_e32 $vgpr1, implicit $exec
|
[AMDGPU] Add support for immediate operand for S_ENDPGM
Summary:
Add support for immediate operand in S_ENDPGM
Change-Id: I0c56a076a10980f719fb2a8f16407e9c301013f6
Reviewers: alexshap
Subscribers: qcolombet, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, eraman, arphaman, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59213
llvm-svn: 355902
2019-03-12 09:52:58 +00:00
|
|
|
S_ENDPGM 0
|
2016-10-28 23:53:48 +00:00
|
|
|
...
|
2017-03-08 01:06:58 +00:00
|
|
|
---
|
|
|
|
# There is only a single fallthrough successor block, so there's no
|
|
|
|
# need to wait immediately.
|
|
|
|
|
|
|
|
# CHECK-LABEL: name: single_fallthrough_successor_no_end_block_wait
|
2018-01-31 22:04:26 +00:00
|
|
|
# CHECK: $vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2
|
2017-03-08 01:06:58 +00:00
|
|
|
# CHECK-NOT: S_WAITCNT
|
|
|
|
|
|
|
|
# CHECK: bb.1:
|
|
|
|
# CHECK-NEXT: V_LSHLREV_B64
|
|
|
|
# CHECK-NEXT: S_WAITCNT 112
|
|
|
|
# CHECK-NEXT: FLAT_STORE_DWORD
|
|
|
|
name: single_fallthrough_successor_no_end_block_wait
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
successors: %bb.1
|
2019-04-30 22:08:23 +00:00
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
2017-03-08 01:06:58 +00:00
|
|
|
|
|
|
|
bb.1:
|
2018-01-31 22:04:26 +00:00
|
|
|
$vgpr3_vgpr4 = V_LSHLREV_B64 4, $vgpr7_vgpr8, implicit $exec
|
2019-04-30 22:08:23 +00:00
|
|
|
FLAT_STORE_DWORD $vgpr3_vgpr4, $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
[AMDGPU] Add support for immediate operand for S_ENDPGM
Summary:
Add support for immediate operand in S_ENDPGM
Change-Id: I0c56a076a10980f719fb2a8f16407e9c301013f6
Reviewers: alexshap
Subscribers: qcolombet, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, eraman, arphaman, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59213
llvm-svn: 355902
2019-03-12 09:52:58 +00:00
|
|
|
S_ENDPGM 0
|
2017-03-08 01:06:58 +00:00
|
|
|
...
|
|
|
|
---
|
|
|
|
# The block has a single predecessor with a single successor, but it
|
|
|
|
# is not the next block so it's non-obvious that the wait is not needed.
|
|
|
|
|
|
|
|
|
|
|
|
# CHECK-LABEL: name: single_branch_successor_not_next_block
|
|
|
|
|
|
|
|
# CHECK: bb.1
|
|
|
|
# CHECK-NEXT: FLAT_STORE_DWORD
|
[AMDGPU] Add support for immediate operand for S_ENDPGM
Summary:
Add support for immediate operand in S_ENDPGM
Change-Id: I0c56a076a10980f719fb2a8f16407e9c301013f6
Reviewers: alexshap
Subscribers: qcolombet, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, eraman, arphaman, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59213
llvm-svn: 355902
2019-03-12 09:52:58 +00:00
|
|
|
# CHECK-NEXT: S_ENDPGM 0
|
2017-03-08 01:06:58 +00:00
|
|
|
|
|
|
|
# CHECK: bb.2:
|
|
|
|
# CHECK-NEXT: V_LSHLREV_B64
|
2018-05-07 14:43:28 +00:00
|
|
|
# CHECK-NEXT: S_WAITCNT 112
|
2017-03-08 01:06:58 +00:00
|
|
|
# CHECK-NEXT: FLAT_STORE_DWORD
|
|
|
|
name: single_branch_successor_not_next_block
|
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
successors: %bb.2
|
2019-04-30 22:08:23 +00:00
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
2017-03-08 01:06:58 +00:00
|
|
|
S_BRANCH %bb.2
|
|
|
|
|
|
|
|
bb.1:
|
2019-04-30 22:08:23 +00:00
|
|
|
FLAT_STORE_DWORD $vgpr8_vgpr9, $vgpr10, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
[AMDGPU] Add support for immediate operand for S_ENDPGM
Summary:
Add support for immediate operand in S_ENDPGM
Change-Id: I0c56a076a10980f719fb2a8f16407e9c301013f6
Reviewers: alexshap
Subscribers: qcolombet, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, eraman, arphaman, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59213
llvm-svn: 355902
2019-03-12 09:52:58 +00:00
|
|
|
S_ENDPGM 0
|
2017-03-08 01:06:58 +00:00
|
|
|
|
|
|
|
bb.2:
|
2018-01-31 22:04:26 +00:00
|
|
|
$vgpr3_vgpr4 = V_LSHLREV_B64 4, $vgpr7_vgpr8, implicit $exec
|
2019-04-30 22:08:23 +00:00
|
|
|
FLAT_STORE_DWORD $vgpr3_vgpr4, $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
[AMDGPU] Add support for immediate operand for S_ENDPGM
Summary:
Add support for immediate operand in S_ENDPGM
Change-Id: I0c56a076a10980f719fb2a8f16407e9c301013f6
Reviewers: alexshap
Subscribers: qcolombet, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, eraman, arphaman, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59213
llvm-svn: 355902
2019-03-12 09:52:58 +00:00
|
|
|
S_ENDPGM 0
|
2017-03-08 01:06:58 +00:00
|
|
|
...
|
2019-07-03 00:30:44 +00:00
|
|
|
|
|
|
|
# CHECK-LABEL: name: preexisting_waitcnt{{$}}
|
|
|
|
# CHECK: FLAT_LOAD_DWORD
|
|
|
|
# CHECK-NEXT: S_WAITCNT 0
|
|
|
|
# CHECK-NOT: S_WAITCNT
|
|
|
|
name: preexisting_waitcnt
|
|
|
|
tracksRegLiveness: true
|
|
|
|
machineFunctionInfo:
|
|
|
|
isEntryFunction: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr1_vgpr2
|
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
S_WAITCNT 0
|
|
|
|
FLAT_STORE_DWORD $vgpr1_vgpr2, $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# CHECK-LABEL: name: bundle_no_waitcnt{{$}}
|
|
|
|
# CHECK: FLAT_LOAD_DWORD
|
|
|
|
# CHECK-NEXT: BUNDLE
|
|
|
|
# CHECK-NEXT: S_NOP
|
|
|
|
# CHECK-NEXT: S_NOP
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: S_WAITCNT 112
|
|
|
|
name: bundle_no_waitcnt
|
|
|
|
tracksRegLiveness: true
|
|
|
|
machineFunctionInfo:
|
|
|
|
isEntryFunction: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr1_vgpr2
|
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
BUNDLE {
|
|
|
|
S_NOP 0
|
|
|
|
S_NOP 0
|
|
|
|
}
|
|
|
|
FLAT_STORE_DWORD $vgpr1_vgpr2, $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# See the waitcnt inside the bundle and don't insert an extra
|
|
|
|
# CHECK-LABEL: name: preexisting_waitcnt_in_bundle{{$}}
|
|
|
|
# CHECK: FLAT_LOAD_DWORD
|
|
|
|
# CHECK: S_WAITCNT 0
|
|
|
|
# CHECK-NOT: S_WAITCNT
|
|
|
|
name: preexisting_waitcnt_in_bundle
|
|
|
|
tracksRegLiveness: true
|
|
|
|
machineFunctionInfo:
|
|
|
|
isEntryFunction: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr1_vgpr2
|
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
BUNDLE {
|
|
|
|
S_NOP 0
|
|
|
|
S_WAITCNT 0
|
|
|
|
}
|
|
|
|
FLAT_STORE_DWORD $vgpr1_vgpr2, $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# Def and use inside bundle
|
|
|
|
# CHECK-LABEL: name: insert_in_bundle{{$}}
|
|
|
|
# CHECK: BUNDLE implicit-def $vgpr0, implicit $vgpr1_vgpr2 {
|
|
|
|
# CHECK-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
# CHECK-NEXT: S_WAITCNT 112
|
|
|
|
# CHECK-NEXT: FLAT_STORE_DWORD $vgpr1_vgpr2, internal $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
|
|
|
|
name: insert_in_bundle
|
|
|
|
tracksRegLiveness: true
|
|
|
|
machineFunctionInfo:
|
|
|
|
isEntryFunction: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr1_vgpr2
|
|
|
|
BUNDLE implicit-def $vgpr0, implicit $vgpr1_vgpr2 {
|
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
FLAT_STORE_DWORD $vgpr1_vgpr2, internal $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
}
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# Def is last instruction in bundle, use is outside bundle
|
|
|
|
|
|
|
|
# CHECK-LABEL: name: exit_bundle{{$}}
|
|
|
|
# CHECK: BUNDLE implicit-def $vgpr0, implicit $vgpr1_vgpr2 {
|
|
|
|
# CHECK-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: S_WAITCNT 112
|
|
|
|
# CHECK-NEXT: FLAT_STORE_DWORD $vgpr1_vgpr2, $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
|
|
|
|
name: exit_bundle
|
|
|
|
tracksRegLiveness: true
|
|
|
|
machineFunctionInfo:
|
|
|
|
isEntryFunction: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr1_vgpr2
|
|
|
|
BUNDLE implicit-def $vgpr0, implicit $vgpr1_vgpr2 {
|
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
}
|
|
|
|
|
|
|
|
FLAT_STORE_DWORD $vgpr1_vgpr2, $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
# Def is in bundle, use is in another bundle
|
|
|
|
|
|
|
|
# CHECK-LABEL: name: cross_bundle{{$}}
|
|
|
|
# CHECK: BUNDLE implicit-def $vgpr0, implicit $vgpr1_vgpr2 {
|
|
|
|
# CHECK-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: S_WAITCNT 112
|
|
|
|
# CHECK-NEXT: BUNDLE implicit $vgpr0, implicit $vgpr1_vgpr2 {
|
|
|
|
# CHECK-NEXT: FLAT_STORE_DWORD $vgpr1_vgpr2, $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
|
|
|
|
name: cross_bundle
|
|
|
|
tracksRegLiveness: true
|
|
|
|
machineFunctionInfo:
|
|
|
|
isEntryFunction: true
|
|
|
|
body: |
|
|
|
|
bb.0:
|
|
|
|
liveins: $vgpr1_vgpr2
|
|
|
|
BUNDLE implicit-def $vgpr0, implicit $vgpr1_vgpr2 {
|
|
|
|
$vgpr0 = FLAT_LOAD_DWORD $vgpr1_vgpr2, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
}
|
|
|
|
BUNDLE implicit $vgpr0, implicit $vgpr1_vgpr2 {
|
|
|
|
FLAT_STORE_DWORD $vgpr1_vgpr2, $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr
|
|
|
|
}
|
|
|
|
...
|