[llvm] [SandboxVec][Scheduler] Implement rescheduling (PR #115220)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 16:00:29 PST 2024


================
@@ -94,19 +104,30 @@ class Scheduler {
   ReadyListContainer ReadyList;
   DependencyGraph DAG;
   std::optional<BasicBlock::iterator> ScheduleTopItOpt;
-  SmallVector<std::unique_ptr<SchedBundle>> Bndls;
+  // TODO: This is wasting memory in exchange for fast removal using a raw ptr.
+  DenseMap<SchedBundle *, std::unique_ptr<SchedBundle>> Bndls;
   Context &Ctx;
   Context::CallbackID CreateInstrCB;
 
   /// \Returns a scheduling bundle containing \p Instrs.
   SchedBundle *createBundle(ArrayRef<Instruction *> Instrs);
+  void eraseBundle(SchedBundle *SB);
   /// Schedule nodes until we can schedule \p Instrs back-to-back.
   bool tryScheduleUntil(ArrayRef<Instruction *> Instrs);
   /// Schedules all nodes in \p Bndl, marks them as scheduled, updates the
   /// UnscheduledSuccs counter of all dependency predecessors, and adds any of
   /// them that become ready to the ready list.
   void scheduleAndUpdateReadyList(SchedBundle &Bndl);
-
+  /// The scheduling state of the instructions in the bundle.
+  enum class BndlSchedState {
+    NoneScheduled,
+    PartiallyOrDifferentlyScheduled,
----------------
vporpo wrote:

"Differently" is when the instructions belong to different bundles, which suggests that they were previously scheduled in a way that differs from the way we attempt to schedule them now (that is all instructions in a single bundle). I will add some comments.

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


More information about the llvm-commits mailing list