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

Jorge Gorbe Moya via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 15:50:22 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,
----------------
slackito wrote:

"Partially" seems obvious to me (only some instructions in the bundle have been scheduled so far) but not so for "Differently". Could you add a comment?

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


More information about the llvm-commits mailing list