fastmachinelearning / hls4ml

Machine learning on FPGAs using HLS
https://fastmachinelearning.org/hls4ml
Apache License 2.0
1.24k stars 402 forks source link

print_vivado_report function for nicer reports #730

Closed vloncar closed 1 year ago

vloncar commented 1 year ago

Description

As a cherry on top for a new release, I propose we make the printing of reports nicer for the user. Yes, this is a result of boredom because I didn't go skiing this weekend, but also because I don't like the ugly screenshots of text reports that many people place on their slides. I guess we can expand this in the future to be a bit more interactive and include the per-layer reports.

Note that the hidden among the style changes is a fix for parsing cosim reports. This previously failed on the accelerator backend.

To try it out, run something like

report = hls4ml.report.parse_vivado_report('/some/path/') # or report = hls_model.build(...)
hls4ml.report.print_vivado_report(report)

Hint: Run it in jupyter and as a script to see the difference, I won't spoil the fun here :wink:

Type of change

Tests

The notebook part is not really testable with the current setup, and the text-based reports can only be tested for sanity (if the function fails or not), so I didn't add any tests.

Checklist

jmduarte commented 1 year ago

@vloncar should we try to generalize the tests a bit as part of this PR? Or do it later?

https://github.com/vloncar/hls4ml/pull/51#issuecomment-1475376160

vloncar commented 1 year ago

I made this PR as a little bonus that would make the notebook-based workflows (and tutorials) more appealing, I didn't think of it being a PR that introduces testing for reporting feature. You added a basic test that IMO suffices, but if you want to do more, I'd be happy to review and merge it.