[PATCH] D86684: [Refactor] Add the SchedHeuristic for Scheduler to allow platform customizing the heuristics

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 6 09:04:43 PDT 2020


dmgreen added a comment.

Our downstream schedulers override pickNode/pickNext and have a certain amount of lookahead.  We probably wouldn't be able to make use of this. I have in the past wanted to write a heuristic that this would fit this really nicely - it needed the last scheduled instruction and would bias based on whether they could "overlap". Unfortunately I never managed to get it to actually make performance reliably better.

I am a little surprised that, if virtual dispatch was hurting performance so much, function pointer would end up being a lot better. It's still a similar indirect non inlinable/optimisable function call.



================
Comment at: llvm/include/llvm/CodeGen/MachineScheduler.h:1148
+  // Notify the heuristic to update the internal state after SU is scheduled.
+  UpdateFn update = nullptr;
+  // Initialize the heuristic
----------------
These are lowercase because they act like functions, not like variables?


================
Comment at: llvm/lib/CodeGen/MachineScheduler.cpp:1540
+// Debug use only
+SchedHeuristic *createOnly1Heuristic() {
+  static SchedHeuristic Only1("ONLY1");
----------------
You can probably just add an extra tracePick function, removing the need for this heuristic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86684/new/

https://reviews.llvm.org/D86684



More information about the llvm-commits mailing list