Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
128 changes: 128 additions & 0 deletions .claude/skills/triage-issue/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
name: triage-issue
description: >
Triage an OpenROAD GitHub issue by reproducing the bug and
minimizing the test case with whittle.py. Use when an issue
has an attached tarball artifact (.tar.gz) from `make *_issue`.
argument-hint: <issue-number>
---

# Triage OpenROAD Issue

You are triaging OpenROAD issue **$ARGUMENTS**.

## 1. Fetch issue details

```bash
gh issue view $ARGUMENTS --repo The-OpenROAD-Project/OpenROAD \
--json title,body,labels,state,comments
```

Look for:
- Error string (e.g. `GPL-0305`, `GPL-0307`, `DRT-XXXX`)
- Attached tarball URL (from `make *_issue`)
- OpenROAD version the bug was reported against

## 2. Download and extract artifact

Download any `.tar.gz` attached to the issue body or comments.
Extract into a working directory:

```bash
mkdir -p /tmp/triage-$ARGUMENTS
cd /tmp/triage-$ARGUMENTS
tar xzf <downloaded-tarball>
cd <extracted-dir>
```

## 3. Fix the run script

The `run-me-*.sh` scripts from `make *_issue` often need two fixes:

```bash
# Add set -e to exit on error
sed -i '2i set -e' run-me-*.sh

# Add -exit so openroad exits after the tcl script
sed -i 's/openroad -no_init/openroad -exit -no_init/g' run-me-*.sh
sed -i 's/openroad -no_splash/openroad -exit -no_splash/g' run-me-*.sh
Comment on lines +47 to +48

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For conciseness and robustness, you can combine the two sed commands into a single one using a regular expression to match either -no_init or -no_splash.

Suggested change
sed -i 's/openroad -no_init/openroad -exit -no_init/g' run-me-*.sh
sed -i 's/openroad -no_splash/openroad -exit -no_splash/g' run-me-*.sh
sed -i 's/openroad \(-no_init\|-no_splash\)/openroad -exit \1/g' run-me-*.sh

```

## 4. Build OpenROAD

Build from the OpenROAD source tree:

```bash
cd <path-to>/OpenROAD
bazelisk build :openroad
```

The binary is at `bazel-bin/openroad`. Export it:

```bash
export OPENROAD_EXE=$(pwd)/bazel-bin/openroad
```

## 5. Reproduce the bug

Run the step command and confirm the error string appears:

```bash
cd /tmp/triage-$ARGUMENTS/<extracted-dir>
./run-me-*.sh 2>&1 | tee reproduce.log
grep -c "<error-string>" reproduce.log
```

If the bug does NOT reproduce with the latest OpenROAD, report this
on the issue -- the bug may have been fixed.

## 6. Run whittle.py

```bash
python3 <path-to>/OpenROAD/etc/whittle.py \
--error_string "<error-string>" \
--base_db_path <path-to>.odb \
--use_stdout --exit_early_on_error \
--step "./run-me-*.sh" \
--persistence 3 --multiplier 2
```

### Monitoring progress

Watch the `[whittle]` lines. Key things to check:

- **ETA growing?** The design may be too large for the current
persistence level. Try `--persistence 1` for a coarse first pass.
- **.odb size not shrinking?** The error may depend on most of the
design. Try increasing `--multiplier`.
- **Step timeout too long?** Use `--timeout 300` to cap each step
at 5 minutes.
- **After 5 minutes** of a step, whittle.py shows the tail of the
step's log so you can see what it is doing.

### When to abort

- If after 20+ steps the .odb size has not changed, abort and try
different parameters.
- If the step itself takes >10 minutes, consider whether the error
string is specific enough (avoid generic strings like "ERROR").

## 7. Upload results

Create a new tarball with the whittled .odb:

```bash
cp whittle_base_result_*.odb <original-odb-path>
tar czf whittled-$ARGUMENTS.tar.gz <extracted-dir>/
```

Comment on the issue with before/after stats:

```bash
gh issue comment $ARGUMENTS --repo The-OpenROAD-Project/OpenROAD \
--body "Whittled test case: original NNN insts -> MMM insts, \
.odb size: XXX MB -> YYY MB. Attached whittled tarball."
```

Upload the tarball to the issue comment via the GitHub web UI
(gh CLI does not support file attachments on comments).
28 changes: 28 additions & 0 deletions docs/user/Bazel.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,31 @@ an ORFS checkout):
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:

tmp/test/orfs/gcd/gcd_place_deps/make global_place_issue

### Monitoring progress

whittle.py prints `[whittle]` status lines showing the current phase,
element counts, .odb file size, and elapsed time. After a step runs for
more than 5 minutes, whittle.py also shows the last 10 lines of the
step's log output so you can tell what the step is doing.

If the .odb size is not shrinking after 20+ steps, try different
parameters (`--persistence 1` for a coarser first pass, or a higher
`--multiplier`). If each step takes more than 10 minutes, check that
`--error_string` is specific enough (avoid generic strings like "ERROR").

### Using Claude with whittle.py

Point Claude at a GitHub issue that has an attached tarball artifact
(from `make *_issue`). Claude can download the artifact, reproduce the
bug with the latest OpenROAD, run whittle.py, and upload a smaller
test case.

| Scenario | Recommended flags |
| --- | --- |
| Global placement bugs | `--error_string GPL-XXXX --persistence 3 --multiplier 2` |
| Fast initial reduction | `--persistence 1` first, then increase |
| Large designs (>100K insts) | Start with `--timeout 600` |

See the `/triage-issue` Claude skill in `.claude/skills/triage-issue/`
for the full step-by-step workflow.
14 changes: 0 additions & 14 deletions etc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,10 @@ py_binary(
test_suite(
name = "all_tests",
tests = [
":test_delta_debug",
":test_whittle",
],
)

py_library(
name = "delta_debug_lib",
srcs = ["deltaDebug.py"],
imports = ["."],
)

py_test(
name = "test_delta_debug",
srcs = ["test_deltaDebug.py"],
main = "test_deltaDebug.py",
deps = [":delta_debug_lib"],
)

py_test(
name = "test_whittle",
srcs = ["test_whittle.py"],
Expand Down
Loading
Loading