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
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
e895504
Add `metrics` module to `openlane.common` with comparison features
donn Nov 19, 2023
47edede
Merge remote-tracking branch 'origin/main' into metric_comparison_work
donn Nov 19, 2023
6615d2b
Add ability to exclude some metrics from aggregation
donn Nov 19, 2023
4c802e9
Fix lint
donn Nov 19, 2023
201809a
Merge branch 'main' into metric_comparison_work
donn Nov 21, 2023
f35c499
Structure Rework + Add "Critical" Field
donn Nov 22, 2023
0f521c9
New Filter Object + Sorting Metrics + Upload Metrics
donn Nov 23, 2023
2334ed0
Fix metric parsing
donn Nov 23, 2023
0f3ed8a
Merge remote-tracking branch 'origin/main' into metric_comparison_work
donn Nov 23, 2023
014fa25
Fix Lint
donn Nov 23, 2023
b56d8f9
temporarily disable linux aarch64 so i dont die of old age + fix metr…
donn Nov 23, 2023
2fcc7c3
Small reshuffle
donn Nov 23, 2023
a3c08a4
First attempt at comparison comment
donn Nov 26, 2023
1e2aa7e
Fix GH invocation
donn Nov 26, 2023
3b5ff86
CI fix
donn Nov 26, 2023
33b5128
Almost there…
donn Nov 26, 2023
a6c9d49
Fix nodejs…
donn Nov 26, 2023
5febce0
strip components
donn Nov 26, 2023
73e7098
WHY
donn Nov 26, 2023
835543a
Grr
donn Nov 26, 2023
e3edb08
Fix bug with non- `.metrics.json` file
donn Nov 26, 2023
7a58830
Move fetching main to Python, add different table verbosity levels
donn Nov 26, 2023
1d3f899
lint
donn Nov 26, 2023
6d584cb
Some Docs
donn Nov 27, 2023
364755e
Cause a lot of errors in flow + tweak report format
donn Nov 27, 2023
08d2cc5
linmt
donn Nov 27, 2023
1a8f74c
Forget the smoke test for a second, jesse, we need to test
donn Nov 27, 2023
3292c83
Forgor the if always
donn Nov 27, 2023
01ecdc5
Revert forced failure + add upload to `push` PRs
donn Nov 27, 2023
982496d
SIGH
donn Nov 27, 2023
74d8f1d
Better NaN handling + Docs Fixes
donn Nov 27, 2023
f158d1a
Fix lint, CI pushing
donn Nov 27, 2023
a67cd1a
Bot Credentials
donn Nov 27, 2023
de0d410
🙂
donn Nov 27, 2023
8ca8a35
Stray "
donn Nov 27, 2023
c02b24a
Fix Auth URL
donn Nov 27, 2023
6d70a0e
Make `openlane-bot` update existing comments instead of creating new …
donn Nov 28, 2023
d251480
Separate Table to post to `gist` + Update comment instead of posting new
donn Nov 28, 2023
856f6a2
Fix lint and URL
donn Nov 28, 2023
e7a00db
Fix script invocation
donn Nov 28, 2023
293d824
Fix rest API
donn Nov 28, 2023
df7447c
wrong variable
donn Nov 28, 2023
2a18d89
TableFormat -> TableVerbosity + Use `IntEnums`, add `IntEnumChoice` f…
donn Nov 29, 2023
56fb7cc
Save
donn Dec 6, 2023
5e983aa
Merge remote-tracking branch 'origin/main' into metric_comparison_work
donn Dec 19, 2023
4d51b3c
Drop `requests` dependency
donn Dec 19, 2023
7966c71
Merge remote-tracking branch 'origin/main' into metric_comparison_work
donn Dec 21, 2023
49f7aa3
Merge in #311
donn Dec 24, 2023
79598ad
Merge remote-tracking branch 'origin/main' into metric_comparison_work
donn Dec 24, 2023
b587e22
Orientation Enum + Instantiate
donn Dec 26, 2023
844ccaa
Merge remote-tracking branch 'origin/main' into metric_comparison_work
donn Dec 26, 2023
123c99c
Fix orientation
donn Dec 26, 2023
0cfcd0d
Test
donn Dec 26, 2023
258d2c0
Fix bug where table.md only included the one table
donn Dec 31, 2023
7338333
Merge remote-tracking branch 'origin/main' into metric_comparison_work
donn Dec 31, 2023
57a17a9
Revert CI changes
donn Jan 10, 2024
c251a0d
Merge branch 'main' into metric_comparison_work
donn Jan 10, 2024
40bef46
Address some review concerns
donn Jan 10, 2024
050ec3c
Forgot to revert a part of the CI
donn Jan 10, 2024
5f96436
Merge remote-tracking branch 'origin/main' into metric_comparison_work
donn Jan 16, 2024
f75bcf3
Add missing metrics
donn Jan 16, 2024
11a305b
Update more plural metric names
donn Jan 16, 2024
875a930
Fix Derivation + Aggregators
donn Jan 16, 2024
31900f8
Add pytest-xdist to flake shell
donn Jan 16, 2024
1207fcd
Merge branch 'main' into metric_comparison_work
kareefardi Jan 17, 2024
d3e92a1
rename metrics
kareefardi Jan 17, 2024
4e9fca5
apply filter
kareefardi Jan 17, 2024
b3520d7
fix default filter
kareefardi Jan 17, 2024
6ee589e
any critical change is critical
kareefardi Jan 17, 2024
33b84f1
add --significant-figures option
kareefardi Jan 17, 2024
5873381
add MetricComparisonResult.is_changed
kareefardi Jan 18, 2024
dd7172b
consistent critical definition and usage
kareefardi Jan 18, 2024
1a057c9
Fix CI
donn Jan 22, 2024
4d5c09a
Merge remote-tracking branch 'origin/main' into metric_comparison_work
donn Jan 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.v linguist-detectable=false
openlane/smoke_test_design/* linguist-detectable=false
.github/* linguist-detectable=false
2 changes: 1 addition & 1 deletion .github/actions/build_nix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ runs:
shell: ${{ inputs.shell }}
run: |
echo "#################################################################"
nix-shell ${{ inputs.nix_build_args }} --run "pytest --step-rx '.'"
nix-shell ${{ inputs.nix_build_args }} --run "pytest --step-rx '.' -n auto"
- name: Smoke Test
shell: ${{ inputs.shell }}
run: |
Expand Down
42 changes: 42 additions & 0 deletions .github/scripts/compare_main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env node
// Copyright 2023 Efabless Corporation
//
// Licensed under the Apache License, Version 2.0(the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @param {string} verbosity
* @param {string} token
* @returns {string}
*/
function get(verbosity, table_out = null, token = "") {
const { spawnSync } = require("child_process");

let tableOutOpts = table_out ? ["--table-out", table_out] : [];

let child = spawnSync("python3", ["-m", "openlane.common.metrics", "compare-main", "current", "--table-verbosity", verbosity, "--token", token].concat(tableOutOpts), { encoding: "utf8" });

let result = "";
if (child.status != 0) {
throw new Error("Failed to create report: \n\n```\n" + child.stderr + "\n```");
} else {
result += "Metric comparisons are in beta. Please report bugs under the issues tab.\n---\n";
result += "> To create this report yourself, grab the metrics artifact from the CI run, extract them, and invoke `python3 -m openlane.common.metrics compare-main <path to directory>`.\n\n" + child.stdout;
}

return result.trim();
};

