From 84103b7e414bb1c384132c83f1dc20351c450e90 Mon Sep 17 00:00:00 2001 From: Vasileios Porpodas Date: Fri, 13 Mar 2026 20:13:10 +0000 Subject: [PATCH] [AMDGPU][SIInsertWaitcnts] Add test functions in waitcnt-wcg-attributes.mir This patch adds two more functions for exercising the target-cpu attribute. --- .../CodeGen/AMDGPU/waitcnt-wcg-attributes.mir | 47 +++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/llvm/test/CodeGen/AMDGPU/waitcnt-wcg-attributes.mir b/llvm/test/CodeGen/AMDGPU/waitcnt-wcg-attributes.mir index 6d1f9059ef9b7..5aab7ee8c0f27 100644 --- a/llvm/test/CodeGen/AMDGPU/waitcnt-wcg-attributes.mir +++ b/llvm/test/CodeGen/AMDGPU/waitcnt-wcg-attributes.mir @@ -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" } ... --- @@ -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 +... +