Skip to content

Fix: bind AICore run streams to code images - #1539

Closed
Crane-Liu wants to merge 1 commit into
hw-native-sys:mainfrom
Crane-Liu:codex/worker-async-a0b-stream-generation
Closed

Fix: bind AICore run streams to code images#1539
Crane-Liu wants to merge 1 commit into
hw-native-sys:mainfrom
Crane-Liu:codex/worker-async-a0b-stream-generation

Conversation

@Crane-Liu

Copy link
Copy Markdown
Contributor

Summary

  • derive a stable AICore image identity from child kernel bytes and function mapping during callable registration
  • keep AICPU streams slot-owned while recreating the AICore stream whenever the loaded image changes
  • preserve same-image stream reuse and expose code-generation transitions through the existing creation counter
  • add A2/A3 hardware coverage that alternates observably different add/sub images and checks every output

Testing

  • python -m pytest tests/ut -q: 832 passed, 6 skipped
  • non-hardware CTest: 62/62 passed
  • pre-commit on all changed files: passed
  • A2/A3 architecture precheck: passed
  • A2/A3 hardware regression: task_20260727_061452_383131022458, 3/3 passed
  • failing regression on main: task_20260727_060331_37075211981 reached the A-to-B transition with correct outputs but the stream-generation counter remained unchanged

Stack

This is the A0b prerequisite from the worker async pipeline plan. It should land before the rewritten acceptance fence in #1467 and before depth-two slot leases are enabled.

Compute a stable identity from each callable's AICore child binaries
and function mapping, then carry it through callable registration.

Reuse a slot's AICPU stream independently, but recreate its AICore
stream whenever the loaded image changes. Extend hardware coverage with
alternating add/sub images and retain same-image reuse checks.
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Crane-Liu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 567a0f6d-6b3c-4255-b8a2-c00ae2319e69

📥 Commits

Reviewing files that changed from the base of the PR and between f44c715 and d3c60ba.

📒 Files selected for processing (19)
  • python/simpler/task_interface.py
  • python/simpler/worker.py
  • src/a2a3/platform/onboard/host/device_runner.cpp
  • src/a2a3/platform/onboard/host/device_runner.h
  • src/a2a3/runtime/host_build_graph/host/runtime_maker.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/host/runtime_maker.cpp
  • src/a5/runtime/host_build_graph/host/runtime_maker.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/host/runtime_maker.cpp
  • src/common/platform/onboard/host/c_api_shared.cpp
  • src/common/platform/onboard/host/device_runner_base.cpp
  • src/common/platform/onboard/host/device_runner_base.h
  • src/common/task_interface/chip_callable_layout.h
  • src/common/task_interface/prepare_callable_common.h
  • src/common/utils/fnv1a_64.h
  • src/common/worker/chip_worker.h
  • src/common/worker/pto_runtime_c_api.h
  • tests/st/a2a3/host_build_graph/run_stream_reuse/kernels/aiv/kernel_sub.cpp
  • tests/st/a2a3/host_build_graph/run_stream_reuse/test_run_stream_reuse.py
  • tests/ut/cpp/types/test_chip_callable_upload_immutable.cpp

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

Comment @coderabbitai help to get the list of available commands.

@ChaoWao

ChaoWao commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Closing — this landed with #1467.

#1467 was merged as a squash of both commits (b072b5b9, 35 files, +933/-137), so the A0b work went in underneath the acceptance change rather than ahead of it. The intended A0b → A1 ordering did not survive the merge, but nothing was dropped.

Verified file by file against upstream/main rather than by patch-id — git cherry reports + here only because the commit was rebased, so its patch-id no longer matches.

On main already:

  • aicore_image_hash / has_aicore_image on the run stream set
  • ensure_run_stream_set(slot, aicore_image_hash)
  • tests/st/a2a3/host_build_graph/run_stream_reuse/kernels/aiv/kernel_sub.cpp
  • test_aicore_stream_tracks_code_image
  • tests/ut/cpp/types/test_chip_callable_upload_immutable.cpp

Only on this branch — all of it stale, none of it a loss:

Line Why main is right
config carries block_dim (0 = auto) #1309 removed the user-facing block_dim knob
_MAILBOX_ARGS_CAPACITY without the - 8, four-argument run_from_blob pre-dates the sticky acceptance word carved out in #1467
"Only one live device run is admitted", _wait_for_serialization in the submit drain pre-dates the acceptance fence; submit() now drains on acceptance

So the branch is behind main, not ahead of it.

Sorry for the collapsed stack — that was mine. I pushed the rebased #1467 with this commit still below it, which is what let the squash swallow both.

@ChaoWao ChaoWao closed this Jul 28, 2026
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