-
Notifications
You must be signed in to change notification settings - Fork 13.9k
[AMDGPU] Make the iterative schedulers selectable via amdgpu-sched-strategy #135042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rategy Change-Id: Id0563e4161c36ba319e095cb793ea38b4fd1fd46
@llvm/pr-subscribers-backend-amdgpu Author: Jeffrey Byrnes (jrbyrnes) ChangesCurrently, the only way for users to try these schedulers is via Full diff: https://github.com/llvm/llvm-project/pull/135042.diff 3 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index 4b5c70f09155f..8d16b4f2bc818 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -1085,6 +1085,15 @@ GCNTargetMachine::createMachineScheduler(MachineSchedContext *C) const {
if (SchedStrategy == "max-memory-clause")
return createGCNMaxMemoryClauseMachineScheduler(C);
+ if (SchedStrategy == "iterative-ilp")
+ return createIterativeILPMachineScheduler(C);
+
+ if (SchedStrategy == "iterative-minreg")
+ return createMinRegScheduler(C);
+
+ if (SchedStrategy == "iterative-maxocc")
+ return createIterativeGCNMaxOccupancyMachineScheduler(C);
+
return createGCNMaxOccupancyMachineScheduler(C);
}
diff --git a/llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit2.ll b/llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit2.ll
index 2c9d24ee04ebf..7d771342a598e 100644
--- a/llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit2.ll
+++ b/llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit2.ll
@@ -1,7 +1,11 @@
; RUN: llc -mtriple=amdgcn -mcpu=tahiti -enable-amdgpu-aa=0 -misched=gcn-iterative-minreg -verify-machineinstrs < %s | FileCheck --check-prefix=SI-MINREG %s
; RUN: llc -mtriple=amdgcn -mcpu=tahiti -enable-amdgpu-aa=0 -misched=gcn-iterative-max-occupancy-experimental -verify-machineinstrs < %s | FileCheck --check-prefix=SI-MAXOCC %s
+; RUN: llc -mtriple=amdgcn -mcpu=tahiti -enable-amdgpu-aa=0 -amdgpu-sched-strategy=iterative-minreg -verify-machineinstrs < %s | FileCheck --check-prefix=SI-MINREG %s
+; RUN: llc -mtriple=amdgcn -mcpu=tahiti -enable-amdgpu-aa=0 -amdgpu-sched-strategy=iterative-maxocc -verify-machineinstrs < %s | FileCheck --check-prefix=SI-MAXOCC %s
; RUN: llc -mtriple=amdgcn -mcpu=fiji -enable-amdgpu-aa=0 -misched=gcn-iterative-minreg -verify-machineinstrs < %s | FileCheck --check-prefix=VI %s
; RUN: llc -mtriple=amdgcn -mcpu=fiji -enable-amdgpu-aa=0 -misched=gcn-iterative-max-occupancy-experimental -verify-machineinstrs < %s | FileCheck --check-prefix=VI %s
+; RUN: llc -mtriple=amdgcn -mcpu=fiji -enable-amdgpu-aa=0 -amdgpu-sched-strategy=iterative-minreg -verify-machineinstrs < %s | FileCheck --check-prefix=VI %s
+; RUN: llc -mtriple=amdgcn -mcpu=fiji -enable-amdgpu-aa=0 -amdgpu-sched-strategy=iterative-maxocc -verify-machineinstrs < %s | FileCheck --check-prefix=VI %s
; SI-MINREG: NumSgprs: {{[1-9]$}}
; SI-MINREG: NumVgprs: {{[1-9]$}}
diff --git a/llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit3.ll b/llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit3.ll
index 96b40bca5e2e3..ef24996d00274 100644
--- a/llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit3.ll
+++ b/llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit3.ll
@@ -1,5 +1,6 @@
; RUN: llc -mtriple=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck --check-prefix=MISCHED %s
; RUN: llc -mtriple=amdgcn -mcpu=tonga -misched=gcn-iterative-ilp -verify-machineinstrs < %s | FileCheck --check-prefix=GCN-ILP %s
+; RUN: llc -mtriple=amdgcn -mcpu=tonga -amdgpu-sched-strategy=iterative-ilp -verify-machineinstrs < %s | FileCheck --check-prefix=GCN-ILP %s
; Test the scheduler when only one wave is requested. The result should be high register usage and max ILP.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks!
…rategy (llvm#135042) Currently, the only way for users to try these schedulers is via `-misched=` . However, this overrides the default scheduler for all targets. This causes problems for various toolchains / drivers which spawn jobs for both x86 and AMDGPU -- e.g. hipcc. On the other hand, `amdgpu-sched-strategy` only changes the scheduler for AMDGPU target.
…rategy (llvm#135042) Currently, the only way for users to try these schedulers is via `-misched=` . However, this overrides the default scheduler for all targets. This causes problems for various toolchains / drivers which spawn jobs for both x86 and AMDGPU -- e.g. hipcc. On the other hand, `amdgpu-sched-strategy` only changes the scheduler for AMDGPU target.
…rategy (llvm#135042) Currently, the only way for users to try these schedulers is via `-misched=` . However, this overrides the default scheduler for all targets. This causes problems for various toolchains / drivers which spawn jobs for both x86 and AMDGPU -- e.g. hipcc. On the other hand, `amdgpu-sched-strategy` only changes the scheduler for AMDGPU target.
…rategy (llvm#135042) Currently, the only way for users to try these schedulers is via `-misched=` . However, this overrides the default scheduler for all targets. This causes problems for various toolchains / drivers which spawn jobs for both x86 and AMDGPU -- e.g. hipcc. On the other hand, `amdgpu-sched-strategy` only changes the scheduler for AMDGPU target.
Currently, the only way for users to try these schedulers is via
-misched=
. However, this overrides the default scheduler for all targets. This causes problems for various toolchains / drivers which spawn jobs for both x86 and AMDGPU -- e.g. hipcc. On the other hand,amdgpu-sched-strategy
only changes the scheduler for AMDGPU target.