[llvm] [AMDGPU] Support function attribute to override postRA scheduling direction (PR #147708)
Carl Ritson via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 13 18:55:00 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()) {
----------------
perlfu wrote:
Code changes do not seem to solve either of the two issues I mentioned.
New option `AMDGPUPostRADirection` is not connected, and would not solve the issue of function attribute overriding the direction of *all* machine schedulers.
To fix this issue, the direction needs to be passed at scheduler construction or otherwise stored/updated in the scheduler object.
i.e. there needs to be a per-scheduler way of setting direction that doesn't currently exist.
To avoid a function attribute overriding command line options, you should check for presence of command line option before parsing function attribute.
Then ignore the function attribute if a command line option is already present/set.
Again you don't need to do this part if the command line override applies to a per-scheduler direction as implemented above -- this detail can be encapsulated within the MachineScheduler code, then AMDGPU code only need set the desired direction.
https://github.com/llvm/llvm-project/pull/147708
More information about the llvm-commits
mailing list