Skip to content

Commit 538fd4e

Browse files
andcarminatiF-Stuckmann
authored andcommitted
[AIEX] Initialize top scoreboard only for the first region
This avoids the creation of empty regions before the epilogue, which can lead to timing failures related to the pipeline/epilogue relationship.
1 parent 526732a commit 538fd4e

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

llvm/lib/Target/AIE/AIEMachineScheduler.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,14 @@ void AIEPostRASchedStrategy::initializeBotScoreBoard(ScoreboardTrust Trust) {
355355

356356
void AIEPostRASchedStrategy::initializeTopScoreBoard() {
357357

358+
// Top Scoreboard is only used for Post-SWP epilogue merging.
359+
// If we have a multiregion MBB, the epilogue will be scheduled
360+
// in the first topological region. In this case, ignore scoreboard
361+
// initialization for other regions.
362+
const bool IsFirstRegion = DAG->begin() == CurMBB->begin();
363+
if (!IsFirstRegion)
364+
return;
365+
358366
auto EpilogueContextOpt = InterBlock.getSWPEpilogueContext(CurMBB);
359367

360368
if (!EpilogueContextOpt)

llvm/test/CodeGen/AIE/schedule/sched-initialize-topscb-once.ll

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,7 @@ define void @load_store_with_call() {
2626
; CHECK-NEXT: .L_LEnd0:
2727
; CHECK-NEXT: nopa ; vldb x0, [p5, #0]; vst x0, [p5, #0]; nopxm ; nopv
2828
; CHECK-NEXT: // %bb.2: // %exit
29-
; CHECK-NEXT: nop
30-
; CHECK-NEXT: nop
31-
; CHECK-NEXT: nop
32-
; CHECK-NEXT: nop
33-
; CHECK-NEXT: nop
34-
; CHECK-NEXT: nop
35-
; CHECK-NEXT: nop
36-
; CHECK-NEXT: nop
37-
; CHECK-NEXT: nop
38-
; CHECK-NEXT: nop
39-
; CHECK-NEXT: vst x0, [p5, #0]
29+
; CHECK-NEXT: vst x0, [p5, #0]; nopb ; nopx
4030
; CHECK-NEXT: vst x0, [p5, #0]
4131
; CHECK-NEXT: vst x0, [p5, #0]
4232
; CHECK-NEXT: vst x0, [p5, #0]

0 commit comments

Comments
 (0)