Datasets:
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -23,41 +23,171 @@ configs:
|
|
| 23 |
|
| 24 |
# PIE gem5-timed code optimization (per source program)
|
| 25 |
|
| 26 |
-
C++ program-optimization data from the [PIE](https://pie4perf.com/) dataset
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
case
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
- **Compile-fail** programs dropped (`g++ -O2 -std=gnu++17`).
|
| 43 |
- **Bad-apple** programs dropped: a submission failing > max(5, 5% of cases) is treated as
|
| 44 |
wrong/mislabeled (line-wise + 1e-3 float comparator).
|
| 45 |
- **gem5 hard-excludes** (startup_fail / all-cases-hang-or-crash) dropped.
|
| 46 |
-
- **Case kept** iff every surviving good program of the problem passes it.
|
| 47 |
-
- **Strict 2-min wall**: cases above 1.4e10 ticks dropped.
|
| 48 |
- Source dropped if it fails > max(5, 5%); oracle target must also pass the same bar.
|
| 49 |
-
- 3 degenerate problems (empty input+output) dropped.
|
| 50 |
-
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
| 55 |
-
|
|
| 56 |
-
|
|
| 57 |
-
|
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
Built 2026-06-12. Timing: gem5.fast with fork-from-live startup amortization.
|
|
|
|
| 23 |
|
| 24 |
# PIE gem5-timed code optimization (per source program)
|
| 25 |
|
| 26 |
+
C++ program-optimization data derived from the [PIE](https://pie4perf.com/) dataset
|
| 27 |
+
(["Learning Performance-Improving Code Edits"](https://arxiv.org/abs/2302.07867)),
|
| 28 |
+
**re-timed end-to-end with gem5** (x86 Skylake, syscall-emulation mode) at
|
| 29 |
+
**per-test-case granularity**. One row per unique (problem, source) program; the best surviving target is kept as an oracle ceiling.
|
| 30 |
+
|
| 31 |
+
This dataset is **reward-agnostic**: it ships the full per-test-case reference timings and
|
| 32 |
+
case manifests so a downstream RL / eval pipeline decides at runtime how many cases to use
|
| 33 |
+
(`K`) and which reward transform to apply. Nothing is baked in.
|
| 34 |
+
|
| 35 |
+
> **For an automated agent reading this card:** every column is documented in
|
| 36 |
+
> [§ Field dictionary](#field-dictionary) below, including its type, encoding, and which
|
| 37 |
+
> splits populate it. Start with [§ How to compute the reward](#how-to-compute-the-reward).
|
| 38 |
+
|
| 39 |
+
## TL;DR units & encoding
|
| 40 |
+
- **Ticks are gem5 picoseconds.** `seconds = ticks * 1e-12`.
|
| 41 |
+
- Columns named `*_per_tc_ticks`, `*_tc2time`, `*_case_ids`, `*_excluded` are **JSON strings**
|
| 42 |
+
(a dict `{case_idx: value}` or a list `[case_idx, ...]`) — `json.loads` them.
|
| 43 |
+
Case indices are integers `0 .. n_cases_available-1`.
|
| 44 |
+
- `gem5_*` / `our_*` / `*_case_ids` / `n_*` / `flag_*` columns are produced by **this re-timing**.
|
| 45 |
+
`pie_*` columns are **carried verbatim** from the official PIE release.
|
| 46 |
+
|
| 47 |
+
## How to compute the reward
|
| 48 |
+
The reward is a **speedup ratio** over a common set of test cases, robust to which cases you
|
| 49 |
+
sample:
|
| 50 |
+
```python
|
| 51 |
+
import json, random
|
| 52 |
+
src = json.loads(row["gem5_src_per_tc_ticks"]) # {idx: ticks}
|
| 53 |
+
tgt = json.loads(row["gem5_tgt_per_tc_ticks"]) # ("oracle" variant in the bysrc dataset)
|
| 54 |
+
usable = json.loads(row["usable_case_ids"]) # correctness-kept ∩ both-timed ∩ ticks<=wall
|
| 55 |
+
K = 5 # runtime choice; -1 / len(usable) = use all
|
| 56 |
+
cases = usable if K < 0 else random.sample(usable, min(K, len(usable)))
|
| 57 |
+
speedup = sum(src[str(c)] for c in cases) / sum(tgt[str(c)] for c in cases)
|
| 58 |
+
```
|
| 59 |
+
`usable_case_ids` is already the correct, fully-filtered set — **do not** re-derive correctness
|
| 60 |
+
or apply the wall yourself. Always clamp `K` to `len(usable)`; never pad, skip, or zero-reward a
|
| 61 |
+
pair that has fewer than `K` usable cases. K=5–10 reproduces the full ~100-case aggregate within
|
| 62 |
+
~1–2% (per-case time is near-uniform within a program).
|
| 63 |
+
|
| 64 |
+
`gem5_fastest_id` / `gem5_fastest_per_tc_ticks` give the **fastest surviving program of the
|
| 65 |
+
problem** (chosen among programs present in this dataset, ranked over the per-problem common
|
| 66 |
+
usable basis) as an oracle ceiling; `our_fastest_speedup` is src-vs-fastest over `usable_case_ids`.
|
| 67 |
+
|
| 68 |
+
## Provenance & validation
|
| 69 |
+
- Timing engine: **gem5.fast**, X86 SE mode, with fork-from-live startup amortization (one
|
| 70 |
+
startup simulation, COW-forked per case; per-case ticks equal a fresh run, validated r=1.0).
|
| 71 |
+
- Validated against PIE's published numbers: per-test-case r=1.0 on the test split (aligned on
|
| 72 |
+
PIE's released `tests` indices); speedup log-correlation ~0.97–0.98, median ratio ~0.99.
|
| 73 |
+
- **Caveat — pin your toolchain.** The gem5 startup floor depends on the compiler/glibc/link
|
| 74 |
+
mode (≈13M ticks static ↔ ≈195M ticks dynamic). These reference ticks were produced with one
|
| 75 |
+
fixed toolchain; if you re-time rollouts, use the *same* toolchain or regenerate references,
|
| 76 |
+
otherwise speedups are not comparable.
|
| 77 |
+
|
| 78 |
+
## Filtering (rows are pre-filtered; bad records are DROPPED, not flagged)
|
| 79 |
- **Compile-fail** programs dropped (`g++ -O2 -std=gnu++17`).
|
| 80 |
- **Bad-apple** programs dropped: a submission failing > max(5, 5% of cases) is treated as
|
| 81 |
wrong/mislabeled (line-wise + 1e-3 float comparator).
|
| 82 |
- **gem5 hard-excludes** (startup_fail / all-cases-hang-or-crash) dropped.
|
| 83 |
+
- **Case kept** iff every surviving good program of the problem passes it (correctness intersection).
|
| 84 |
+
- **Strict 2-min wall**: cases above 1.4e10 ticks dropped from `usable`.
|
| 85 |
- Source dropped if it fails > max(5, 5%); oracle target must also pass the same bar.
|
| 86 |
+
- 3 degenerate problems (empty input+output: p00000, p02068, p00754) dropped.
|
| 87 |
+
- Retained NON-dropping flags: `flag_low_headroom`, `flag_single_case`, `flag_empty_kept`.
|
| 88 |
+
|
| 89 |
+
## Splits & why some columns are null
|
| 90 |
+
| split | rows | notes |
|
| 91 |
+
|---|---|---|
|
| 92 |
+
| train | 16501 | PIE released reward/difficulty annotations but no benchmark `tests` here. |
|
| 93 |
+
| validation | 590 | same as train. |
|
| 94 |
+
| test | 878 | PIE released benchmark `tests` indices + per-tc reference times here. |
|
| 95 |
+
|
| 96 |
+
PIE ships **different columns for test vs train/val**, so each row only fills the `pie_*`
|
| 97 |
+
columns that apply to its split; the rest are null **by design** (the schema is the union across
|
| 98 |
+
splits). Specifically: `pie_*_code_*`, `pie_fastest_code*`, `pie_*_tc2time`, `pie_n_tests`,
|
| 99 |
+
`pie_test_*`, `pie_tests_case_ids` are **test-only**; `pie_speedup`, `pie_*_verdict`,
|
| 100 |
+
`pie_*_reward_updated*`, `pie_fastest_agg_runtime_updated` are **train/val-only**. None of the
|
| 101 |
+
`gem5_*` / `our_*` / `*_case_ids` / `n_*` columns are ever null.
|
| 102 |
+
|
| 103 |
+
## Field dictionary
|
| 104 |
+
Availability: **all** = populated in every split; **test-only** / **train/val-only** = null elsewhere.
|
| 105 |
+
|
| 106 |
+
### Identity
|
| 107 |
+
|
| 108 |
+
| field | splits | meaning |
|
| 109 |
+
|---|---|---|
|
| 110 |
+
| `problem_id` | all | PIE/online-judge problem id. Groups every submission for one problem; the unit the correctness-intersection and `tests` benchmark are defined over. |
|
| 111 |
+
| `src_id` | all | Submission id of the SOURCE (slower, to-be-optimized) program. |
|
| 112 |
+
| `oracle_tgt_id` | all | Submission id of the chosen ORACLE target = the surviving target with the highest `our_speedup_usable` for this source. [bysrc only] |
|
| 113 |
+
| `split` | all | Dataset split: train / validation / test. |
|
| 114 |
+
| `language` | all | Programming language. Always `cpp` (C++). |
|
| 115 |
+
|
| 116 |
+
### Code
|
| 117 |
+
|
| 118 |
+
| field | splits | meaning |
|
| 119 |
+
|---|---|---|
|
| 120 |
+
| `src_code` | all | Full C++ source of the source program. |
|
| 121 |
+
| `oracle_tgt_code` | all | Full C++ source of the oracle target program. [bysrc only] |
|
| 122 |
+
|
| 123 |
+
### Our gem5 per-test-case timing
|
| 124 |
+
|
| 125 |
+
| field | splits | meaning |
|
| 126 |
+
|---|---|---|
|
| 127 |
+
| `gem5_src_per_tc_ticks` | all | JSON {case_idx: ticks}. gem5 picoseconds PER TEST CASE for the SRC program. Seconds = ticks * 1e-12. Holds EVERY case gem5 timed (incl. cases later discarded by correctness/wall filters) — select cases via `usable_case_ids`. |
|
| 128 |
+
| `gem5_oracle_tgt_per_tc_ticks` | all | JSON {case_idx: ticks} for the oracle target (same convention). [bysrc only] |
|
| 129 |
+
| `gem5_fastest_id` | all | Submission id of the FASTEST surviving program for this problem, chosen among programs that appear as a src/tgt in THIS dataset, ranked by summed gem5 ticks over the per-problem common usable case basis. The practical oracle ceiling. |
|
| 130 |
+
| `gem5_fastest_per_tc_ticks` | all | JSON {case_idx: ticks} for the FASTEST program of this problem (see `gem5_fastest_id`); full per-case gem5 timing, same convention. |
|
| 131 |
+
| `gem5_fastest_usable_case_ids` | all | Usable case set for the fastest program = kept ∩ fastest-timed ∩ wall. |
|
| 132 |
+
| `gem5_fastest_sum_ticks_usable` | all | Sum of FASTEST-program ticks over `usable_case_ids`. Denominator of `our_fastest_speedup`. |
|
| 133 |
+
| `gem5_src_excluded` | all | JSON list of case indices gem5 could NOT time for the SRC program (hang / crash / over compute budget during the sweep). |
|
| 134 |
+
| `gem5_src_status` | all | gem5 sweep status for the src program: `ok` (all cases timed) or `forkloop_partial` (some cases excluded). Hard-fail statuses (startup_fail / native_all_excluded) are already dropped. |
|
| 135 |
+
| `gem5_oracle_tgt_status` | all | gem5 sweep status for the oracle target. [bysrc only] |
|
| 136 |
+
| `gem5_src_sum_ticks_all` | all | Sum of SRC ticks over `common_timed_case_ids` (cases timed on both sides). Numerator of `our_speedup_all`. |
|
| 137 |
+
|
| 138 |
+
### Case-id sets (JSON int lists) + counts
|
| 139 |
+
|
| 140 |
+
| field | splits | meaning |
|
| 141 |
+
|---|---|---|
|
| 142 |
+
| `timed_case_ids` | all | Case indices gem5 timed for the src (within the 2-min wall). [bysrc only] |
|
| 143 |
+
| `correctness_kept_case_ids` | all | Case indices passed by EVERY good (non-bad-apple, compile-ok) program of the problem = the correctness intersection. Problem-level, identical across rows of a problem. |
|
| 144 |
+
| `usable_case_ids` | all | THE case set to use for the reward = correctness-kept ∩ both-sides-timed ∩ ticks≤1.4e10 (pairs) / kept ∩ src-timed ∩ wall (bysrc). Falls back to all-timed when the kept set is empty (single-case problems). |
|
| 145 |
+
| `n_timed` | all | len(timed_case_ids). [bysrc only] |
|
| 146 |
+
| `n_kept` | all | len(correctness_kept_case_ids). |
|
| 147 |
+
| `n_usable` | all | len(usable_case_ids). The effective case count behind the speedup. |
|
| 148 |
+
| `n_cases_available` | all | Total test cases that exist for the problem in the merged test-case set. |
|
| 149 |
+
| `src_n_fail` | all | # cases the SRC program failed in the native correctness screen (line-wise + 1e-3 float comparator). 0 = passed all. |
|
| 150 |
+
|
| 151 |
+
### Derived speedups + flags
|
| 152 |
+
|
| 153 |
+
| field | splits | meaning |
|
| 154 |
+
|---|---|---|
|
| 155 |
+
| `our_speedup_usable` | all | **Reference speedup** = sum(src ticks) / sum(tgt ticks) over `usable_case_ids`. Case-set-invariant; this is what training should reproduce. |
|
| 156 |
+
| `our_speedup_all` | all | sum(src)/sum(tgt) over `common_timed_case_ids` (no correctness/wall filtering). Provenance/debug. |
|
| 157 |
+
| `our_fastest_speedup` | all | sum(src ticks)/sum(fastest ticks) over `usable_case_ids`. Speedup of the src against the FASTEST program of the problem = the practical oracle ceiling for this source. |
|
| 158 |
+
| `ceiling_speedup` | all | Mean per-case src ticks / startup floor (192M ticks). Theoretical max speedup attainable for this src given the gem5 startup floor. Drives `flag_low_headroom`. |
|
| 159 |
+
| `flag_low_headroom` | all | True if ceiling_speedup < 1.5 — little room to optimize (kept, not dropped). |
|
| 160 |
+
| `flag_single_case` | all | True if the problem has only one test case. |
|
| 161 |
+
| `flag_empty_kept` | all | True if the correctness intersection was empty (single-case false-alarm problems; usable then falls back to all-timed). |
|
| 162 |
+
|
| 163 |
+
### Carried verbatim from PIE (`pie_*`)
|
| 164 |
+
|
| 165 |
+
| field | splits | meaning |
|
| 166 |
+
|---|---|---|
|
| 167 |
+
| `pie_src_agg_runtime` | all | PIE's published aggregate wall-clock runtime (seconds) of the src program (their gem5 measurement). |
|
| 168 |
+
| `pie_oracle_tgt_agg_runtime` | all | PIE's published aggregate runtime (s) of the oracle tgt. [bysrc only] |
|
| 169 |
+
| `pie_speedup` | train/val-only | PIE's published src/tgt speedup. [train/val only] |
|
| 170 |
+
| `pie_fastest_agg_runtime` | all | PIE's published aggregate runtime (s) of the problem's fastest solution. |
|
| 171 |
+
| `pie_src_verdict` | train/val-only | Online-judge verdict for the src (e.g. Accepted). [train/val only] |
|
| 172 |
+
| `pie_oracle_tgt_verdict` | train/val-only | Online-judge verdict for the oracle tgt. [bysrc, train/val only] |
|
| 173 |
+
| `pie_fastest_agg_runtime_updated` | train/val-only | PIE's re-measured fastest-solution agg runtime. [train/val only] |
|
| 174 |
+
| `pie_src_reward_updated` | train/val-only | PIE's annotated reward for the src. [train/val only] |
|
| 175 |
+
| `pie_src_reward_updated_pct_bin` | train/val-only | PIE's difficulty/percentile bin for the src reward. [train/val only] |
|
| 176 |
+
| `pie_n_tests` | test-only | # benchmark test cases PIE used for this problem. [test only] |
|
| 177 |
+
| `pie_test_accuracy` | test-only | PIE's reported accuracy over the benchmark cases. [test only] |
|
| 178 |
+
| `pie_src_code_accuracy` | test-only | PIE's src accuracy over the benchmark cases. [test only] |
|
| 179 |
+
| `pie_src_code_compilation` | test-only | PIE's src compilation flag. [test only] |
|
| 180 |
+
| `pie_fastest_code` | test-only | Full C++ source of the fastest solution PIE identified for the problem. [test only] |
|
| 181 |
+
| `pie_fastest_code_len` | test-only | Token/char length of pie_fastest_code as PIE recorded it. [test only] |
|
| 182 |
+
| `pie_fastest_code_runtime` | test-only | PIE's agg runtime (s) of pie_fastest_code. [test only] |
|
| 183 |
+
| `pie_src_code_tc2time` | test-only | PIE's OWN per-test-case times for the src, JSON {idx: seconds}. [test only] |
|
| 184 |
+
| `pie_oracle_tgt_code_tc2time` | test-only | PIE's OWN per-test-case times for the oracle tgt, JSON {idx: seconds}. [bysrc, test only] |
|
| 185 |
+
| `pie_fastest_code_tc2time` | test-only | PIE's OWN per-test-case times for the fastest solution, JSON {idx: seconds}. [test only] |
|
| 186 |
+
| `pie_tests_case_ids` | test-only | JSON list of the benchmark case indices PIE released for this test problem (subset of 0..n_cases_available-1). [test only] |
|
| 187 |
+
|
| 188 |
+
## Companion dataset
|
| 189 |
+
This is one of a pair built from the same timing:
|
| 190 |
+
- **pie-gem5-pairs** — one row per official (src, tgt) pair.
|
| 191 |
+
- **pie-gem5-bysrc** — one row per unique (problem, src); best surviving target kept as oracle.
|
| 192 |
|
| 193 |
Built 2026-06-12. Timing: gem5.fast with fork-from-live startup amortization.
|