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

Metric Comparison + API Updates #274

Merged
merged 74 commits into from
Jan 23, 2024
Merged

Metric Comparison + API Updates #274

merged 74 commits into from
Jan 23, 2024

Conversation

donn
Copy link
Member

@donn donn commented Nov 19, 2023

  • openlane.common
    • Created new function get_latest_file, that finds the latest file with a certain filename in a specific folder
    • Created new Filter object aggregating the functionality of wildcards
    • Created new module openlane.common.metrics to aggregate functions dealing with metrics, replacing previous file
      • __main__ file of this module has three commands, compare, compare-multiple, compare-main:
        • compare: Compares two metrics files and generates an output summary
        • compare-multiple: Compares two folders of metrics files and generates an output summary
        • compare-main: Compares a folder of metric files with metrics fetched from efabless/openlane-metrics and generates an output summary
      • New Metric object created, encapsulating the metric name, its aggregator, and some other functionality related to evaluating changes in metrics
        • Also allowed some metrics to exclude some groups from aggregation, e.g. iter for routing metrics
      • Created "library" of Metrics of the various metrics we aggregated so far
        • aggregate_metrics now uses the metric library for aggregators as a default value
      • Updated parsing of metrics to more closely match https://github.com/ieee-ceda-datc/datc-rdf-Metrics4ML: the format for modifiers was wrong
  • openlane.state
    • Created __main__ file that returns the latest state for a run directory (using get_latest_file, with an options to extract the metrics thereof for a file (useful for scripts)
  • openlane.config.Config:
    • Updated refg:: to return the glob string verbatim if the glob returns no results
  • openlane.config.Macro:
    • Created new method from_state that automatically creates a Macro object from a State object
  • Created new object, ScopedFile, which is a file that's deleted as soon as it's deconstructed
  • KLayout.*:
    • Unified generation of commandline arguments using .get_cli_args()
    • Updated scripts to use %OL_METRIC_I instead of having to use other communication channels
    • Made sure all paths passed to KLayout commands are absolute because KLayout loves to not use CWD for relative paths
  • Magic.*:
    • Fixed bug when MAGICRC is a relative path
  • Netgen.LVS, Checker.LVS:
    • Updated metric names for grammatical consistency
  • Added httpx to replace requests as the dependency for HTTP functions

CI and Testing

  • Added function in CI to test every PR against the current main function
  • Added pytest-xdist to dev dependencies, so multiple tests can be run in parallel

Depends on efabless/openlane2-step-unit-tests#21

@donn donn marked this pull request as draft November 19, 2023 11:09
@efabless efabless deleted a comment from openlane-bot Nov 27, 2023
@donn donn requested a review from kareefardi December 31, 2023 14:53
@kareefardi kareefardi added this to the 2.0.0 milestone Jan 8, 2024
Copy link
Collaborator

@kareefardi kareefardi left a comment

Choose a reason for hiding this comment

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

Couple general additional comments:

1- design__lint_errors__count -> design__lint_error__count where error is without an s.
2- I think any change in a critical variable should be reported regardless of value higher_is_better. As such, table verbosity CRITICAL will always display critical changes.
3- How to apply filter?

python3 -m openlane.common.metrics compare ./designs/spm/runs/run_1/final/metrics.json ./designs/spm/runs/run_2/final/metrics.json --table-out diff.out --filter 'design__lint_errors__count'

and

python3 -m openlane.common.metrics compare ./designs/spm/runs/run_1/final/metrics.json ./designs/spm/runs/run_2/final/metrics.json --table-out diff.out 

produce the same diff.out file.
4- I think a CLI argument for decimal points would be a nice addition.
5- deltas in openlane.common.metrics compare are displayed at the end of the file. I think they should be at the beginning of the file.

.github/test_sets/test_sets.yml Outdated Show resolved Hide resolved
"""
Creates a small summary of the differences between two ``metrics.json`` files.
"""
if table_verbosity == "NONE":
Copy link
Collaborator

Choose a reason for hiding this comment

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

why would that be an option ?

Copy link
Member Author

Choose a reason for hiding this comment

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

If you just want the highlights and not the table

openlane/common/metrics/__main__.py Outdated Show resolved Hide resolved
openlane/common/metrics/library.py Outdated Show resolved Hide resolved
openlane/common/metrics/library.py Outdated Show resolved Hide resolved
openlane/common/toolbox.py Show resolved Hide resolved
openlane/common/toolbox.py Outdated Show resolved Hide resolved
openlane/config/flow.py Outdated Show resolved Hide resolved
openlane/steps/netgen.py Outdated Show resolved Hide resolved
openlane/steps/openroad.py Show resolved Hide resolved
@donn
Copy link
Member Author

donn commented Jan 19, 2024

@kareefardi I can't say I agree with every change to a "critical" metric being critical. For example-- slack increasing is not "critical" as in demanding attention, but slack decreasing very much is.

What this tells me is that we're not aligned on the definition of critical: my definition of critical was "a change impacting the manufacturability of a design." Any change in I/O pin count, for example, is critical (as evidenced by it having no higher_is_better property) as there is no ordinary circumstance in which that would change-- but there are some metrics where only negative changes impact the manufacturability of the design. Meanwhile, OpenROAD rsz getting better at its job would increase slacks across all designs and, under this definition, would not add immense noise to the reports without cause for concern.

How did you define critical?

@donn
Copy link
Member Author

donn commented Jan 23, 2024

@kareefardi Bot issue seems to be that the current HEAD of master doesn't have metrics uploaded. Simplest solution would be to just merge this PR.

@donn donn requested a review from kareefardi January 23, 2024 10:10
@donn donn merged commit 20b06be into main Jan 23, 2024
95 checks passed
@donn donn deleted the metric_comparison_work branch January 25, 2024 08:03
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