Skip to content

[AUTOMATED] campaign(decbench): triage the returndup regression set — no gate exists, keep it - #245

Merged
mahaloz merged 1 commit into
mainfrom
fix/decbench-returndup-gate
Aug 2, 2026
Merged

mahaloz merged 1 commit into
mainfrom
fix/decbench-returndup-gate

Conversation

@mahaloz

@mahaloz mahaloz commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

The kuna-only re-run on the optimized datasets reported 411 wins / 189 regressions
(O2-noinline) and 293 / 114 (O2), with a return/tail-duplication transform firing on the
large majority of every function whose score moved. This triages that finding. No code
changes
— the analysis says to leave the transform alone, and the measurements that say so
are recorded in docs/decbench/returndup-regression-triage.md.

Which transform

taildup: and returndup: render as the same return-dupe slug (PrintC::warning_slug),
so the reported correlation was measuring two passes at once. They separate by warning sink —
returndup uses warning_header (prototype line), taildup uses warning(addr) (statement
line). Classified that way it is returndup: 86% of wins, 66% of regressions; taildup
2–3%. The July artifacts carry 5,183 taildup: banners and zero returndup: — taildup
never moved.

Why it started firing

returndup is default-OFF. aggressive turns it on, and DIV-40 made auto
(= aggressive under 500 KiB) the front-end default. The July artifacts predate the mode
system entirely. On base-passwd::xmalloc, --mode reliable == --option returndup off ==
the July body, byte for byte.

#228 / DIV-47 is refuted. With returndup forced on, the fire count is identical at #228
and at its parent on all six probe binaries (17/17, 52/52, 410/410, 699/699, 76/76, 35/35),
and 0 with returndup off. A pass that is switched off cannot have its eligibility widened.

No discriminator exists

Isolating A/B on the same 36641d35 build, 536 slices / 52,862 functions. Validation: the
46,005 functions where returndup never fired score identically in both arms, and the
harness reproduces a published artifact byte-for-byte with zero score mismatches.

returndup ON OFF delta
aggregate GED 804,689 812,445 −7,756
GED-perfect 18,036 17,619 +417

608 perfects created vs 191 destroyed (3.2 : 1); 3,676 functions improved vs 2,079 worsened.

Nine candidate gates partitioned causally — split count, void vs value return, distinct return
values, return count, switch, all-returns-identical, body size, project, opt level — and
every cell is net-positive. The attractive void-return escape hatch in
returndup_is_const_ret (which explains xmalloc and do_statx) is more profitable than
the value case, not less.

The one net-negative cell — the split de-structures a loop (cleanflight nextArg loses its
for header, n=321, −257 GED) — was implemented as a gate and measured rather than left as
a theory: +2 GED-perfect / −209 GED. Not worth a new CFG walk, a stages testcase, a spec
revision and a baseline re-record; reverted.

Are the regressions real?

40% of them are not returndup at all. Of the eight worst, only three are. One of the others,
coreutils kill::print_table_row (0 → 10), is an outright improvement scored as a
regression — the July body silently dropped the description ? description : "?" argument. The
returndup regressions, read against source, are genuine shape divergences: xmalloc,
do_statx (nested if + one trailing return), USBD_StdDevReq (switch + break),
DCD_HandleUSBSuspend_ISR (one && chain), nextArg (a for loop).

Also in this PR

  • docs/modes.md no longer tells readers aggressive enables an option "known to regress
    aggregate GED (DIV-18)" — superseded by returndup: make it selective like angr (const-return gate) — cut the over-eager variable-return splits #137's const-return gate.
  • The DIV-18 row in docs/history.md is annotated with the superseding measurement.
  • Recorded but not acted on: returndup as a default now also passes the datatest gate
    (675/675, PARITY OK, zero assertion movement), so it clears the standing default-ON bar.
    Promoting it is a separate change with its own DIV row.

Gates

gate result
make test PARITY OK, 675/675
make test-stages PARITY OK, 356/356
make rust-test 4,411 passed / 0 failed
make check-spec OK
kuna catalog --check OK

Speed: docs only, no code change.

🤖 Generated with Claude Code

https://claude.ai/code/session_011RXVU58TKJxb518oViChwo

… no gate exists, keep it

The kuna-only re-run on the optimized datasets reported 411/189 (O2-noinline) and
293/114 (O2) with a return/tail-duplication transform on most functions whose
score moved. Triaged in three steps; the code is unchanged.

WHICH TRANSFORM. `taildup:` and `returndup:` render as the SAME `return-dupe`
slug (PrintC::warning_slug), so the reported correlation lumped two passes. They
separate by warning sink: returndup uses warning_header (prototype line), taildup
uses warning(addr) (statement line). Classified that way, returndup covers 86% of
wins and 66% of regressions; taildup 2-3%. The July artifacts carry 5,183
`taildup:` banners and ZERO `returndup:` — taildup never moved.

WHY IT STARTED. returndup is default-OFF; `aggressive` turns it on, and DIV-40
made `auto` (=aggressive under 500 KiB) the front-end default. The July artifacts
predate the mode system entirely. #228/DIV-47 is refuted directly: with returndup
forced on, the fire count is identical at #228 and its parent on all six probe
binaries (17/17, 52/52, 410/410, 699/699, 76/76, 35/35), and 0 with returndup off.

NO DISCRIMINATOR. An isolating A/B on the same 36641d3 build over 536 slices /
52,862 functions (validated: the 46,005 non-firing functions score identically,
and the harness reproduces a published artifact byte-for-byte) puts returndup at
+417 GED-perfect and -7,756 aggregate GED — 608 perfects created vs 191 destroyed.
Nine candidate gates were partitioned causally (split count, void vs value return,
distinct return values, return count, switch, all-returns-identical, body size,
project, opt level): every cell is net-positive. The void-return escape hatch in
returndup_is_const_ret, which explains xmalloc and do_statx, is MORE profitable
than the value case, not less.

The single net-negative cell — the split de-structures a loop (cleanflight nextArg
loses its `for` header) — was implemented as a gate and measured, not left as
theory: +2 GED-perfect / -209 GED. Not kept, and reverted here.

Also corrects docs/modes.md, which told readers `aggressive` enables an option
"known to regress aggregate GED (DIV-18)" — superseded by #137's const-return
gate — and annotates the DIV-18 row. returndup as a default now also passes the
datatest gate (675/675, PARITY OK); promoting it is left as a separate DIV.

Gates: make test PARITY OK 675/675; make test-stages PARITY OK 356/356;
make check-spec OK; kuna catalog --check OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011RXVU58TKJxb518oViChwo
@mahaloz
mahaloz merged commit 23cc922 into main Aug 2, 2026
9 checks passed
@mahaloz
mahaloz deleted the fix/decbench-returndup-gate branch August 2, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant