Skip to content

Fix: preserve A5 Scalar observers throughout resident execution - #3000

Merged
poursoul merged 1 commit into
hw-native-sys:mainfrom
nalinaly:fix/a5-scalar-observer-lifetime
Nov 11, 2026
Merged

poursoul merged 1 commit into
hw-native-sys:mainfrom
nalinaly:fix/a5-scalar-observer-lifetime

Conversation

@nalinaly

@nalinaly nalinaly commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

A5 L3 captures can omit memory primitives even when capture counters report zero drops and exclusive-time accounting balances. Bootstrap and the dispatch loop clear the Scalar observer after the resident entry has bound it.

Preserve the resident-owned binding across both phases. Keep initialization and teardown cleanup at the resident boundary. Add regressions that execute real bootstrap and dispatch paths and require atomic, bypass-load, cache-publication and barrier records.

Validation:

  • Both new regressions fail before the fix because the observer is cleared and primitive counts are zero.
  • All 132 startup/executor cases pass with the fix; all four affected C++ test targets pass.
  • Applicable pre-commit checks and git diff --check pass.
  • A5 onboard: three consecutive L3 captures passed numerical validation with 96 complete worker streams, zero drops, conserved exclusive time, and nonzero atomic, ld_dev, DCCI and DSB counts. The default -O3 AICore build includes all eight resident objects.

Related to #2991.

Keep the resident's Scalar binding active across bootstrap and dispatch.
Nested helpers must not clear the observer owned by the outer scope;
otherwise L3 omits memory primitives while reporting a complete capture.

Exercise both phases with a bound recorder and assert that atomic,
bypass-load, cache-publication and barrier records are emitted.
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Bootstrap and dispatch no longer clear the scalar observer binding on entry. run_resident_scheduler still clears it at resident-run entry. New tests check scalar trace records and verify that the binding clears when its scope ends.

Changes: Resident Scalar Observer Lifetime

Layer / File(s) Summary
Preserve binding across resident execution
src/a5/runtime/host_build_graph/aicore/resident_scheduler_impl.h, tests/ut/cpp/a5/runtime/host_build_graph/test_hbg_gm_mix_startup.cpp
Bootstrap and dispatch no longer clear the scalar observer binding on entry. Tests check phase records during bootstrap and dispatch, and verify that the binding clears at scope end.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • hw-native-sys/simpler#2667 — Tracks A5 AICore scheduling delivery, which includes the resident scheduling paths changed here.
  • hw-native-sys/simpler#2666 — Covers A5 capture and DFX integration; this PR adds tests for scalar trace records during resident execution.
  • hw-native-sys/simpler#2631 — Covers scheduler lifecycle and HBG readiness, which overlaps the bootstrap and dispatch paths changed here.

Possibly related PRs

  • hw-native-sys/simpler#2989 — Introduced the resident scheduler functions that this PR updates to preserve the scalar observer binding.
Merge Risk: Minimal · up to 0ffdf

This change keeps scalar observer tracing active through bootstrap and dispatch, so A5 captures include memory primitives. No actionable merge risk was found. Onboard verification is reportedly still in progress.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly identifies the main change: preserving A5 Scalar observers throughout resident execution.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description directly matches the changes. It explains preserving the Scalar observer binding across bootstrap and dispatch, retaining cleanup at the resident boundary, and adding regr…
Full details: Description check

Explanation

The pull request description directly matches the changes. It explains preserving the Scalar observer binding across bootstrap and dispatch, retaining cleanup at the resident boundary, and adding regression tests for the affected trace records.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the traces at dawn,
While bootstrap keeps the binding on.
Dispatch leaves its records clear,
Then scope-end cleanup draws near.
I twitch my nose: the phases show!

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1dc014c8-2106-475b-9d5c-8ae113c71bfb
Commits

Reviewing files that changed from the base of the PR and between 63a0fb9 and 0ffdfad.

Files selected for processing: 2

  • src/a5/runtime/host_build_graph/aicore/resident_scheduler_impl.h
  • tests/ut/cpp/a5/runtime/host_build_graph/test_hbg_gm_mix_startup.cpp
Files with no reviewable changes: 1

  • src/a5/runtime/host_build_graph/aicore/resident_scheduler_impl.h

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@poursoul
poursoul merged commit 4bd38e2 into hw-native-sys:main Nov 11, 2026
14 checks passed
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.

2 participants