Skip to content

wcet: name the op and byte offset in an unmodeled-op decline (#921) - #922

Merged
avrabe merged 3 commits into
mainfrom
fix/wcet-unmodeled-op-names-921
Aug 7, 2026
Merged

wcet: name the op and byte offset in an unmodeled-op decline (#921)#922
avrabe merged 3 commits into
mainfrom
fix/wcet-unmodeled-op-names-921

Conversation

@avrabe

@avrabe avrabe commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes #921. Additive to synth-wcet-v1; .text unchanged.

{"status":"declined","name":"f","reason":"unmodeled-op",
 "note":"op not classified by the cycle model","op":"I64Ldr","offset":8}

Both fields are optional and absent for every other reason, so existing consumers are unaffected.

Two design choices worth flagging

The doc comment was false

WcetDecline::UnmodeledOp claimed it was "never emitted in a released build (the classifier is exhaustive with no wildcard)". op_cost does have no wildcard arm — exhaustive in the compiler's sense — but many arms return Unmodeled deliberately: the i64 pseudo-ops and the whole MVE/Helium f32 family. Exhaustive over variants is not costed for every variant, and #921 is that difference showing up on the first real object. Corrected.

Measured, not assumed

I nearly shipped "it'll be the i64 family, timestamps are 64-bit" as fact. Testing it:

shape result
i64.load declinesI64Ldr
i64.add bounded
i64.ge_s bounded
i64.extend_i32_u bounded

The selector expands most i64 ops before the WCET pass sees them. Which op @avrabe's object actually trips is what the new field answers — on their object, not by inference from mine.

What caught the bug in the fix

Threading the site through function_wcet alone left op null in every real sidecar, because the CLI goes through the composer (wcet_compose). Unit tests on the patched path passed throughout. The end-to-end run found it, so the regression test is end-to-end too and red-first verified — reverting the composer patch reproduces the exact JSON from the issue and fails the test.

The test also refuses to pass over an empty set: if I64Ldr ever becomes costed, it fails loudly rather than silently asserting nothing.

clippy clean, 133 test suites green.

gale got 9 of 31 functions declined with {name, reason, note} and nothing else
— the second-largest category, actionable only by hand-bisecting the object.
Adds optional `op` + `offset` to the decline record, additive so existing
consumers are unaffected.

`op` is derived from Debug, not a hand-maintained table (no mirror to drift).
`offset` comes from the REAL encoder, the same source WcetLoopBound uses, and
is OMITTED rather than estimated when it cannot be computed — a drifted offset
is worse than none.

CORRECTS A FALSE DOC CLAIM: the variant said it was 'never emitted in a released
build (the classifier is exhaustive with no wildcard)'. op_cost indeed has no
wildcard, but many arms return Unmodeled deliberately — exhaustive over variants
is not costed for every variant.

Threading it through function_wcet alone left op null in every REAL sidecar,
because the CLI goes through the composer; the unit path passed regardless. The
end-to-end run caught it, so the regression test is end-to-end and red-first
verified: reverting the composer patch reproduces gale's exact JSON and fails.

Measured, not assumed: i64.load reproduces (I64Ldr); i64.add / i64.ge_s /
i64.extend_i32_u come out BOUNDED because the selector expands them first.

clippy 0, 133 test suites green.

Refs #921, #778
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.73684% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/synth-cli/src/main.rs 0.00% 3 Missing ⚠️
crates/synth-backend/src/wcet.rs 97.50% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

avrabe added 2 commits August 7, 2026 07:13
The clippy and test-helper fixes were applied with a script AFTER the last
`cargo fmt` run, so the formatter never saw them. Format caught it.
@avrabe
avrabe enabled auto-merge (squash) August 7, 2026 11:38
@avrabe
avrabe merged commit 6c3d62a into main Aug 7, 2026
56 checks passed
@avrabe
avrabe deleted the fix/wcet-unmodeled-op-names-921 branch August 7, 2026 12:36
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.

wcet: unmodeled-op declines don't name the op — 9 of 31 functions blocked with nothing to act on

1 participant