[llvm] [AMDGPU] Support function attribute to override postRA scheduling direction (PR #147708)

Harrison Hao via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 13 06:55:39 PDT 2025


================
@@ -1144,6 +1144,23 @@ GCNTargetMachine::createMachineScheduler(MachineSchedContext *C) const {
 
 ScheduleDAGInstrs *
 GCNTargetMachine::createPostMachineScheduler(MachineSchedContext *C) const {
+  Attribute PostRADirectionAttr =
+      C->MF->getFunction().getFnAttribute("misched-postra-direction");
+
+  if (PostRADirectionAttr.isValid()) {
----------------
harrisonGPU wrote:

Thanks Carl, I understand your point. So I created a new option called `amdgpu-post-ra-direction`. The function attribute will no longer override the command-line option. 

It's similar to how `amdgpu-sched-strategy` works:
https://github.com/llvm/llvm-project/blob/43a9ec2ecdf4aac8966e3b02e4e92c794f5b6a27/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp#L1122-L1144

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


More information about the llvm-commits mailing list