Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 1 addition & 3 deletions llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2245,9 +2245,7 @@ bool ClusteredLowOccStage::shouldRevertScheduling(unsigned WavesAfter) {
}

bool PreRARematStage::shouldRevertScheduling(unsigned WavesAfter) {
// When trying to increase occupancy (TargetOcc == true) the stage manages
// region reverts globally (all or none), so we always return false here.
return !TargetOcc && mayCauseSpilling(WavesAfter);
return mayCauseSpilling(WavesAfter);
Comment thread
lucas-rami marked this conversation as resolved.
Resolved
}

bool ILPInitialScheduleStage::shouldRevertScheduling(unsigned WavesAfter) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# RUN: llc -mtriple=amdgpu9.00-amd-amdhsa -start-before=machine-scheduler -stop-after=greedy,2 -verify-machineinstrs -o - %s | FileCheck %s

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# RUN: llc -mtriple=amdgpu9.00-amd-amdhsa -start-before=machine-scheduler -stop-after=greedy,2 -verify-machineinstrs -o - %s | FileCheck %s
# RUN: llc -mtriple=amdgpu9.00-amd-amdhsa -start-before=machine-scheduler -stop-after=greedy,2 -o - %s | FileCheck %s


# Check that rematerialization for higher occupancy does not introduce spills.

# CHECK-LABEL: name: remat_occupancy_no_spill
# CHECK-NOT: SI_SPILL_

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use -NOT checks, check what is emitted

# CHECK: S_ENDPGM

--- |
define amdgpu_kernel void @remat_occupancy_no_spill() #0 {
ret void
}

attributes #0 = { "amdgpu-waves-per-eu"="9,10" "amdgpu-num-vgpr"="25" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't introduce new uses of amdgpu-num-vgpr, it's in the middle of removal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve addressed all three comments on the regression test. Could you take another look at the test changes, including the expectation updates in machine-scheduler-sink-trivial-remats.mir and machine-scheduler-rematerialization-scoring.mir?

...
---
name: remat_occupancy_no_spill
tracksRegLiveness: true
machineFunctionInfo:
isEntryFunction: true
stackPtrOffsetReg: '$sgpr32'
body: |
bb.0:
successors: %bb.1

S_NOP 0, implicit-def %live16:vreg_512, implicit-def %live5:vreg_160
%loaded:vreg_64 = DS_READ2_B32_gfx9 %live5.sub0, 0, 1, 0, implicit $exec :: (load (s64), align 4, addrspace 3)
%address:vgpr_32 = V_ADD_U32_e64 16, %live5.sub0, 0, implicit $exec

bb.1:
successors: %bb.2

%converted0:vgpr_32 = nofpexcept V_CVT_F32_I32_e32 %loaded.sub0, implicit $exec, implicit $mode
DS_WRITE_B32_gfx9 %live5.sub0, %converted0, 8, 0, implicit $exec :: (store (s32), addrspace 3)

%converted1:vgpr_32 = nofpexcept V_CVT_F32_I32_e32 %loaded.sub1, implicit $exec, implicit $mode
DS_WRITE_B32_gfx9 %live5.sub0, %converted1, 12, 0, implicit $exec :: (store (s32), addrspace 3)
DS_WRITE_B32_gfx9 %address, %loaded.sub0, 0, 0, implicit $exec :: (store (s32), addrspace 3)
DS_WRITE_B32_gfx9 %address, %loaded.sub1, 4, 0, implicit $exec :: (store (s32), addrspace 3)

bb.2:
S_NOP 0, implicit %live16, implicit %live5, implicit %loaded
S_ENDPGM 0
...
Loading