Skip to content

Commit 885c6ac

Browse files
committed
optuna: prune to simplest interesting case
multiobjective driven by synthesis parameters is the minimum interesting case, prune everything else and reduce size of python code and dependencies in terms of what a reader has to understand. Fancy dependencies to visualize, if they are easy to use, such as generating interactive 3d interactive HTML for pareto fron is fine. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent a77cf0e commit 885c6ac

File tree

9 files changed

+4326
-194
lines changed

9 files changed

+4326
-194
lines changed

optuna/BUILD

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ orfs_flow(
1313
name = "mock-cpu",
1414
abstract_stage = "cts",
1515
arguments = {
16+
"VERILOG_TOP_PARAMS": "NUM_CORES 2 PIPELINE_DEPTH 4 WORK_PER_STAGE 8",
1617
"CORE_ASPECT_RATIO": "0.5",
1718
"CORE_UTILIZATION": "50", # Higher utilization
1819
"PLACE_DENSITY": "0.20",
@@ -44,19 +45,10 @@ orfs_flow(
4445
verilog_files = [":mock-cpu.sv"],
4546
)
4647

47-
# Extract timing information from CTS
48-
orfs_run(
49-
name = "mock-cpu_timing",
50-
src = ":mock-cpu_cts",
51-
outs = ["mock-cpu_timing.txt"],
52-
arguments = {"OUTFILE": "$(location mock-cpu_timing.txt)"},
53-
script = ":extract_timing.tcl",
54-
)
55-
5648
# Extract PPA (Performance, Power, Area) metrics from CTS
5749
orfs_run(
5850
name = "mock-cpu_ppa",
59-
src = ":mock-cpu_cts",
51+
src = ":mock-cpu_synth",
6052
outs = ["mock-cpu_ppa.txt"],
6153
arguments = {"OUTFILE": "$(location mock-cpu_ppa.txt)"},
6254
script = ":extract_ppa.tcl",
@@ -73,5 +65,8 @@ py_binary(
7365
"@bazel-orfs-pip//matplotlib",
7466
"@bazel-orfs-pip//numpy",
7567
"@bazel-orfs-pip//optuna",
68+
"@bazel-orfs-pip//pandas",
69+
"@bazel-orfs-pip//plotly",
70+
"@bazel-orfs-pip//kaleido",
7671
],
7772
)

optuna/README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,17 @@ Side note: ORFS has a large number of small designs for testing purposes, wherea
2323
- Supports constrained optimization (must meet timing) and multi-objective optimization (area + power simultaneously)
2424
- Optuna shines in simplicity and good results for limited effort. No need install or configure a server for remote execution.
2525

26-
## Screenshots
26+
## 3D HTML intearctvie pareto front snapshot
2727

28-
![](screenshots/optuna-plot.webp)
28+
![3D pareto from](screenshots/optuna_dse_results.html)
2929

3030
## Quick Start
3131

3232
### Main Tool: Parameter Optimization (Recommended)
3333

3434
```bash
35-
# Single-objective: Minimize area
36-
bazelisk run //optuna:run -- --n-trials 20
37-
38-
# Multi-objective: Minimize area and power (Pareto frontier)
39-
bazelisk run //optuna:run -- --multi-objective --n-trials 30
35+
# Minimize all objectives (Pareto frontier)
36+
bazelisk run //optuna:run -- --n-trials 30
4037

4138
# Custom parameter ranges
4239
bazelisk run //optuna:run -- \
@@ -56,7 +53,6 @@ bazelisk run //optuna:run -- --help
5653
- `--max-density FLOAT`: Maximum PLACE_DENSITY (default: 0.70)
5754
- `--n-trials INT`: Number of optimization trials (default: 20)
5855
- `--seed INT`: Random seed for reproducibility (default: 42)
59-
- `--multi-objective`: Enable multi-objective optimization (area + power)
6056
- `--output-dir PATH`: Output directory for results (default: optuna/results)
6157

6258
## Experiment Flow

optuna/extract_ppa.tcl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
source $::env(SCRIPTS_DIR)/load.tcl
2-
load_design 4_cts.odb 4_cts.sdc
2+
# from optuna/results/asap7/mock_cpu/base/3_place.odb, we want 3_place
3+
# stracted from $::env(ODB_FILE)
4+
set file_stem [file rootname [file tail $::env(ODB_FILE)]]
5+
load_design ${file_stem}.odb ${file_stem}.sdc
36

47
# ============================================================
58
# Performance Metrics

optuna/extract_timing.tcl

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)