Registry Mirror
Skip to content

Conversation

@avrabe

@avrabe avrabe commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Rebased onto 0b9fce7 (#1577/#1578/#1579) as a single squashed commit; every number below re-derived on the merged tree.

v0.89 lane: RQ-89-BRVALUE (Refs #1215) and RQ-89-SELWRAP (Refs #1213). DO NOT MERGE; the coordinator lands it.

Refuting commands (run first)

SELWRAP (#1213): REFUTED. select.wast as-convert-operand agrees with wasmtime on both legs (2 of 2 vectors each) on v0.88.0 (0161dee).

It is correct because the optimized path declines an i64 select: the RQ-65-DECLINE fallback (v0.65) sends the function to the direct selector. ir_to_arm was not fixed.

The spec vectors are weak (they return 0 and 1), so the issue's distinguishing probe was also run, selecting between 0x1122334455667788 and 0x1899aabbccddeeff:

  • Parity machinery (default and --no-optimize): 12 of 12 rows agree.
  • Bare objects on all three legs (default, --no-optimize, --relocatable): 18 of 18 rows agree.

A five-word-argument variant was not executed, because the harness does not pass stack arguments. Nothing was built for this artifact. Its status stays proposed with disposition: refuted and issue-scope: closes.

BRVALUE (#1215): CONFIRMED, then fixed. On v0.88.0 (0161dee), the operand-position functions in the spec br/br_if/br_table files (plus the if.wast/func.wast cases the issue names) were executed on both selectors:

case default (optimized) --no-optimize (direct) wasmtime agree?
br.wast nested-br_table-value-index() 12 12 9 NO
br_if.wast nested-br_table-value-index(0) 8 8 5 NO
br_if.wast nested-br_table-value-index(1) 12 12 9 NO
br_table.wast nested-br_table-value(0) 24 24 17 NO
br_table.wast nested-br_table-value(1) 16 16 9 NO
br_table.wast nested-br_table-value-index(0, 2, 3, -1000000, 9423975) 12 each 12 each 9 each NO (x5)
func.wast break-br_table-nested-num(1) 52 52 50 NO
every other br/br_if/br_table as-*/nested-* vector that compiles; if.wast as-br_if-last / as-br_table-last; func.wast break-br_table-* = = = yes

Probe totals:

file(s) rows (vector × leg) disagree
br.wast 105 2
br_if.wast 153 4
br_table.wast 158 14
if.wast + func.wast 48 2

On the "both selectors" framing: all 11 wrong assertions take direct (pre-gate) br-table,value-carry on the default leg too. That is one lowering, select_with_stack, reached two ways, which is why one fix covers both legs.

Declines (loud, not wrong code):

  • stack underflow on both legs: br.wast and br_table.wast as-br_if-cond, as-br_table-index, as-select-all, as-call-all, as-binary-both and others.
  • #509 i64 value-carry.
  • GI-FPU-002 float.
  • #509 branch to an if join.
  • VCR-RA-003 JoinValueNotAvailable on br_if.wast nested-br-value and nested-br_table-value. These two are fixed by this PR, see below.

--relocatable leg: the spec modules are refused whole on this leg (#1052, global initializers), so the parity oracle never executes it. The new oracle re-hosts the functions so it does. On v0.88.0 they are equally wrong there.

Root cause and fix (select_with_stack)

  1. Stack model at an unreachable join. Wasm's operand stack is polymorphic after br/br_table/return/unreachable; the direct selector's simulated stack is not. A block's end never reset the stack to its entry height, so values pushed by dead code after the transfer were consumed by the code after the block. For example, 4+8 was computed where the spec says 1+8.
    • BlockLabel gains three fields: entry_height; dead_prefix, the live stack[..entry] captured after the first unconditional transfer; and branched.
    • End at a dead but branched-to block truncates the stack to its entry height. It still emits the legacy dead fall-through move, so no correct function moves a byte.
    • A loop, or a block nothing branches to, propagates unreachability to its parent.
    • If dead code reached below the entry height, the compile is refused with a #1215: diagnostic.
    • Else resets the flag.
  2. Function-level br_table R0 landing. The carried value was moved to R0 before the CMP/Bcc cascade, overwriting an index that lived in R0. The value is now peeked after all block edges are allocated, and mov r0, val is emitted after br_table_fnret. The cascade writes no register in between. Bytes before the fix: mov r0, r1; cmp r0, #0.

Evidence (red on v0.88.0 → green on the fix, against wasmtime)

  • New oracle scripts/repro/brvalue_operand_1215_differential.py, wired into ci.yml (emulations >= 141; the step greps CHECKS=N/N and RESULT: PASS).
    • Coverage: 9 spec functions verbatim, rv32_br_value_931.wat's carried/promoted, and 4 propagation fixtures, on all three legs. It also pins the refusal on all three legs.
    • Base: #1215 CHECKS=57/144, with 29 failures on each leg: 18 wrong values, 10 vectors of refused functions, and the refusal needle absent.
    • Fix: 144/144 with 141 emulations.
    • New finding: rv32_br_value_931.wat's carried is 5 + (block (br 0 (i32.const 1)) (i32.const 0)). It returned 2 on all three ARM legs (wasmtime 6). That fixture is only run on RV32 in CI.
  • Parity oracle (selector_parity_197_differential.py), with the five #1215 KNOWN pins (11 cases) removed:
    • Base: CHECKS=17913/17924, exactly those 5 unpinned, rc 1.
    • Fix: CHECKS=17934/17934 over 261 modules, 25328 emulations, 0 unpinned, PASS.
  • Byte census, base vs fix, on the default, --no-optimize and --relocatable legs:
    • Inputs: 2243 modules (tests/wast and the spec suite), plus 447 .wat/.wasm files under scripts/repro, tests and examples.
    • Where bytes moved: only in br, br_if, br_table, func, labels and unwind .wast, rv32_br_value_931.wat, ra003_switch_1230.wat (now accepted) and the new fixture.
    • Execution: every moved function is executed by one of the two oracles above and agrees with wasmtime. The br_if as-call_indirect-* moves are only a literal-pool table address shifting.
    • Newly refused: 0. The pbe refusal shape was already refused by the base compiler, with a bare stack underflow.
    • Newly accepted (3), all executed correct: labels.wast switch, and br_if.wast nested-br-value and nested-br_table-value.
  • VCR-RA-003 refuses its own emitted stream on spec modules: JoinValueNotAvailable { reg: R4 } on br/br_if/br_table/labels (+ an R5 instance) — a caught would-be miscompile #1230 side effect. Those three newly accepted functions are exactly the three VCR-RA-003 refusals that ra003_join_1230_differential.py pins. Its KNOWN census moves from 3 to 0 (two rows set to 0), and the ci.yml greps move to TOTAL=0 (pin 0) and CHECKS: 0 declines.

Follow-up commit: whole-block run of every CI oracle step

Every ci.yml run: block that calls oracle_run.py scripts/repro/ was run whole against the fix build (202 blocks; the parity step was run separately, above).

  • ARM corpus sweep (ARM: select on an i64-comparison condition with COMPUTED arms always returns the then-arm — reload clobbers the live else-arm register #973) was red. ra003_switch_1230.wat now compiles and was still on EXPECTED_DECLINES. The entry is removed; the sweep executes its 12 vectors with 0 mismatches and is green at compiled=187/207.
  • Every other non-zero block was environmental. Each one was re-run against the base binary and failed identically there. The causes were a missing target/release, artifacts staged by earlier steps, the WCET argument plumbing, the aarch64 host link, fact-spec, and the home-alias audit's grep.
  • Byte census on more targets. It was re-run on cortex-m4f, cortex-m7dp (the FPU path whose f32 block rendezvous this change gates) and cortex-r5 (A32). The same functions moved, and no float function moved.
  • Mutation replay. No ci_subset site lies in select_with_stack.rs. The new step's job is not in suite.selected_jobs.
  • New step's grep. It no longer uses an ERE backreference.

Follow-up: three more populations, each measured old binary vs new binary on the same tree

Population Before After What moved, and the evidence
spec compile census (arm) ok 15 / partial 30 / MVP core ok 12 ok 16 / partial 29 / MVP core ok 13 Only labels.wast moved (partial → ok). Its switch passes 6/6 spec assertions in the parity oracle and runs on all three legs in the new oracle. The v0.88.0 binary fails the new pins with exactly these three mismatches; the fix passes on all three backends. The #1225 identity step passes.
home-alias audit 7307 / 8370 / 235493 (main, after INTALIAS) 7367 / 8418 / 236409 The whole change is the new fixture (15 functions × 4 legs = 60 / 48 / 916; it was 900 before INTALIAS added block-entry copies inside it). With the fixture held aside, both binaries print the old numbers exactly. The audit counts functions before VCR-RA-003 validation, so the functions this PR newly compiles were already counted.
mutation replay liveness.rs:7404:36 changed set 53 56 The +3 are the new fixture under its three configurations; none of the 53 dropped out. Re-pinned with pin-subset's sorted rule. mutation_survey.py ci ran to completion locally (subset=10, failures=0) and ci_mutants_gate passes.

Pinned numbers moved

Each has a paired control: the old value reds on the new tree, and the new value reds on the base.

pin before after note
known_open_pins 84 79 waiver to: 79, five pins closed by a fix
known_open_pinned_cases 157 146
selector_wildcard_arms_code 56 55 back at baseline; the _ => {} RQ-66 added to this BrTable match is gone
selector_wildcard_arms_total 94 93
selector_lines_code 20410 (main) 20543 waiver chained over INTALIAS/NPARESIDUE: +133 net (160 added, 64 of them comment; 27 removed)
selector_lines_total 31003 (main) 31136
exact emulation floor 368268 (main 0b9fce7) 368409 ci.yml and claims.yaml, re-derived on the rebased tree; --exact-emulation-floor 368409 rc 0, 368311 rc 1, 368268 rc 1
mutation_survey.json re-anchored: 2 sites moved; 34 live + 4 retired unchanged

artifacts/status.json was regenerated.

Checks run locally

  • cargo fmt --check and cargo clippy --workspace --all-targets -D warnings are clean.
  • cargo test -p synth-synthesis passes.
  • claim_check reports 75/75.
  • verdict_prose_check reports 0 disagreements.
  • status_evidence_check is clean once this PR's number is in landed:.
  • The cisweep shows 22 non-zero results, all environmental: missing release/musl/mcdc/varve artifacts, $ORACLE_EVIDENCE_JSONL unset, and mutation steps skipped locally. The R15 red from the PR-number placeholder was cleared by the follow-up amend.

Not verified

  • No QEMU, Renode or silicon run; execution is unicorn only.
  • The mutation-survey CI replay was not run locally.
  • Other v0.89 lanes also touch select_with_stack.rs, claims.yaml ratchets and mutation_survey.json, so expect merge conflicts on the pinned numbers.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L

@temper-pulseengine

temper-pulseengine Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Outdated — this review was for an earlier revision. See the latest review below.

Automated review for PR #1583

pulseengine/synth:v089-brvalue → pulseengine/synth:main

Verdict: 💬 Comment

Summary: The commit introduces several changes that need to be addressed before the PR can be merged. The main issues are related to the brvalue_operand_1215_differential.py script, which is used to test the behavior of the direct selector's stack model at an unreachable block join and a function-level br_table edge landing R0 over its own index. The script needs to be updated to correctly handle these 3

Findings: 0 mechanical (rivet) · 1 from local AI model.

Findings (1):

  1. crates/synth-synthesis/src/instruction_selector/select_with_stack.rs:7293
       "id": "R3-direct/COND/select_with_stack.rs:7293:37",
    
    The brvalue_operand_1215_differential.py script is not correctly handling the behavior of the direct selector's stack model at an unreachable block join and a function-level br_table edge landing R0 over its own index.

Generated by a local AI model and post-validated against a strict JSON contract. Each finding includes the verbatim line being criticised — verify by reading the file at the cited location.

Reviewed at 59cc953

@temper-pulseengine

temper-pulseengine Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Outdated — this review was for an earlier revision. See the latest review below.

Automated review for PR #1583

pulseengine/synth:v089-brvalue → pulseengine/synth:main

Verdict: 💬 Comment

Summary: The changes made to the codebase are focused on addressing issues related to register allocation and branch handling in the VCR-RA-003 validation. These changes include fixing bugs in the infer_i64_locals function, ensuring that the simulated operand stack is reset correctly when a block's fall-through is unreachable, and preventing the overwriting of local variables by branches.

Findings: 0 mechanical (rivet) · 2 from local AI model.

Findings (2):

  1. artifacts/status.json:17

    "known_open_pinned_cases": 157
    

    The number of known open pinned cases has increased from 157 to 146.

  2. artifacts/status.json:18

    "known_open_pins": 84
    

    The number of known open pins has decreased from 84 to 79.


Generated by a local AI model and post-validated against a strict JSON contract. Each finding includes the verbatim line being criticised — verify by reading the file at the cited location.

Reviewed at 4f1a6e5

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.62069% with 36 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...esis/src/instruction_selector/select_with_stack.rs 58.62% 36 Missing ⚠️

📢 Thoughts on this report? Let us know!

@temper-pulseengine

Copy link
Copy Markdown
Contributor

Automated review for PR #1583

pulseengine/synth:v089-brvalue → pulseengine/synth:main

Verdict: 💬 Comment

Summary: The pull request has been approved.

Findings: 0 mechanical (rivet) · 1 from local AI model.

Findings (1):

  1. docs/status/SPEC_FAMILY_CENSUS.md:120
    +**v0.89 movement (RQ-89-BRVALUE, #1215): arm MVP core 12 / 21 -> 13 / 20.** `labels.wast` moved from `partial` to `ok`. Its one declined function, `switch`, was a VCR-RA-003 refusal caused by the direct selector's stack model at an unreachable block join. It now compiles, and it is EXECUTED against wasmtime: all 6 of its spec assertions pass on both selectors in the parity oracle, and on all three ARM legs in `brvalue_operand_1215_differential.py`. No other file on any backend moved.
    
    The pull request has been approved.

Generated by a local AI model and post-validated against a strict JSON contract. Each finding includes the verbatim line being criticised — verify by reading the file at the cited location.

Reviewed at 9fdc921

…el at an unreachable block join, and lands a function-level br_table edge after the dispatch

RQ-89-BRVALUE (Refs #1215): DELIVERED. select_with_stack, the one
lowering every affected function takes on both legs (all are pre-gated
to it), had two defects:

- At a block whose fall-through is unreachable but which a branch
  targets, the simulated operand stack was never reset to the block's
  entry height. Values pushed by dead code after a br/br_table were
  consumed by the code after the block (br.wast
  nested-br_table-value-index returned 12; wasmtime returns 9).
  BlockLabel now records the entry height, the live prefix at the first
  unconditional transfer, and whether a branch targets the join. End
  resets the model, propagates unreachability out of a loop or an
  untargeted block, and loud-refuses if dead code reached below the
  entry height.
- A function-level br_table edge landed its carried value in R0 before
  the dispatch cascade, overwriting an index held in R0
  (func.wast break-br_table-nested-num(1) returned 52; wasmtime
  returns 50). The landing now follows the br_table_fnret label.

Evidence:
- New oracle brvalue_operand_1215_differential.py, run on the default,
  --no-optimize and --relocatable legs: 57/144 on v0.88.0, 144/144 on
  the fix.
- Parity oracle with its five #1215 pins removed: red on v0.88.0 with
  exactly those 11 assertions, green on the fix (17934/17934).
- Byte census: zero newly refused functions. Three VCR-RA-003 refusals
  pinned under #1230 now compile correctly, so that oracle's census
  moves from 3 to 0.

RQ-89-SELWRAP (Refs #1213): REFUTED. as-convert-operand and the issue's
distinguishing probe agree with wasmtime on every leg, because the
optimized path has declined the shape since v0.65.

Also in this commit, squashed from three follow-ups when it was rebased
onto 0b9fce7 (#1577/#1578/#1579):
- The ARM corpus sweep drops ra003_switch_1230.wat from
  EXPECTED_DECLINES. It now compiles, and its 12 vectors match wasmtime.
- The reach this moves is counted and pinned:
  - Spec compile census: labels.wast moves partial -> ok, so arm ok is
    16, partial 29 and MVP core 13.
  - Home-alias audit: the new fixture adds +60 functions, +48 homes and
    +916 attributed instructions.
  - Mutation replay: the liveness entry's changed set is 53 -> 56, the
    +3 being the new fixture.
- The exact emulation floor is re-derived on the merged tree, the
  mutation ledger is re-anchored, and the selector ratchets are chained
  over the INTALIAS and NPARESIDUE waivers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
@avrabe
avrabe merged commit bbda3f9 into main Oct 23, 2026
78 of 79 checks passed
@avrabe
avrabe deleted the v089-brvalue branch October 23, 2026 03:45
avrabe pushed a commit that referenced this pull request Oct 23, 2026
Rebased onto bbda3f9 (#1577 RELOCSINGLE, #1578 INTALIAS,
#1579 NPARESIDUE, #1583 BRVALUE). The census conflict was resolved
by taking main's numbers and pinning the LIVE census of the rebuilt
binary: arm 16 ok / 27 partial / 92 all_declined / 103
module_decline, riscv 9/31/94/104, aarch64 21/21/78/118, and
at-least-one-export 43/40/42. Paired: main's binary passes main's
pins and fails ours 9 ways; ours passes ours and fails main's 9 ways.
The lane record now quotes the merged-tree figures: parity
17934/17934, 2736 modules, 828 byte-identical compiles.
mutation_survey.json reanchored: 7 sites moved +96 lines in main.rs;
no count changed.

Refs #1582
Refs #1209

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
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