diff --git a/src/main/scala/xiangshan/backend/decode/DecodeStage.scala b/src/main/scala/xiangshan/backend/decode/DecodeStage.scala index 3e7608b1574acdbbc9642d5b4da2e8916085c60f..37be8edbdcfba2f2154a0070f07b5e9491158698 100644 --- a/src/main/scala/xiangshan/backend/decode/DecodeStage.scala +++ b/src/main/scala/xiangshan/backend/decode/DecodeStage.scala @@ -76,6 +76,10 @@ class DecodeStage(implicit p: Parameters) extends XSModule with HasPerfEvents { XSPerfAccumulate("waitInstr", PopCount((0 until DecodeWidth).map(i => io.in(i).valid && !io.in(i).ready))) XSPerfAccumulate("stall_cycle", hasValid && !io.out(0).ready) + XSPerfHistogram("slots_fire", PopCount(io.out.map(_.fire)), true.B, 0, DecodeWidth+1, 1) + XSPerfHistogram("slots_valid_pure", PopCount(io.in.map(_.valid)), io.out(0).fire, 0, DecodeWidth+1, 1) + XSPerfHistogram("slots_valid_rough", PopCount(io.in.map(_.valid)), true.B, 0, DecodeWidth+1, 1) + if (env.EnableTopDown) { XSPerfAccumulate("slots_issued", PopCount(io.out.map(_.fire))) XSPerfAccumulate("decode_bubbles", PopCount(io.out.map(x => !x.valid && x.ready))) // Unutilized issue-pipeline slots while there is no backend-stall diff --git a/src/main/scala/xiangshan/backend/dispatch/Dispatch.scala b/src/main/scala/xiangshan/backend/dispatch/Dispatch.scala index b38aeab30396b1a58e464841b3812c7f5f87f743..1d49dc5a44e28b532636c578fe6ae78e87a606b9 100644 --- a/src/main/scala/xiangshan/backend/dispatch/Dispatch.scala +++ b/src/main/scala/xiangshan/backend/dispatch/Dispatch.scala @@ -105,7 +105,7 @@ class Dispatch(implicit p: Parameters) extends XSModule with HasPerfEvents { val updatedUop = Wire(Vec(RenameWidth, new MicroOp)) val updatedCommitType = Wire(Vec(RenameWidth, CommitType())) val checkpoint_id = RegInit(0.U(64.W)) - checkpoint_id := checkpoint_id + PopCount((0 until RenameWidth).map(i => + checkpoint_id := checkpoint_id + PopCount((0 until RenameWidth).map(i => io.fromRename(i).fire() )) @@ -151,7 +151,7 @@ class Dispatch(implicit p: Parameters) extends XSModule with HasPerfEvents { if(i == 0){ debug_runahead_checkpoint_id := checkpoint_id } else { - debug_runahead_checkpoint_id := checkpoint_id + PopCount((0 until i).map(i => + debug_runahead_checkpoint_id := checkpoint_id + PopCount((0 until i).map(i => io.fromRename(i).fire() )) } @@ -204,6 +204,7 @@ class Dispatch(implicit p: Parameters) extends XSModule with HasPerfEvents { // (1) resources are ready // (2) previous instructions are ready val thisCanActualOut = (0 until RenameWidth).map(i => !thisIsBlocked(i) && notBlockedByPrevious(i)) + val thisActualOut = (0 until RenameWidth).map(i => io.enqRob.req(i).valid && io.enqRob.canAccept) val hasValidException = io.fromRename.zip(hasException).map(x => x._1.valid && x._2) // input for ROB, LSQ, Dispatch Queue @@ -277,6 +278,11 @@ class Dispatch(implicit p: Parameters) extends XSModule with HasPerfEvents { XSPerfAccumulate("stall_cycle_fp_dq", stall_fp_dq) XSPerfAccumulate("stall_cycle_ls_dq", stall_ls_dq) + XSPerfHistogram("slots_fire", PopCount(thisActualOut), true.B, 0, RenameWidth+1, 1) + // Explaination: when out(0) not fire, PopCount(valid) is not meaningfull + XSPerfHistogram("slots_valid_pure", PopCount(io.enqRob.req.map(_.valid)), thisActualOut(0), 0, RenameWidth+1, 1) + XSPerfHistogram("slots_valid_rough", PopCount(io.enqRob.req.map(_.valid)), true.B, 0, RenameWidth+1, 1) + if (env.EnableTopDown) { val rob_first_load = WireDefault(false.B) val rob_first_store = WireDefault(false.B) diff --git a/src/main/scala/xiangshan/backend/rename/Rename.scala b/src/main/scala/xiangshan/backend/rename/Rename.scala index e0ff97a1d2cba0d463a7a509fa88e2a86763fe83..59909433350ce421c0b811b689687501a3748d68 100644 --- a/src/main/scala/xiangshan/backend/rename/Rename.scala +++ b/src/main/scala/xiangshan/backend/rename/Rename.scala @@ -372,11 +372,16 @@ class Rename(implicit p: Parameters) extends XSModule with HasCircularQueuePtrHe XSPerfAccumulate("stall_cycle_walk", hasValid && io.out(0).ready && fpFreeList.io.canAllocate && intFreeList.io.canAllocate && io.robCommits.isWalk) XSPerfAccumulate("recovery_bubbles", PopCount(io.in.map(_.valid && io.out(0).ready && fpFreeList.io.canAllocate && intFreeList.io.canAllocate && io.robCommits.isWalk))) + XSPerfHistogram("slots_fire", PopCount(io.out.map(_.fire)), true.B, 0, RenameWidth+1, 1) + // Explaination: when out(0) not fire, PopCount(valid) is not meaningfull + XSPerfHistogram("slots_valid_pure", PopCount(io.in.map(_.valid)), io.out(0).fire, 0, RenameWidth+1, 1) + XSPerfHistogram("slots_valid_rough", PopCount(io.in.map(_.valid)), true.B, 0, RenameWidth+1, 1) + XSPerfAccumulate("move_instr_count", PopCount(io.out.map(out => out.fire && out.bits.ctrl.isMove))) val is_fused_lui_load = io.out.map(o => o.fire && o.bits.ctrl.fuType === FuType.ldu && o.bits.ctrl.srcType(0) === SrcType.imm) XSPerfAccumulate("fused_lui_load_instr_count", PopCount(is_fused_lui_load)) - + val renamePerf = Seq( ("rename_in ", PopCount(io.in.map(_.valid & io.in(0).ready )) ), ("rename_waitinstr ", PopCount((0 until RenameWidth).map(i => io.in(i).valid && !io.in(i).ready)) ),