Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 44 additions & 3 deletions llvm/test/CodeGen/AMDGPU/waitcnt-wcg-attributes.mir
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@
# RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs -run-pass si-insert-waitcnts -o - %s | FileCheck %s

# Checks that the WaitcntGenerator updates its behavior when we switch MFs
# with different attributes. The two functions have identical bodies but one
# has theh expert-scheduling attribute off and the other on, so we expect
# different code generated by SIInsertWaitcnts.
# with different attributes.
# There are 2 pairs of functions, each testing an attribute:
# The first pair is testing amdgpu-expert-scheduling-mode
# and the second is testing target-cpu
#
# In each function pair the function bodies are identical and the only
# difference is the attribute.


--- |
define amdgpu_kernel void @test-wcg-attributes-noexpert() #0 { ret void }
define amdgpu_kernel void @test-wcg-attributes-expert() #1 { ret void }
define amdgpu_kernel void @test-wcg-attributes-gfx900() #2 { ret void }
define amdgpu_kernel void @test-wcg-attributes-gfx1200() #3 { ret void }
attributes #0 = { "amdgpu-expert-scheduling-mode"="false" }
attributes #1 = { "amdgpu-expert-scheduling-mode"="true" }
attributes #2 = { "target-cpu"="gfx900" }
attributes #3 = { "target-cpu"="gfx1200" }
...

---
Expand Down Expand Up @@ -51,3 +60,35 @@ body: |
S_ENDPGM 0
...

---
name: test-wcg-attributes-gfx900
body: |
bb.0:
; CHECK-LABEL: name: test-wcg-attributes-gfx900
; CHECK: S_WAITCNT 0
; CHECK-NEXT: $vgpr1 = nofpexcept V_EXP_F32_e32 $vgpr0, implicit $mode, implicit $exec
; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = DS_READ_B128_gfx9 renamable $vgpr36, 8224, 0, implicit $exec
; CHECK-NEXT: S_ENDPGM 0
$vgpr1 = nofpexcept V_EXP_F32_e32 $vgpr0, implicit $mode, implicit $exec
$vgpr0_vgpr1_vgpr2_vgpr3 = DS_READ_B128_gfx9 renamable $vgpr36, 8224, 0, implicit $exec
S_ENDPGM 0
...

---
name: test-wcg-attributes-gfx1200
body: |
bb.0:
; CHECK-LABEL: name: test-wcg-attributes-gfx1200
; CHECK: S_WAIT_LOADCNT_DSCNT 0
; CHECK-NEXT: S_WAIT_EXPCNT 0
; CHECK-NEXT: S_WAIT_SAMPLECNT 0
; CHECK-NEXT: S_WAIT_BVHCNT 0
; CHECK-NEXT: S_WAIT_KMCNT 0
; CHECK-NEXT: $vgpr1 = nofpexcept V_EXP_F32_e32 $vgpr0, implicit $mode, implicit $exec
; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = DS_READ_B128_gfx9 renamable $vgpr36, 8224, 0, implicit $exec
; CHECK-NEXT: S_ENDPGM 0
$vgpr1 = nofpexcept V_EXP_F32_e32 $vgpr0, implicit $mode, implicit $exec
$vgpr0_vgpr1_vgpr2_vgpr3 = DS_READ_B128_gfx9 renamable $vgpr36, 8224, 0, implicit $exec
S_ENDPGM 0
...