-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "perf: use perfUtils in
Utility
(#179)"
This reverts commit f9dffb2.
- Loading branch information
Showing
12 changed files
with
182 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
# This workflow contains a single job called "build" | ||
tl-test_L2: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-24.04 | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
@@ -35,7 +35,7 @@ jobs: | |
uses: coursier/cache-action@v5 | ||
|
||
- name: Verilator | ||
run: sudo apt install verilator libsqlite3-dev | ||
run: sudo apt install verilator | ||
|
||
- name: Setup Mill | ||
uses: jodersky/[email protected] | ||
|
@@ -60,7 +60,7 @@ jobs: | |
tl-test_L2L3: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-24.04 | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
@@ -77,7 +77,7 @@ jobs: | |
uses: coursier/cache-action@v5 | ||
|
||
- name: Verilator | ||
run: sudo apt install verilator libsqlite3-dev | ||
run: sudo apt install verilator | ||
|
||
- name: Setup Mill | ||
uses: jodersky/[email protected] | ||
|
Submodule Utility
updated
9 files
Submodule rocket-chip
updated
17 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package huancun.utils | ||
|
||
import chisel3._ | ||
import huancun.HCCacheParameters | ||
import utility.{LogPerfHelper, LogPerfIO} | ||
|
||
object XSPerfAccumulate { | ||
def apply(params: HCCacheParameters, perfName: String, perfCnt: UInt) = { | ||
if (params.enablePerf && !params.FPGAPlatform) { | ||
val helper = Module(new LogPerfHelper) | ||
val perfClean = helper.io.clean | ||
val perfDump = helper.io.dump | ||
|
||
val counter = RegInit(0.U(64.W)) | ||
val next_counter = counter + perfCnt | ||
counter := Mux(perfClean, 0.U, next_counter) | ||
|
||
when(perfDump) { | ||
XSPerfPrint(p"$perfName, $next_counter\n")(helper.io) | ||
} | ||
} | ||
} | ||
} | ||
|
||
object XSPerfHistogram { | ||
// instead of simply accumulating counters | ||
// this function draws a histogram | ||
def apply( | ||
params: HCCacheParameters, | ||
perfName: String, | ||
perfCnt: UInt, | ||
enable: Bool, | ||
start: Int, | ||
stop: Int, | ||
step: Int, | ||
lStrict: Boolean = false, | ||
rStrict: Boolean = false | ||
) = { | ||
if (params.enablePerf && !params.FPGAPlatform) { | ||
val helper = Module(new LogPerfHelper) | ||
val perfClean = helper.io.clean | ||
val perfDump = helper.io.dump | ||
|
||
// drop each perfCnt value into a bin | ||
val nBins = (stop - start) / step | ||
require(start >= 0) | ||
require(stop > start) | ||
require(nBins > 0) | ||
|
||
(0 until nBins).map { i => | ||
val binRangeStart = start + i * step | ||
val binRangeStop = start + (i + 1) * step | ||
val inRange = perfCnt >= binRangeStart.U && perfCnt < binRangeStop.U | ||
|
||
// if !lStrict and perfCnt < start, it will go to the first bin | ||
val leftOutOfRange = if(!lStrict) perfCnt < start.U && i.U === 0.U else false.B | ||
// if !rStrict and perfCnt >= stop, it will go to the last bin | ||
val rightOutOfRange = if(!rStrict) perfCnt >= stop.U && i.U === (nBins - 1).U else false.B | ||
val inc = inRange || leftOutOfRange || rightOutOfRange | ||
|
||
val counter = RegInit(0.U(64.W)) | ||
when(perfClean) { | ||
counter := 0.U | ||
}.elsewhen(enable && inc) { | ||
counter := counter + 1.U | ||
} | ||
|
||
when(perfDump) { | ||
XSPerfPrint(p"${perfName}_${binRangeStart}_${binRangeStop}, $counter\n")(helper.io) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
object XSPerfMax { | ||
def apply(params: HCCacheParameters, perfName: String, perfCnt: UInt, enable: Bool) = { | ||
if (params.enablePerf && !params.FPGAPlatform) { | ||
val helper = Module(new LogPerfHelper) | ||
val perfClean = helper.io.clean | ||
val perfDump = helper.io.dump | ||
|
||
val max = RegInit(0.U(64.W)) | ||
val next_max = Mux(enable && (perfCnt > max), perfCnt, max) | ||
max := Mux(perfClean, 0.U, next_max) | ||
|
||
when(perfDump) { | ||
XSPerfPrint(p"${perfName}_max, $next_max\n")(helper.io) | ||
} | ||
} | ||
} | ||
} | ||
|
||
object TransactionLatencyCounter { | ||
// count the latency between start signal and stop signal | ||
// whenever stop signals comes, we create a latency sample | ||
def apply(start: Bool, stop: Bool): (Bool, UInt) = { | ||
assert(!(start && stop)) | ||
val counter = RegInit(0.U(64.W)) | ||
val next_counter = counter + 1.U | ||
counter := Mux(start || stop, 0.U, next_counter) | ||
(stop, next_counter) | ||
} | ||
} | ||
|
||
object XSPerfPrint { | ||
def apply(fmt: String, data: Bits*)(ctrlInfo: LogPerfIO): Any = | ||
apply(Printable.pack(fmt, data: _*))(ctrlInfo) | ||
|
||
def apply(pable: Printable)(ctrlInfo: LogPerfIO): Any = { | ||
val commonInfo = p"[PERF ][time=${ctrlInfo.timer}] __PERCENTAGE_M__: " | ||
printf(commonInfo + pable) | ||
} | ||
} | ||
|
||
object GTimer { | ||
def apply() = { | ||
val c = RegInit(0.U(64.W)) | ||
c := c + 1.U | ||
c | ||
} | ||
} |
Oops, something went wrong.