From 4ba1d457b341e4677fad57f98ccde5bacdda7d7f Mon Sep 17 00:00:00 2001 From: Kunlin You Date: Mon, 27 Jan 2025 01:54:07 +0800 Subject: [PATCH] submodule(utility): introduce XSPerfLevel for performance counter (#4238) This change introduce XSPerfLevel, including `VERBOSE`/`NORMAL`/`CRITICAL`. Only counters with level greater or equal than threhold will be instantiated, which will reduce utilization and compile time on Pallaium. PerfLevel therhold can be set in command line, `VERBOSE` by default to apply all counters. An example usage as follows: SIM_ARGS="--perf-level CRITICAL" or PLDM_ARGS="--perf-level CRITICAL" PLDM=1 PerfLevel param is also `VERBOSE` by default, which means all counters will be ignored now if threhold greater than that. User can explicitly set params to keep some important counters instantiated, as follows: XSPerfAccumulate(xx, yy, perfLevel = XSPerfLevel.CRITICAL) --- src/main/scala/top/ArgParser.scala | 5 +++++ src/main/scala/xiangshan/Parameters.scala | 1 + utility | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/scala/top/ArgParser.scala b/src/main/scala/top/ArgParser.scala index 918433e6be2..fc851ef82c8 100644 --- a/src/main/scala/top/ArgParser.scala +++ b/src/main/scala/top/ArgParser.scala @@ -131,6 +131,10 @@ object ArgParser { nextOption(config.alter((site, here, up) => { case DebugOptionsKey => up(DebugOptionsKey).copy(EnablePerfDebug = false) }), tail) + case "--perf-level" :: value :: tail => + nextOption(config.alter((site, here, up) => { + case DebugOptionsKey => up(DebugOptionsKey).copy(PerfLevel = value) + }), tail) case "--disable-alwaysdb" :: tail => nextOption(config.alter((site, here, up) => { case DebugOptionsKey => up(DebugOptionsKey).copy(AlwaysBasicDB = false) @@ -202,6 +206,7 @@ object ArgParser { case PerfCounterOptionsKey => PerfCounterOptions( here(DebugOptionsKey).EnablePerfDebug && !here(DebugOptionsKey).FPGAPlatform, here(DebugOptionsKey).EnableRollingDB && !here(DebugOptionsKey).FPGAPlatform, + XSPerfLevel.withName(here(DebugOptionsKey).PerfLevel), 0 ) }) diff --git a/src/main/scala/xiangshan/Parameters.scala b/src/main/scala/xiangshan/Parameters.scala index c48398b9d20..e397c707cb8 100644 --- a/src/main/scala/xiangshan/Parameters.scala +++ b/src/main/scala/xiangshan/Parameters.scala @@ -569,6 +569,7 @@ case class DebugOptions AlwaysBasicDiff: Boolean = true, EnableDebug: Boolean = false, EnablePerfDebug: Boolean = true, + PerfLevel: String = "VERBOSE", UseDRAMSim: Boolean = false, EnableConstantin: Boolean = false, EnableChiselDB: Boolean = false, diff --git a/utility b/utility index 74e73cbd244..6ed7394ef85 160000 --- a/utility +++ b/utility @@ -1 +1 @@ -Subproject commit 74e73cbd2444fb3c7decaff4aa167e79dc7380a7 +Subproject commit 6ed7394ef85887ea360f33b3be97bb13fb31e57c