Skip to content

Commit 7628418

Browse files
authored
Merge pull request #9749 from Pinata-Consulting/delta-debug-prune
Delta debug prune
2 parents b524065 + 30f5080 commit 7628418

8 files changed

Lines changed: 287 additions & 690 deletions

File tree

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
name: triage-issue
3+
description: >
4+
Triage an OpenROAD GitHub issue by reproducing the bug and
5+
minimizing the test case with whittle.py. Use when an issue
6+
has an attached tarball artifact (.tar.gz) from `make *_issue`.
7+
argument-hint: <issue-number>
8+
---
9+
10+
# Triage OpenROAD Issue
11+
12+
You are triaging OpenROAD issue **$ARGUMENTS**.
13+
14+
## 1. Fetch issue details
15+
16+
```bash
17+
gh issue view $ARGUMENTS --repo The-OpenROAD-Project/OpenROAD \
18+
--json title,body,labels,state,comments
19+
```
20+
21+
Look for:
22+
- Error string (e.g. `GPL-0305`, `GPL-0307`, `DRT-XXXX`)
23+
- Attached tarball URL (from `make *_issue`)
24+
- OpenROAD version the bug was reported against
25+
26+
## 2. Download and extract artifact
27+
28+
Download any `.tar.gz` attached to the issue body or comments.
29+
Extract into a working directory:
30+
31+
```bash
32+
mkdir -p /tmp/triage-$ARGUMENTS
33+
cd /tmp/triage-$ARGUMENTS
34+
tar xzf <downloaded-tarball>
35+
cd <extracted-dir>
36+
```
37+
38+
## 3. Fix the run script
39+
40+
The `run-me-*.sh` scripts from `make *_issue` often need two fixes:
41+
42+
```bash
43+
# Add set -e to exit on error
44+
sed -i '2i set -e' run-me-*.sh
45+
46+
# Add -exit so openroad exits after the tcl script
47+
sed -i 's/openroad -no_init/openroad -exit -no_init/g' run-me-*.sh
48+
sed -i 's/openroad -no_splash/openroad -exit -no_splash/g' run-me-*.sh
49+
```
50+
51+
## 4. Build OpenROAD
52+
53+
Build from the OpenROAD source tree:
54+
55+
```bash
56+
cd <path-to>/OpenROAD
57+
bazelisk build :openroad
58+
```
59+
60+
The binary is at `bazel-bin/openroad`. Export it:
61+
62+
```bash
63+
export OPENROAD_EXE=$(pwd)/bazel-bin/openroad
64+
```
65+
66+
## 5. Reproduce the bug
67+
68+
Run the step command and confirm the error string appears:
69+
70+
```bash
71+
cd /tmp/triage-$ARGUMENTS/<extracted-dir>
72+
./run-me-*.sh 2>&1 | tee reproduce.log
73+
grep -c "<error-string>" reproduce.log
74+
```
75+
76+
If the bug does NOT reproduce with the latest OpenROAD, report this
77+
on the issue -- the bug may have been fixed.
78+
79+
## 6. Run whittle.py
80+
81+
```bash
82+
python3 <path-to>/OpenROAD/etc/whittle.py \
83+
--error_string "<error-string>" \
84+
--base_db_path <path-to>.odb \
85+
--use_stdout --exit_early_on_error \
86+
--step "./run-me-*.sh" \
87+
--persistence 3 --multiplier 2
88+
```
89+
90+
### Monitoring progress
91+
92+
Watch the `[whittle]` lines. Key things to check:
93+
94+
- **ETA growing?** The design may be too large for the current
95+
persistence level. Try `--persistence 1` for a coarse first pass.
96+
- **.odb size not shrinking?** The error may depend on most of the
97+
design. Try increasing `--multiplier`.
98+
- **Step timeout too long?** Use `--timeout 300` to cap each step
99+
at 5 minutes.
100+
- **After 5 minutes** of a step, whittle.py shows the tail of the
101+
step's log so you can see what it is doing.
102+
103+
### When to abort
104+
105+
- If after 20+ steps the .odb size has not changed, abort and try
106+
different parameters.
107+
- If the step itself takes >10 minutes, consider whether the error
108+
string is specific enough (avoid generic strings like "ERROR").
109+
110+
## 7. Upload results
111+
112+
Create a new tarball with the whittled .odb:
113+
114+
```bash
115+
cp whittle_base_result_*.odb <original-odb-path>
116+
tar czf whittled-$ARGUMENTS.tar.gz <extracted-dir>/
117+
```
118+
119+
Comment on the issue with before/after stats:
120+
121+
```bash
122+
gh issue comment $ARGUMENTS --repo The-OpenROAD-Project/OpenROAD \
123+
--body "Whittled test case: original NNN insts -> MMM insts, \
124+
.odb size: XXX MB -> YYY MB. Attached whittled tarball."
125+
```
126+
127+
Upload the tarball to the issue comment via the GitHub web UI
128+
(gh CLI does not support file attachments on comments).

‎docs/user/Bazel.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,3 +405,31 @@ an ORFS checkout):
405405
This should eventually leave you with a whittled down .odb file. Copy the whittled down .odb file into the correct place for 3_2_place_iop.odb, then create a bug report:
406406

407407
tmp/test/orfs/gcd/gcd_place_deps/make global_place_issue
408+
409+
### Monitoring progress
410+
411+
whittle.py prints `[whittle]` status lines showing the current phase,
412+
element counts, .odb file size, and elapsed time. After a step runs for
413+
more than 5 minutes, whittle.py also shows the last 10 lines of the
414+
step's log output so you can tell what the step is doing.
415+
416+
If the .odb size is not shrinking after 20+ steps, try different
417+
parameters (`--persistence 1` for a coarser first pass, or a higher
418+
`--multiplier`). If each step takes more than 10 minutes, check that
419+
`--error_string` is specific enough (avoid generic strings like "ERROR").
420+
421+
### Using Claude with whittle.py
422+
423+
Point Claude at a GitHub issue that has an attached tarball artifact
424+
(from `make *_issue`). Claude can download the artifact, reproduce the
425+
bug with the latest OpenROAD, run whittle.py, and upload a smaller
426+
test case.
427+
428+
| Scenario | Recommended flags |
429+
| --- | --- |
430+
| Global placement bugs | `--error_string GPL-XXXX --persistence 3 --multiplier 2` |
431+
| Fast initial reduction | `--persistence 1` first, then increase |
432+
| Large designs (>100K insts) | Start with `--timeout 600` |
433+
434+
See the `/triage-issue` Claude skill in `.claude/skills/triage-issue/`
435+
for the full step-by-step workflow.

‎etc/BUILD‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,10 @@ py_binary(
2323
test_suite(
2424
name = "all_tests",
2525
tests = [
26-
":test_delta_debug",
2726
":test_whittle",
2827
],
2928
)
3029

31-
py_library(
32-
name = "delta_debug_lib",
33-
srcs = ["deltaDebug.py"],
34-
imports = ["."],
35-
)
36-
37-
py_test(
38-
name = "test_delta_debug",
39-
srcs = ["test_deltaDebug.py"],
40-
main = "test_deltaDebug.py",
41-
deps = [":delta_debug_lib"],
42-
)
43-
4430
py_test(
4531
name = "test_whittle",
4632
srcs = ["test_whittle.py"],

0 commit comments

Comments
 (0)