This commit is contained in:
Hansung Kim
2023-05-08 20:35:40 -07:00
parent fd0d09691b
commit 9059d1e436

View File

@@ -242,9 +242,10 @@ class CoalShiftQueue[T <: Data](gen: T, entries: Int, config: CoalescerConfig) e
c && !(io.invalidate.valid && inv) c && !(io.invalidate.valid && inv)
}.reduce(_ || _) }.reduce(_ || _)
val syncedEnqValid = io.queue.enq.map(_.valid).reduce(_ || _) val syncedEnqValid = io.queue.enq.map(_.valid).reduce(_ || _)
// syncedDeqValidNextCycle being true means the arbiter has completed // valid && !fire means we enable enqueueing to a full queue, provided the
// processing all of the ready-to-go requests. // arbiter is taking away all remaining valid queue heads in the next cycle so
val syncedDeqValidNextCycle = io.queue.deq.map(x => x.valid && !x.ready).reduce(_ || _) // valid and not fire // that we make space for the entire next warp.
val syncedDeqValidNextCycle = io.queue.deq.map(x => x.valid && !x.ready).reduce(_ || _)
for (i <- 0 until config.numLanes) { for (i <- 0 until config.numLanes) {
val enq = io.queue.enq(i) val enq = io.queue.enq(i)
@@ -362,8 +363,8 @@ class MonoCoalescer(coalLogSize: Int, windowT: CoalShiftQueue[ReqQueueEntry],
// compare leader's head against follower's every queue entry // compare leader's head against follower's every queue entry
(followers zip followerValids.asBools).map { case (follower, followerValid) => (followers zip followerValids.asBools).map { case (follower, followerValid) =>
canMatch(follower, followerValid, leader, leaderValid) canMatch(follower, followerValid, leader, leaderValid)
// disabling halving optimization because it does not give the correct // FIXME: disabling halving optimization because it does not give the
// per-lane coalescable indication to the shift queue // correct per-lane coalescable indication to the shift queue
// // match leader to only followers at lanes >= leader idx // // match leader to only followers at lanes >= leader idx
// // this halves the number of comparators // // this halves the number of comparators
// if (followerIndex < leaderIndex) false.B // if (followerIndex < leaderIndex) false.B
@@ -393,7 +394,7 @@ class MonoCoalescer(coalLogSize: Int, windowT: CoalShiftQueue[ReqQueueEntry],
} }
val chosenLeaderIdx = chooseLeaderPriorityEncoder(matchCounts) val chosenLeaderIdx = chooseLeaderPriorityEncoder(matchCounts)
val chosenLeader = VecInit(leaders)(chosenLeaderIdx) val chosenLeader = VecInit(leaders)(chosenLeaderIdx) // mux
// matchTable for the chosen lane, but converted to a Vec[UInt] // matchTable for the chosen lane, but converted to a Vec[UInt]
val chosenMatches = VecInit(matchTablePerLane.map{ table => val chosenMatches = VecInit(matchTablePerLane.map{ table =>
VecInit(table.map(VecInit(_).asUInt)) VecInit(table.map(VecInit(_).asUInt))
@@ -437,6 +438,11 @@ class MonoCoalescer(coalLogSize: Int, windowT: CoalShiftQueue[ReqQueueEntry],
io.results.canCoalesce := canCoalesce io.results.canCoalesce := canCoalesce
} }
// Combinational logic that generates a coalesced request given a request
// window, and a selection of possible coalesced sizes. May utilize multiple
// MonoCoalescers and apply size-choosing policy to determine the final
// coalesced request out of all possible combinations.
//
// Software model: coalescer.py // Software model: coalescer.py
class MultiCoalescer(windowT: CoalShiftQueue[ReqQueueEntry], coalReqT: ReqQueueEntry, class MultiCoalescer(windowT: CoalShiftQueue[ReqQueueEntry], coalReqT: ReqQueueEntry,
config: CoalescerConfig) extends Module { config: CoalescerConfig) extends Module {
@@ -904,8 +910,8 @@ class Uncoalescer(config: CoalescerConfig) extends Module {
// Un-coalesce responses back to individual lanes // Un-coalesce responses back to individual lanes
val found = inflightTable.io.lookup.bits val found = inflightTable.io.lookup.bits
(found.lanes zip io.uncoalResps).foreach { case (perLane, ioPerLane) => (found.lanes zip io.uncoalResps).foreach { case (perLane, ioPerLane) =>
perLane.reqs.zipWithIndex.foreach { case (oldReq, i) => perLane.reqs.zipWithIndex.foreach { case (oldReq, depth) =>
val ioOldReq = ioPerLane(i) val ioOldReq = ioPerLane(depth)
// TODO: spatial-only coalescing: only looking at 0th srcId entry // TODO: spatial-only coalescing: only looking at 0th srcId entry
ioOldReq.valid := false.B ioOldReq.valid := false.B