Skip to content

Commit

Permalink
submodule(utility): introduce XSPerfLevel for performance counter (#4238
Browse files Browse the repository at this point in the history
)

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)
  • Loading branch information
klin02 authored Jan 26, 2025
1 parent 7fbc739 commit 4ba1d45
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/scala/top/ArgParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
)
})
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/xiangshan/Parameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion utility

0 comments on commit 4ba1d45

Please sign in to comment.