[llvm] [AMDGPU] Add scaffolding for ML focused scheduling strategy (PR #169616)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 23:00:39 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/lib/Target/AMDGPU/AMDGPUMLSchedStrategy.cpp llvm/lib/Target/AMDGPU/AMDGPUMLSchedStrategy.h llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp llvm/lib/Target/AMDGPU/GCNSchedStrategy.h llvm/lib/Target/AMDGPU/GCNSubtarget.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index b8962d286..f2fd137e4 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -24,6 +24,7 @@
 #include "AMDGPUIGroupLP.h"
 #include "AMDGPUISelDAGToDAG.h"
 #include "AMDGPULowerVGPREncoding.h"
+#include "AMDGPUMLSchedStrategy.h"
 #include "AMDGPUMacroFusion.h"
 #include "AMDGPUPerfHintAnalysis.h"
 #include "AMDGPUPreloadKernArgProlog.h"
@@ -43,7 +44,6 @@
 #include "GCNPreRAOptimizations.h"
 #include "GCNRewritePartialRegUses.h"
 #include "GCNSchedStrategy.h"
-#include "AMDGPUMLSchedStrategy.h"
 #include "GCNVOPDUtils.h"
 #include "R600.h"
 #include "R600TargetMachine.h"
@@ -1218,9 +1218,9 @@ GCNTargetMachine::createPostMachineScheduler(MachineSchedContext *C) const {
         C, std::make_unique<AMDGPUMLPostSchedStrategy>(C),
         /*RemoveKillFlags=*/true);
 
-  ScheduleDAGMI *DAG = new GCNPostScheduleDAGMILive(
-      C, std::make_unique<PostGenericScheduler>(C),
-      /*RemoveKillFlags=*/true);
+  ScheduleDAGMI *DAG =
+      new GCNPostScheduleDAGMILive(C, std::make_unique<PostGenericScheduler>(C),
+                                   /*RemoveKillFlags=*/true);
   const GCNSubtarget &ST = C->MF->getSubtarget<GCNSubtarget>();
   DAG->addMutation(createLoadClusterDAGMutation(DAG->TII, DAG->TRI));
   if (ST.shouldClusterStores())
diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp b/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp
index f21dffd61..13a20bdee 100644
--- a/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.cpp
@@ -333,7 +333,8 @@ void GCNSubtarget::overrideSchedPolicy(MachineSchedPolicy &Policy,
 
   const Function &F = Region.RegionBegin->getMF()->getFunction();
   Attribute WorkloadAttr = F.getFnAttribute("amdgpu-workload-type");
-  bool IsMLWorkload = WorkloadAttr.isValid() && WorkloadAttr.getValueAsString() == "ml";
+  bool IsMLWorkload =
+      WorkloadAttr.isValid() && WorkloadAttr.getValueAsString() == "ml";
   // Always schedule top-down for better blancing of HW resource usage.
   if (IsMLWorkload)
     Policy.OnlyTopDown = true;

``````````

</details>


https://github.com/llvm/llvm-project/pull/169616


More information about the llvm-commits mailing list