[llvm] [AMDGPU] Schedule independent instructions between s_barrier_signal and s_barrier_wait (PR #172057)

Dark Steve via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 10:21:58 PST 2025


================
@@ -41,38 +51,58 @@ class BarrierLatency : public ScheduleDAGMutation {
   void apply(ScheduleDAGInstrs *DAG) override;
 };
 
+void addLatencyToEdge(SDep &PredDep, SUnit &SU, unsigned Latency) {
+  SUnit *PredSU = PredDep.getSUnit();
+  SDep ForwardD = PredDep;
+  ForwardD.setSUnit(&SU);
+  for (SDep &SuccDep : PredSU->Succs) {
+    if (SuccDep == ForwardD) {
+      SuccDep.setLatency(SuccDep.getLatency() + Latency);
+      break;
+    }
+  }
+  PredDep.setLatency(PredDep.getLatency() + Latency);
+  PredSU->setDepthDirty();
+  SU.setDepthDirty();
+}
+
 void BarrierLatency::apply(ScheduleDAGInstrs *DAG) {
-  constexpr unsigned SyntheticLatency = 2000;
+  const SIInstrInfo *TII = static_cast<const SIInstrInfo *>(DAG->TII);
+  constexpr unsigned FenceLatency = 2000;
----------------
PrasoonMishra wrote:

The `FenceLatency = 2000` value is pre-existing code I just renamed `SyntheticLatency` to` FenceLatency` to distinguish it from the new `BarrierSignalWaitLatency`. The `2000` was already in the pass before my changes.

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


More information about the llvm-commits mailing list