module.exports = get;

if (require.main === module) {
console.log(get("ALL", "table.md", process.argv[2]));
}
129 changes: 129 additions & 0 deletions .github/scripts/post_metrics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#!/usr/bin/env node
// Copyright 2023 Efabless Corporation
//
// Licensed under the Apache License, Version 2.0(the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

const compareMain = require("./compare_main.js");

/**
*
* @param {Octokit} github
* @param {object} context
* @param {string} botUsername
* @param {string} body
*/
async function postOrUpdateComment(github, context, botUsername, body) {
const METRIC_REPORT_MARK = "<!-- MARK: METRICS REPORT -->";

let page = 1;
let allComments = [];
let comments = [];
do {
let response = await github.request("GET /repos/{owner}/{repo}/issues/{issue_number}/comments?page={page}&per_page=100", {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
page,
});
comments = response.data;
allComments = allComments.concat(comments);
page += 1;
} while (comments.length != 0);

let found = null;
for (let comment of allComments) {
if (comment.body.includes(METRIC_REPORT_MARK) && comment.user.login == botUsername) {
found = comment;
break;
}
}

let fn = github.rest.issues.createComment;
let request = {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${METRIC_REPORT_MARK}\n\n${body}`
};

if (found) {
request.comment_id = found.id;
fn = github.rest.issues.updateComment;
}

await fn(request);
}

/**
*
* @param {Octokit} github
* @param {object} context
* @param {string} botUsername
* @param {string} botToken
*/
async function main(github, context, botUsername, botToken) {
const fs = require("fs");

let body;
try {
body = compareMain("ALL", "./tables_all.md", botToken);
let tables = fs.readFileSync("./tables_all.md", { encoding: "utf8" });

let gistResponse = await github.rest.gists.create({
public: true,
description: `Results for ${context.repo.owner} / ${context.repo.repo}#${context.issue.number} (Run ${context.runId})`,
files: {
"10-ALL.md": {
content: tables
}
}
});

