Skip to content

Remove duplicate data from summary#114

Merged
machshev merged 3 commits intolowRISC:masterfrom
machshev:split-summary
Mar 12, 2026
Merged

Remove duplicate data from summary#114
machshev merged 3 commits intolowRISC:masterfrom
machshev:split-summary

Conversation

@machshev
Copy link
Collaborator

@machshev machshev commented Mar 11, 2026

Prepare for adding support for a dashboard.

  • Remove the old FlowResults class - residual from previous refactoring
  • Remove duplicate data from the simulation results summary
  • Fix a bug in the markdown report paths

The FlowResults class was renamed SimFlowResults a while back to
differentiate it from the results from the other flows. However it looks
like the old version remained due to commit rebase issues.

Signed-off-by: James McCorrie <james.mccorrie@lowrisc.org>
At the moment the `SimResultsSummary` contains both the summary and also
the full results. This creates duplicated data within the JSON data files.

This commit separates out the summary data from the full detailed
results. Which means that the block level reports JSON files will now be
the primary source of the data for the detailed results. The summary
JSON will now no longer replicate the same data.

Signed-off-by: James McCorrie <james.mccorrie@lowrisc.org>
Copy link
Contributor

@AlexJones0 AlexJones0 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 work on this @machshev, it definitely seems like an improvement.

I'm happy for this to go in when the Python versioning issue is addressed.

Comment on lines +290 to +295
return {
flow: SimFlowResults.load(
path=base_path / f"{flow}.json",
)
for flow in self.flow_results
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should be more robust against deleted results? It might be sensible to log.warn on any block report paths that are missing, and omit them from the returned mapping?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'd probably lean more towards an hard error unless we have a use case for something more relaxed. If we relax it then this could mask a bigger issues with data retention or perhaps the path provided is incorrect.

The summary JSON can be used standalone, but if we are trying to get the full set of results then I would expect a full set of results. They must have been available at the time they were generated.

relative = Path(self.relative_to) if self.relative_to is not None else Path.cwd()
block_report = self.html_link_base / f"{file_name}.html"
html_report_path = block_report.relative_to(relative)
html_report_path = block_report.relative_to(relative, walk_up=True)
Copy link
Contributor

@AlexJones0 AlexJones0 Mar 12, 2026

Choose a reason for hiding this comment

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

I appreciate the fix, I wasn't aware that relative_to didn't do this walk-up behaviour by default.

It seems correct to me, but I think this walk_up parameter was only added in Python 3.12, so this will crash when run with e.g. Python 3.10.19, which I'm using locally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes it was a surprise to me as well that relative_to didn't work with non sub-paths. Looks like os.path.relpath supports the same functionality. It's a shame we have to revert back to os.path for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated with the helper which uses Path as discussed. This adds unitttests for the functionality, which means we should catch any issues with Python version divergences as CI runs the unit tests against all supported Python versions.

@machshev machshev requested a review from AlexJones0 March 12, 2026 12:12
@machshev machshev force-pushed the split-summary branch 2 times, most recently from 80bfd04 to 61765ad Compare March 12, 2026 12:43
Where the project root is overridden with `--proj-root` and scratch
directory is overridden with `--scratch` the HTML report
path is not necessarily going to be a subdirectory of the project root.
The default `Path.relative_to(...)` raises an exception if the resulting
`Path` is `../some/parent/dir`.

Signed-off-by: James McCorrie <james.mccorrie@lowrisc.org>
Copy link
Contributor

@AlexJones0 AlexJones0 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 adding the walk_up replacement and adding a test for it! LGTM.

@machshev machshev added this pull request to the merge queue Mar 12, 2026
Merged via the queue into lowRISC:master with commit 2a8d15a Mar 12, 2026
6 checks passed
@machshev machshev deleted the split-summary branch March 12, 2026 13:05
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.

2 participants