Skip to content

intg: declare live-read task results outside translate_off - #58

Open
nanavati wants to merge 1 commit into
upstream-mainfrom
intg/task-result-live
Open

intg: declare live-read task results outside translate_off#58
nanavati wants to merge 1 commit into
upstream-mainfrom
intg/task-result-live

Conversation

@nanavati

@nanavati nanavati commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Pre-existing stock-bsc bug (II-14): task result declarations move to the synthesis view when read by live logic; 24-file regold re-cut without the parked lint trio's EN-fold fallout.


Integration-release carve (see ~/bluespec/upstream/INTEGRATION-RELEASE.md). Also landed on release/integration-2026-08.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NRVtTNugutAyrTED4qHnrt

@nanavati
nanavati marked this pull request as draft August 3, 2026 09:49
@nanavati

nanavati commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Marked draft: this pick is NOT standalone — its live-analysis (synth_live_ids/growLive) was introduced by the parked -translate-sim-only trio, so this branch doesn't compile by itself (caught when the integration release candidate hit the same missing block). Needs the re-cut the carve plan already prescribes (II-14: carry its own live analysis, regold re-cut without the trio's EN-fold fallout). Also reverted out of release/integration-2026-08 pending that re-cut.

The declarations-used-by-system-tasks group has always been inside
translate_off, but a task result (a file handle from $fopen, an
imported function's return value) can be read by synthesized logic
such as a register input. Hiding the only declaration of a
synthesis-visible reference leaves that reference undeclared, and one
such error aborts the whole analysis. Partition the group by synthesis
liveness: decls with synthesizable readers are emitted in the open,
the rest stay under translate_off.
@nanavati

nanavati commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator Author

Re-cut on clean upstream-main. Two findings:

  1. The 24-file golden regold was 100% contamination — every hunk was the parked lint-trio's EN-fold fallout ($EN regrouping, constant-EN always-block folding); none of the 24 goldens contained the new "read by synthesized logic" group. Upstream's testsuite has no design where a synth-live signal is assigned only in a foreign block, which is why this bug went unreported. The re-cut regolds zero existing goldens: the diff is now AVerilog.hs + the new task_result_live test.
  2. The branch didn't compile standalone: synth_live_ids was defined by the parked II-16 partition machinery on the original base. The re-cut defines it locally — the uses of every def emitted outside the translate_off foreign blocks (so a task result read only by other sim-only code stays hidden with it).

Verified: derived_bits 66/0, evaluator/opt 84/0, curry 12/0, quirks 66/0 — all with untouched goldens — and task_result_live 3/0. Full-suite gate on this head running; will post before un-drafting.

@nanavati
nanavati force-pushed the intg/task-result-live branch from 48794eb to 1f3fbee Compare August 4, 2026 04:15
@nanavati

nanavati commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator Author

Full-suite gate on the re-cut head (1f3fbee7, upstream-main base): 20,283 PASS / 0 FAIL / 134 XFAIL / 0 XPASS, exit 0 — zero golden churn suite-wide. Marking ready for review.

@nanavati
nanavati marked this pull request as ready for review August 4, 2026 04:29
nanavati pushed a commit that referenced this pull request Aug 23, 2026
Task #58 (monorepo handoff bug 3, design per external review): a
design that CALLS a BDPI import whose partner .c/.so was never linked
segfaulted through a NULL callee global (ip=0) — the loader fills
trs_bdpi_<name> pointers only for symbols the companion .bdpi.so
provides, and compiled call sites called through whatever was left.

Fix: every compiled BDPI call site null-checks its callee global and
branches to a noreturn trap through trs_cb_bdpi_missing, passing the
import's name as a baked C string — ABI-clean (no call through a
mistyped shim), names the exact import, and dead imports stay
harmless because an uncalled site never reaches the check. The trap
pointer is defined in the module prologue beside the other callback
globals (an on-demand declaration without an initializer exports an
undefined symbol and knocks the whole artifact onto the fallback
path — caught by BdpiMin in the first battery pass) and filled by
aot_load with a runtime fn that prints the import name and aborts.
Baked/JIT callees are resolved constants and already bail gracefully.

The trap fires wherever the first call executes — including DURING
trs link, whose window bake / reset protocol runs early cycles; that
is exactly the field shape (PbuAlu0Fp*Test died at link), which now
aborts loudly with the name instead of segfaulting.

Witnesses: new battery fixtures BdpiMissing (executed-missing import:
loud named trap, phase-agnostic, never rc 139; interp leg raises its
own loud error) and BdpiDead (declared-but-dead import runs green on
both engines); battery grows to 25 checks; BdpiMin/StrCatBdpi (real
BDPI) unchanged.

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