body += `\n\nFull tables ► ${gistResponse.data.html_url}\n`;
} catch (e) {
body = e.message;
console.error(e.message)
}

await postOrUpdateComment(github, context, botUsername, body)
}

module.exports = main;

if (require.main === module) {
// Test
try {
require("@octokit/rest");
} catch (error) {
console.error("Run 'yarn add @octokit/rest @octokit/plugin-paginate-rest'")
process.exit(-1);
}
const { Octokit } = require("@octokit/rest");

const context = {
repo: {
owner: "efabless",
repo: "openlane2"
},
issue: {
number: process.argv[3]
},
runId: "api_test"
};

let octokit = new Octokit({
auth: process.argv[2],
});

main(octokit, context, "openlane-bot", process.argv[2]);
}
2 changes: 1 addition & 1 deletion .github/test_sets/get_test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def main(scls, use_json, test_sets):
ol_dir, "test", "designs", design_name, config_filename
)
run_folder = os.path.join(
ol_dir, "test", "designs", design_name, "runs", "CI"
ol_dir, "test", "designs", design_name, "runs", f"{pdk}-{scl}"
)
designs.append(
{
Expand Down
46 changes: 23 additions & 23 deletions .github/test_sets/test_sets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
name: fastest_test_set
designs:
- inverter
- wbqspiflash
- APU
- s44
- zipdiv
- blink
- name: xtea
config_file: config.tcl
- usb
- usb_cdc_core
- name: latch
config_file: config_good.json
- name: latch
config_file: config_bad.json
# - wbqspiflash
donn marked this conversation as resolved.
Show resolved Hide resolved
# - APU
# - s44
# - zipdiv
# - blink
# - name: xtea
# config_file: config.tcl
# - usb
# - usb_cdc_core
# - name: latch
# config_file: config_good.json
# - name: latch
# config_file: config_bad.json
- spm
- gcd
- caravel_upw
Expand Down Expand Up @@ -47,16 +47,16 @@
name: fastest_test_set
designs:
- spm
- APU
- usb
- usb_cdc_core
- zipdiv
- blink
- wbqspiflash
- name: latch
config_file: config_good.json
- name: latch
config_file: config_bad.json
# - APU
# - usb
# - usb_cdc_core
# - zipdiv
# - blink
# - wbqspiflash
# - name: latch
# config_file: config_good.json
# - name: latch
# config_file: config_bad.json
- scl: gf180mcuD/gf180mcu_fd_sc_mcu7t5v0
name: extended_test_set
designs:
Expand Down
Loading
Loading