forked from OSchip/llvm-project
R600/SI: Insert s_waitcnt before s_barrier instructions.
This ensures that all memory operations are complete when all threads reach the barrier. llvm-svn: 225290
This commit is contained in:
parent
b3931b814a
commit
9d6797ae58
|
@ -428,6 +428,10 @@ bool SIInsertWaits::runOnMachineFunction(MachineFunction &MF) {
|
||||||
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
|
for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
|
|
||||||
|
// Wait for everything before a barrier.
|
||||||
|
if (I->getOpcode() == AMDGPU::S_BARRIER)
|
||||||
|
Changes |= insertWait(MBB, I, LastIssued);
|
||||||
|
else
|
||||||
Changes |= insertWait(MBB, I, handleOperands(*I));
|
Changes |= insertWait(MBB, I, handleOperands(*I));
|
||||||
pushInstruction(MBB, I);
|
pushInstruction(MBB, I);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
; FUNC-LABEL: {{^}}test_barrier_global:
|
; FUNC-LABEL: {{^}}test_barrier_global:
|
||||||
; EG: GROUP_BARRIER
|
; EG: GROUP_BARRIER
|
||||||
|
; SI: buffer_store_dword
|
||||||
|
; SI: s_waitcnt
|
||||||
; SI: s_barrier
|
; SI: s_barrier
|
||||||
|
|
||||||
define void @test_barrier_global(i32 addrspace(1)* %out) {
|
define void @test_barrier_global(i32 addrspace(1)* %out) {
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
; FUNC-LABEL: {{^}}test_barrier_local:
|
; FUNC-LABEL: {{^}}test_barrier_local:
|
||||||
; EG: GROUP_BARRIER
|
; EG: GROUP_BARRIER
|
||||||
|
|
||||||
|
; SI: buffer_store_dword
|
||||||
|
; SI: s_waitcnt
|
||||||
; SI: s_barrier
|
; SI: s_barrier
|
||||||
|
|
||||||
define void @test_barrier_local(i32 addrspace(1)* %out) {
|
define void @test_barrier_local(i32 addrspace(1)* %out) {
|
||||||
|
|
Loading…
Reference in New Issue