FLYR commited on
Commit
07cafdd
·
verified ·
1 Parent(s): adffda4

Upload 5 files

Browse files
pic-benchmark/.gitattributes ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face LFS rules for this dataset.
2
+ # All large layout binaries and big routing JSONs go through Git LFS.
3
+ # (HF auto-LFSes files >10MB; these patterns make the policy explicit.)
4
+
5
+ *.gds filter=lfs diff=lfs merge=lfs -text
6
+ *.gdsii filter=lfs diff=lfs merge=lfs -text
7
+ *_routing.json filter=lfs diff=lfs merge=lfs -text
8
+ *_layout.gds filter=lfs diff=lfs merge=lfs -text
9
+
10
+ # CSVs, READMEs, small JSONs stay as plain text in git.
11
+ *.md text
12
+ *.txt text
13
+ LICENSE text
14
+ *.csv text
pic-benchmark/LICENSE ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Creative Commons Attribution 4.0 International (CC-BY-4.0)
2
+
3
+ Copyright (c) 2026 FLYR
4
+
5
+ Licensed under the Creative Commons Attribution 4.0 International License
6
+ (the "License"); you may not use this work except in compliance with the
7
+ License. You may obtain a copy of the License at:
8
+
9
+ https://creativecommons.org/licenses/by/4.0/legalcode
10
+
11
+ Under the License, you are free to:
12
+
13
+ - Share — copy and redistribute the material in any medium or format
14
+ - Adapt — remix, transform, and build upon the material
15
+ for any purpose, even commercially.
16
+
17
+ Under the following terms:
18
+
19
+ - Attribution — You must give appropriate credit, provide a link to the
20
+ license, and indicate if changes were made. You may do so in any
21
+ reasonable manner, but not in any way that suggests the licensor
22
+ endorses you or your use.
23
+
24
+ - No additional restrictions — You may not apply legal terms or
25
+ technological measures that legally restrict others from doing anything
26
+ the License permits.
27
+
28
+ THE MATERIAL IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. SEE THE LICENSE FOR
31
+ THE SPECIFIC LANGUAGE GOVERNING PERMISSIONS AND LIMITATIONS UNDER THE
32
+ LICENSE.
pic-benchmark/README.md ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ pretty_name: PIC Routing Benchmark
4
+ size_categories:
5
+ - n<10K
6
+ task_categories:
7
+ - other
8
+ tags:
9
+ - photonic-integrated-circuits
10
+ - chip-design
11
+ - eda
12
+ - routing
13
+ - benchmark
14
+ language:
15
+ - en
16
+ ---
17
+
18
+ # PIC Routing Benchmark
19
+
20
+ A benchmark of **123 photonic integrated circuit (PIC) designs** with placement
21
+ and routing solutions, intended for evaluating PIC-routing algorithms and
22
+ downstream physical-design metrics (insertion loss, crosstalk, group delay,
23
+ DRC, LVS, area, wirelength).
24
+
25
+ Each design is provided with **2 or 4 routing variants** (combinations of
26
+ *rectilinear / non-rectilinear* × *symmetry-aware / not*), giving **440 total
27
+ variant samples**. The reference evaluator and label files (`*_report.json`)
28
+ are included so users can reproduce all per-variant metrics or train models
29
+ that predict them.
30
+
31
+ The dataset and evaluator together form a unit:
32
+
33
+ | Repository | What it holds |
34
+ |---|---|
35
+ | **this dataset** — `FLYR/pic-benchmark` | netlist + placement + routing JSON, GDS layout, PDK + design rules, reference evaluator output (`*_report.json`) |
36
+ | companion code (separate) — `pic-evaluator` | the Python evaluator that produced every `*_report.json` |
37
+
38
+ ---
39
+
40
+ ## Dataset summary
41
+
42
+ | | |
43
+ |---|---|
44
+ | Designs (cases) | **123** |
45
+ | Routed variants | **440** |
46
+ | LVS-clean variants | **407** (92.5 %) |
47
+ | LVS-failing variants | **33** (7.5 %) — see [Known issues](#known-issues) |
48
+ | Total routes (LVS-checked) | **184 506** |
49
+ | Cases with 4 variants | 101 |
50
+ | Cases with 2 variants | 18 (only `rectilinear`, `non_rectilinear` available — symmetry variants not generated) |
51
+ | PDK | one v2 PDK (`pdk_v2_mzi80.json`) — 80 µm MZI cells, 16 µm WG_CROSS_4, etc. |
52
+ | Total raw size | ~1.6 GB (440 GDS layouts + 1439 JSON files) |
53
+
54
+ Designs span a representative cross-section of the PIC routing problem:
55
+
56
+ - **Switch fabrics**: banyan, benes, crossbar, switch-and-select (`N=4 … 256`)
57
+ - **Triangular meshes**: clements, reck (8×8)
58
+ - **Planar add/drop**: planar (`N=4 … 32`)
59
+ - **Splitter / combiner trees**: 1×N and N×1 (`N=2 … 256`), with optional MZM tap
60
+ - **WDM / filter banks**: AWG (add-drop / ring-mod / all-pass), ring filter banks, mux/demux
61
+ - **Coherent / detection**: coherent_detection_unit, splitter_ps_mzm_cdu (4–128)
62
+
63
+ ---
64
+
65
+ ## Directory layout
66
+
67
+ ```
68
+ pic-benchmark/
69
+ ├── README.md ← this file
70
+ ├── LICENSE
71
+ ├── pdk/
72
+ │ ├── pdk_v2_mzi80.json ← device library (bbox, ports, optical model)
73
+ │ └── design_rules_v2_mzi80.json← placement & routing rules (spacing, bend R)
74
+ ├── dataset_stats.json ← machine-readable summary
75
+ └── data/
76
+ ├── _batch_summary.csv ← one row per (case, variant) with all metrics
77
+ ├── add_drop_demux_1to3_ew/
78
+ │ ├── add_drop_demux_1to3_ew_netlist.json ← shared by all variants
79
+ │ ├── non_rectilinear/
80
+ │ │ ├── add_drop_demux_1to3_ew_placement.json
81
+ │ │ ├── add_drop_demux_1to3_ew_routing.json
82
+ │ │ ├── add_drop_demux_1to3_ew_layout.gds ← rendered GDS layout
83
+ │ │ └── add_drop_demux_1to3_ew_report.json ← evaluator output (labels)
84
+ │ ├── rectilinear/ ← same four files
85
+ │ ├── non_rectilinear_symmetry/ ← (when available)
86
+ │ └── rectilinear_symmetry/
87
+ └── … 122 more cases
88
+ ```
89
+
90
+ ### Per-variant files (4 of them)
91
+
92
+ | File | Schema | Provenance | Role |
93
+ |---|---|---|---|
94
+ | `<case>_netlist.json` | `pic_hier_netlist_v1` | upstream design | hierarchical schematic — modules, instances, port connections, top-level assignments. Shared across all variants of a case. |
95
+ | `<case>_placement.json` | `pic_placement_v1` | placer | one entry per instance: `(x_um, y_um, orientation_deg, mirror_x, mirror_y)`. Variant-specific. |
96
+ | `<case>_routing.json` | `pic_routing_v1` | router | one entry per net: `net_id`, `src`, `dst`, polyline (`control_points_um` or `waypoints_um`), `bend_radius_um`, optional `crossing_instances` and `inserted_instances` (e.g. WG_CROSS_4 cells). |
97
+ | `<case>_layout.gds` | GDSII | KLayout-rendered | binary layout; not required for the evaluator (which works from JSON), provided for visualization and comparison with mask-shop tools. |
98
+ | `<case>_report.json` | evaluator output | this benchmark | reference labels: tier-1/2/3 metrics, LVS / DRC / consistency results, per-path IL breakdown. **Reproduce by running the evaluator on the inputs.** |
99
+
100
+ ### Top-level `_batch_summary.csv`
101
+
102
+ One row per (design, variant). 28 columns covering LVS/DRC pass-fail, IL
103
+ spread, group delay, lane skew, area / hull / utilization, wirelength,
104
+ crossing count, crosstalk worst-case, mean/max detour ratio. Intended as the
105
+ quickest way to filter or rank variants without parsing 440 JSON files.
106
+
107
+ ### PDK (`pdk/`)
108
+
109
+ Two files; the evaluator merges them at load time.
110
+
111
+ - **`pdk_v2_mzi80.json`** — every device cell: `bbox`, `port_geometry` (per-port
112
+ `(x_um, y_um, orientation)`), `optical_model` (`insertion_loss_db`,
113
+ `device_length_um`, `group_index_ng`, etc.), `attributes.device_family`.
114
+ Includes the inserted routing primitives — `WG_CROSS_4` (16×16 µm waveguide
115
+ crossing), `BYPASS_RELAY__w560` (delay-matching bypass relay).
116
+ - **`design_rules_v2_mzi80.json`** — `placement_rules` (device-device min
117
+ spacing, edge keepout) and `routing_rules` (waveguide spacing, min bend
118
+ radius, crossing cell size). Used by the DRC metric.
119
+
120
+ ---
121
+
122
+ ## Reference labels: `*_report.json`
123
+
124
+ Every variant has a `*_report.json` file produced by the evaluator at the time
125
+ the benchmark was published. Top-level shape:
126
+
127
+ ```json
128
+ {
129
+ "tiers": {
130
+ "1": { "lvs": {...}, "area": {...}, "wirelength": {...},
131
+ "device_count": {...}, "insertion_loss": {...},
132
+ "uniformity": {...} },
133
+ "2": { "drc": {...}, "group_delay": {...}, "lane_skew": {...},
134
+ "phase_match": {...}, "congestion": {...},
135
+ "aspect_ratio": {...} },
136
+ "3": { "consistency": {...}, "floating_ports": {...},
137
+ "detour": {...}, "io_density": {...},
138
+ "crosstalk": {...}, "power": {...} }
139
+ },
140
+ "warnings": [...],
141
+ "errors": [...]
142
+ }
143
+ ```
144
+
145
+ These files **are deterministic given the inputs** — running the companion
146
+ evaluator on the same inputs reproduces the same numbers byte-for-byte (modulo
147
+ floating-point rounding). They are bundled so users can:
148
+
149
+ 1. Use them as **regression labels** when evaluating a new router on these inputs.
150
+ 2. Use them as **training targets** for ML routers / surrogates (e.g. predict IL or wirelength from netlist + placement).
151
+ 3. Skim them to **diagnose** what a router got wrong (LVS / DRC categories tell you exactly which net or port is broken).
152
+
153
+ ---
154
+
155
+ ## Quick start (with the companion evaluator)
156
+
157
+ ```bash
158
+ pip install pic-evaluator # or install from the companion repo
159
+
160
+ # Re-run the evaluator on one variant
161
+ python -m pic_evaluator \
162
+ --netlist data/planar_N4_ew/planar_N4_ew_netlist.json \
163
+ --placement data/planar_N4_ew/rectilinear/planar_N4_ew_placement.json \
164
+ --routing data/planar_N4_ew/rectilinear/planar_N4_ew_routing.json \
165
+ --pdk pdk/pdk_v2_mzi80.json \
166
+ --design-rules pdk/design_rules_v2_mzi80.json \
167
+ --json-out /tmp/my_report.json
168
+
169
+ # Or rerun the whole batch (≈ a few minutes on a laptop)
170
+ python batch_eval.py \
171
+ --root data \
172
+ --pdk pdk/pdk_v2_mzi80.json
173
+ # (design_rules_v2_mzi80.json is auto-discovered next to the PDK)
174
+ ```
175
+
176
+ ## Loading from Python
177
+
178
+ ```python
179
+ import json
180
+ from pathlib import Path
181
+ ROOT = Path("data")
182
+
183
+ # all variants of one case
184
+ for v in (ROOT / "planar_N8_ew").iterdir():
185
+ if not v.is_dir(): continue
186
+ rt = json.load(open(v / "planar_N8_ew_routing.json"))
187
+ print(v.name, "routes:", len(rt["routes"]))
188
+
189
+ # pull metrics for every variant from the summary
190
+ import csv
191
+ with open(ROOT / "_batch_summary.csv") as f:
192
+ for row in csv.DictReader(f):
193
+ if not eval(row["lvs_ok"]): # filter LVS-clean
194
+ continue
195
+ print(row["design"], row["variant"], row["il_max_db"], row["wirelength_mm"])
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Known issues
201
+
202
+ 33 of the 440 variants fail LVS. They are kept in the dataset on purpose — as
203
+ *real* router-output failure cases they are useful test inputs. A summary:
204
+
205
+ | Pattern | # variants | Affected designs | Root cause |
206
+ |---|---|---|---|
207
+ | `route_endpoints_mismatched` + `route_unknown_net` + `under_routed_nets`, all involving `__byp*` net names | 27 | `planar_N32_ew`, `splitter_ps_mzm_cdu_*`, `coherent_detection_unit`, … | Netlist + placement insert `BYPASS_RELAY__w560` delay-matching cells (and split each net into `__byp0` / `__byp1`), but the routing JSON still uses the pre-split net name and routes the source MZI directly to the sink MZI, ignoring the bypass relay. The relay sits placed but unwired in the routing. |
208
+ | Same combination + `dangling_instance_ports` | 2 | `add_drop_demux_1to3_ew/{rectilinear, non_rectilinear}` | The two issues co-occur: bypass-not-routed (above) + the ring's `add` port has no net assigned in the netlist. |
209
+ | `dangling_instance_ports` only | 2 | `crossbar_N4_ew/{rectilinear, non_rectilinear}` | Netlist generator emits incomplete `connections` dicts — several `MZI2x2` instances have only 3 of 4 ports wired. |
210
+ | `endpoint_geometry_mismatch` only | 2 | `splitter_tree_1x8_mzm_ew/{rectilinear, non_rectilinear}` | All 6 polyline endpoints to splitter input ports land ~20.7 µm short of the actual port world coordinate (likely the router used the splitter bounding-box edge instead of the PDK `port_geometry` after the placement transform). |
211
+
212
+ `_batch_summary.csv` has `lvs_ok=False` on every affected row, so you can
213
+ filter them out with one column read.
214
+
215
+ ---
216
+
217
+ ## Dataset construction
218
+
219
+ - **Designs** were authored / generated upstream. Each design lives in
220
+ `<case>/<case>_netlist.json` and is shared by all variants of that case.
221
+ - **Variants** are produced by a router pipeline that swept two routing
222
+ styles (`rectilinear`, `non_rectilinear`) and an optional symmetry-aware
223
+ pass — yielding up to 4 variants per case (some cases have only the 2
224
+ primary styles).
225
+ - **GDS layouts** are rendered from the JSON via KLayout's
226
+ `klayout_round_corners` backend; they are derived data, included for
227
+ convenience.
228
+ - **Reference reports** (`*_report.json`) were produced by running the
229
+ companion evaluator (commit pinned in the evaluator repo's CHANGELOG)
230
+ with `--no-plots`.
231
+
232
+ ---
233
+
234
+ ## License
235
+
236
+ Released under **CC-BY-4.0**. See `LICENSE`. Briefly: free for research and
237
+ commercial use; please cite this benchmark in publications.
238
+
239
+ ## Citation
240
+
241
+ If you use this benchmark, please cite:
242
+
243
+ ```bibtex
244
+ @dataset{flyr_pic_benchmark_2026,
245
+ author = {FLYR},
246
+ title = {PIC Routing Benchmark},
247
+ year = {2026},
248
+ publisher = {Hugging Face},
249
+ url = {https://huggingface.co/datasets/FLYR/pic-benchmark}
250
+ }
251
+ ```
pic-benchmark/_gen_stats.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Compute summary statistics for the staged dataset, for the README."""
2
+ from __future__ import annotations
3
+ import json
4
+ from collections import defaultdict
5
+ from pathlib import Path
6
+
7
+ ROOT = Path(r"D:\tmp\hf\pic-benchmark\data")
8
+
9
+ cases = sorted([d for d in ROOT.iterdir() if d.is_dir()])
10
+ variants_per_case = defaultdict(list)
11
+ ok_count = fail_count = 0
12
+ fail_by_pattern = defaultdict(int)
13
+ total_routes = total_devices = 0
14
+ n_cases = 0
15
+ case_families = defaultdict(int)
16
+
17
+ for c in cases:
18
+ n_cases += 1
19
+ fam = c.name.split("_")[0]
20
+ case_families[fam] += 1
21
+ for v in sorted(c.iterdir()):
22
+ if not v.is_dir():
23
+ continue
24
+ rp = next(v.glob("*_report.json"), None)
25
+ if rp is None:
26
+ continue
27
+ try:
28
+ data = json.load(open(rp, encoding="utf-8"))
29
+ except Exception:
30
+ continue
31
+ lvs = data.get("tiers", {}).get("1", {}).get("lvs", {})
32
+ ok = lvs.get("ok")
33
+ variants_per_case[c.name].append((v.name, bool(ok)))
34
+ if ok:
35
+ ok_count += 1
36
+ else:
37
+ fail_count += 1
38
+ cats = [k for k in [
39
+ "route_endpoints_mismatched","route_unknown_net","under_routed_nets",
40
+ "endpoint_geometry_mismatch","dangling_instance_ports",
41
+ "unknown_ports_in_connections","duplicate_net_ids_in_routing",
42
+ "duplicate_placements"] if lvs.get(k)]
43
+ fail_by_pattern[" + ".join(cats)] += 1
44
+ n_routes = lvs.get("n_routes_checked", 0)
45
+ total_routes += n_routes
46
+
47
+ n_variants = sum(len(v) for v in variants_per_case.values())
48
+ print(f"cases: {n_cases}")
49
+ print(f"variants: {n_variants}")
50
+ print(f" LVS ok: {ok_count}")
51
+ print(f" LVS fail: {fail_count}")
52
+ print(f"total routes (LVS-checked): {total_routes}")
53
+ print()
54
+ print("Variants per case (count):")
55
+ vpc = defaultdict(int)
56
+ for c, vs in variants_per_case.items():
57
+ vpc[len(vs)] += 1
58
+ for k, n in sorted(vpc.items()):
59
+ print(f" {k} variants: {n} cases")
60
+ print()
61
+ print("Failure patterns:")
62
+ for pat, n in sorted(fail_by_pattern.items(), key=lambda kv: -kv[1]):
63
+ print(f" [{n:>3d}] {pat}")
64
+
65
+ # Dump a JSON summary
66
+ out = {
67
+ "n_cases": n_cases,
68
+ "n_variants": n_variants,
69
+ "n_lvs_ok": ok_count,
70
+ "n_lvs_fail": fail_count,
71
+ "variants_per_case_distribution": dict(vpc),
72
+ "failure_patterns": dict(fail_by_pattern),
73
+ "total_routes_checked": total_routes,
74
+ }
75
+ Path(r"D:\tmp\hf\pic-benchmark\dataset_stats.json").write_text(
76
+ json.dumps(out, indent=2), encoding="utf-8")
77
+ print("\nWrote dataset_stats.json")
pic-benchmark/dataset_stats.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "n_cases": 123,
3
+ "n_variants": 440,
4
+ "n_lvs_ok": 407,
5
+ "n_lvs_fail": 33,
6
+ "variants_per_case_distribution": {
7
+ "2": 18,
8
+ "4": 101
9
+ },
10
+ "failure_patterns": {
11
+ "route_endpoints_mismatched + route_unknown_net + under_routed_nets + dangling_instance_ports": 2,
12
+ "route_endpoints_mismatched + route_unknown_net + under_routed_nets": 27,
13
+ "dangling_instance_ports": 2,
14
+ "endpoint_geometry_mismatch": 2
15
+ },
16
+ "total_routes_checked": 184506
17
+ }