Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hw: Improve performance counters for bring-up #155

Merged
merged 73 commits into from
Aug 9, 2024
Merged

Conversation

fischeti
Copy link
Contributor

@fischeti fischeti commented Jul 3, 2024

This PR adds improvements to the performance counters for bring-up, and restructures the performance counter implementation:

Changed

  • After reset, performance counters immediately start tracking, which allows checking from outside if the cores, icache, etc., are alive. The metrics that are currently tracked are:

    localparam perf_metrics_e PerfMetricRstValues[NumPerfMetricRstValues] = '{
    Cycle,
    RetiredInstr,
    TcdmAccessed,
    IcacheMiss,
    IcacheHit,
    IcachePrefetch,
    IcacheStall
    };

  • The configuration registers are refactored for a more sensible encoding of the metrics that can be tracked. Further, the configuration of the metric/hart and the enable are now separate registers, which should make it a bit faster resp. more accurate to enable/disable performance counters. This means the interface for the performance counter API changed slightly, but makes more sense now.

  • The previous perf_cnt test was adapted to the new performance counter API interface, and now actually checks for error. Previously, it served mostly as an example on how to set up the performance counters and always returned zero.

TODO

  • Enable tracking of multi-channel DMA as discussed in hw: Support multi-ID DMA #144
  • Revert container references in CI to main when deemed ready to merge
  • Credit initial authors once it is merged:
Co-authored-by: Milos Hirsl <[email protected]>

@fischeti fischeti mentioned this pull request Jul 16, 2024
6 tasks
@fischeti fischeti force-pushed the improve-perf-cnt branch 3 times, most recently from 95df68a to e955201 Compare July 19, 2024 12:31
@fischeti fischeti marked this pull request as ready for review July 19, 2024 13:45
@fischeti fischeti force-pushed the improve-perf-cnt branch 2 times, most recently from 54ee85c to 44d22f7 Compare August 1, 2024 19:10
Copy link
Collaborator

@colluca colluca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution Tim! Mostly LGTM, just a few comments following.

hw/snitch_cluster/src/snitch_cluster_peripheral/Makefile Outdated Show resolved Hide resolved
hw/snitch_cluster/src/snitch_cluster.sv Outdated Show resolved Hide resolved
sw/snRuntime/src/perf_cnt.h Outdated Show resolved Hide resolved
target/snitch_cluster/sw/run.yaml Outdated Show resolved Hide resolved
sw/snRuntime/src/perf_cnt.h Show resolved Hide resolved
sw/tests/perf_cnt.c Outdated Show resolved Hide resolved
@paulsc96 paulsc96 marked this pull request as draft August 6, 2024 15:17
@colluca colluca marked this pull request as ready for review August 7, 2024 16:13
Copy link
Collaborator

@colluca colluca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@colluca colluca merged commit 96e34a2 into main Aug 9, 2024
25 checks passed
@colluca colluca deleted the improve-perf-cnt branch August 9, 2024 07:49
viv-eth pushed a commit that referenced this pull request Aug 9, 2024
Co-authored-by: Milos Hirsl <[email protected]>
Co-authored-by: Luca Colagrande <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants