Skip to content

Commit b73e9c9

Browse files
committed
perf: Make cyclesDispatched count RS occupancy not admission
1 parent 740c185 commit b73e9c9

2 files changed

Lines changed: 25 additions & 9 deletions

File tree

src/main/scala/radiance/muon/Backend.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ class Backend(implicit p: Parameters) extends CoreModule()(p) {
5353
reservStation.io.issue
5454
}
5555

56-
val cyclesDispatched = PerfCounter(reservStation.io.admit.fire)
5756
val cyclesEligible = PerfCounter(issued.valid)
5857
val cyclesIssued = PerfCounter(issued.fire)
5958

59+
val cyclesDispatched = reservStation.io.perf.cyclesDispatched
6060
io.perf.cyclesDispatched := cyclesDispatched
61-
io.perf.cyclesEligible := cyclesEligible
61+
io.perf.cyclesEligible := reservStation.io.perf.cyclesEligible
6262
io.perf.cyclesIssued := cyclesIssued
6363
io.perf.perWarp.zipWithIndex.foreach { case (p, wid) =>
6464
p.cyclesDispatched :=
6565
PerfCounter(reservStation.io.admit.fire &&
6666
(reservStation.io.admit.bits.ibufEntry.uop.wid === wid.U))
67-
p.stallsRSFull := reservStation.io.perf(wid).stallsRSFull
67+
p.stallsRSFull := reservStation.io.perf.perWarp(wid).stallsRSFull
6868

69-
p.cyclesEligible := reservStation.io.perf(wid).cyclesEligible
69+
p.cyclesEligible := reservStation.io.perf.perWarp(wid).cyclesEligible
7070
p.cyclesIssued := PerfCounter(issued.fire && (issued.bits.uop.wid === wid.U))
7171
// LSU business is accounted for at the IBUF, not at the EX stage; it needs
7272
// to be added separately

src/main/scala/radiance/muon/ReservationStation.scala

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,15 @@ class ReservationStation(implicit p: Parameters) extends CoreModule()(p) {
3535
val readResp = Flipped(CollectorResponse(Isa.maxNumRegs, isWrite = false))
3636
val readData = Flipped(new CollectorOperandRead)
3737
}
38-
val perf = Output(Vec(numWarps, new Bundle {
38+
val perf = Output(new Bundle {
39+
val cyclesDispatched = Perf.T
3940
val cyclesEligible = Perf.T
40-
val stallsRSFull = Perf.T
41-
}))
41+
val perWarp = Vec(numWarps, new Bundle {
42+
val cyclesDispatched = Perf.T
43+
val cyclesEligible = Perf.T
44+
val stallsRSFull = Perf.T
45+
})
46+
})
4247
})
4348

4449
val numEntries = muonParams.numIssueQueueEntries
@@ -101,7 +106,7 @@ class ReservationStation(implicit p: Parameters) extends CoreModule()(p) {
101106
val rowEmptyVec = VecInit((0 until numEntries).map(!validTable(_)))
102107
val hasEmptyRow = rowEmptyVec.reduce(_ || _)
103108
io.admit.ready := hasEmptyRow
104-
io.perf.zipWithIndex.foreach { case (p, wid) =>
109+
io.perf.perWarp.zipWithIndex.foreach { case (p, wid) =>
105110
p.stallsRSFull :=
106111
PerfCounter(io.admit.valid && !hasEmptyRow &&
107112
io.admit.bits.ibufEntry.uop.wid === wid.U)
@@ -125,6 +130,15 @@ class ReservationStation(implicit p: Parameters) extends CoreModule()(p) {
125130
val rsOccupancy = WireDefault(PopCount(validTable))
126131
dontTouch(rsOccupancy)
127132

133+
io.perf.cyclesDispatched := PerfCounter(rsOccupancy =/= 0.U)
134+
io.perf.perWarp.zipWithIndex.foreach { case (p, wid) =>
135+
val validThisWarp = (0 until numEntries).map { i =>
136+
validTable(i) && (instTable(i).uop.wid === wid.U)
137+
}
138+
val hasThisWarp = validThisWarp.reduce(_ || _)
139+
p.cyclesDispatched := PerfCounter(hasThisWarp)
140+
}
141+
128142
// -----------------
129143
// collector control
130144
// -----------------
@@ -353,7 +367,9 @@ class ReservationStation(implicit p: Parameters) extends CoreModule()(p) {
353367
dontTouch(issuedId)
354368

355369
// connect per-warp eligible perf counters
356-
io.perf.zipWithIndex.foreach { case (p, wid) =>
370+
val hasEligible = eligibles.map(_.valid).reduce(_ || _)
371+
io.perf.cyclesEligible := PerfCounter(hasEligible)
372+
io.perf.perWarp.zipWithIndex.foreach { case (p, wid) =>
357373
val eligiblesThisWarp = eligibles.map { row =>
358374
row.valid && (row.bits.entry.uop.wid === wid.U)
359375
}

0 commit comments

Comments
 (0)