Skip to content

Commit

Permalink
[AMDGPU] Add CL option for max-ilp scheduler.
Browse files Browse the repository at this point in the history
When compiling for multiple targets the scheduler that is selected via the
-misched option is applied globally. This patch adds a target CL option instead.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D131022
  • Loading branch information
kerbowa committed Aug 2, 2022
1 parent 4bd9d98 commit 3dfa562
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ static cl::opt<bool> EnablePromoteKernelArguments(
cl::desc("Enable promotion of flat kernel pointer arguments to global"),
cl::Hidden, cl::init(true));

static cl::opt<bool> EnableMaxIlpSchedStrategy(
"amdgpu-enable-max-ilp-scheduling-strategy",
cl::desc("Enable scheduling strategy to maximize ILP for a single wave."),
cl::Hidden, cl::init(false));

extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
// Register the target
RegisterTargetMachine<R600TargetMachine> X(getTheAMDGPUTarget());
Expand Down Expand Up @@ -1161,6 +1166,10 @@ ScheduleDAGInstrs *GCNPassConfig::createMachineScheduler(
const GCNSubtarget &ST = C->MF->getSubtarget<GCNSubtarget>();
if (ST.enableSIScheduler())
return createSIMachineScheduler(C);

if (EnableMaxIlpSchedStrategy)
return createGCNMaxILPMachineScheduler(C);

return createGCNMaxOccupancyMachineScheduler(C);
}

Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/schedule-ilp.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; RUN: llc -march=amdgcn -mcpu=tonga -misched=gcn-iterative-ilp -verify-machineinstrs < %s | FileCheck %s
; RUN: llc -march=amdgcn -mcpu=tonga -misched=gcn-max-ilp -verify-machineinstrs < %s | FileCheck %s
; RUN: llc -march=amdgcn -mcpu=tonga -amdgpu-enable-max-ilp-scheduling-strategy -verify-machineinstrs < %s | FileCheck %s

; CHECK: NumVgprs: {{[0-9][0-9][0-9]$}}

Expand Down

0 comments on commit 3dfa562

Please sign in to comment.