[PATCH] D89095: AMDGPU: Introduce a flag to control enable/disable instruction sink pass

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 22:04:00 PDT 2020


cfang created this revision.
cfang added reviewers: arsenm, kerbowa, rampitec.
Herald added subscribers: hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: LLVM.
cfang requested review of this revision.
Herald added a subscriber: wdng.

Instruction sink pass tries to sink instructions to the lowest possible point, with an effort
to bring instructions closer to their users. But it does not have heuristic regarding actual 
benefit to do so.  For example, when you sink an instruction, it may increase the live ranges
of  it uses.
 We have observe a greaterr than 10% performance benefit on some applications if we completely
turn off this pass. A flag to control this pass will allow us to tune the performance. It will also help us
isolate potential correctness issue that may be introduced from the llvm community.


https://reviews.llvm.org/D89095

Files:
  llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp


Index: llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -198,6 +198,11 @@
     cl::desc("Enable workarounds for the StructurizeCFG pass"), cl::init(true),
     cl::Hidden);
 
+static cl::opt<bool> EnableInstructionSink(
+    "amdgpu-enable-instruction-sink",
+    cl::desc("Enable instruction sink pass"), cl::init(true),
+    cl::Hidden);
+
 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
   // Register the target
   RegisterTargetMachine<R600TargetMachine> X(getTheAMDGPUTarget());
@@ -889,7 +894,8 @@
     }
     addPass(createStructurizeCFGPass(false)); // true -> SkipUniformRegions
   }
-  addPass(createSinkingPass());
+  if (EnableInstructionSink)
+    addPass(createSinkingPass());
   addPass(createAMDGPUAnnotateUniformValues());
   if (!LateCFGStructurize) {
     addPass(createSIAnnotateControlFlowPass());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89095.297120.patch
Type: text/x-patch
Size: 1016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201009/622f71d2/attachment-0001.bin>


More information about the llvm-commits mailing list