Skip to content

hbg: record Graph off the ring on A5 so the first invocation is one GRAPH task - #1780

Merged
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
ChaoZheng109:port-1731-a5-off-ring-record
Aug 11, 2026
Merged

hbg: record Graph off the ring on A5 so the first invocation is one GRAPH task#1780
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
ChaoZheng109:port-1731-a5-off-ring-record

Conversation

@ChaoZheng109

@ChaoZheng109 ChaoZheng109 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Ports a2a3 host_build_graph PR #1731 (record Graph off the ring) to A5. Builds on #1777 (the #1732 port, now merged), since #1731's recording path consumes the scalar-source machinery #1732 introduces.

Why

A5 Graph Execution was ported in #1733 from a pre-#1731 a2a3 snapshot, and the parity follow-ups #1736/#1737 were never opened. On a cache miss the recording pass ran the Graph body through the ordinary submit path: every internal task took a ring task-window slot and a ring-heap allocation while being recorded. This brings A5 to parity with a2a3's current recording path.

What (mirrors #1731)

  • PTO2TaskAllocator gains reserve_heap_scratch / restore_heap_top.
  • The recording pass routes submit_task / submit_dummy_task / alloc_tensors to a new graph_record_submit_node, which records each node's layout off the ring — output buffers come from heap scratch (released in graph_end) instead of a task-window slot. No ring slot, tensormap, fanin-pool entry, or upload is produced for an internal node.
  • A scope inside a Graph body is a no-op during recording.
  • graph_end rolls the heap back to the recording watermark, compacts and caches the Definition, and emits the single outer GRAPH task. It now returns bool; when recording is unsupported or the outer task cannot be placed, the body re-runs on the ordinary path so its work is still submitted. The graph_end ops-table entry changes voidbool in both mirrored ops structs.

The first invocation now occupies one ring slot and one heap block instead of one per internal node.

Testing

  • Editable runtime build (a5 onboard + a5sim)
  • Full no-hardware C++ unit suite: 92/92
  • A5 graph_execution a5sim scenes: 3/3
  • Parity: A5 pto_ring_buffer.h and pto_orchestration_api.h now byte-identical to a2a3; pto_orchestrator.cpp down to 30 arch-only diff lines (was 387)
  • Pre-commit (clang-format, clang-tidy, cpplint, markdownlint)
  • A5 onboard hardware CI

Refs #1731.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 22 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: a5f5cf95-bb05-4ead-b09c-1b42f34549e4

📥 Commits

Reviewing files that changed from the base of the PR and between 7b3a975 and a635be9.

📒 Files selected for processing (7)
  • src/a5/runtime/host_build_graph/docs/GRAPH_EXECUTION.md
  • src/a5/runtime/host_build_graph/orchestration/pto_orchestration_api.h
  • src/a5/runtime/host_build_graph/runtime/orchestrator_core/pto_orchestrator.cpp
  • src/a5/runtime/host_build_graph/runtime/orchestrator_core/pto_runtime2.cpp
  • src/a5/runtime/host_build_graph/runtime/pto_orchestrator.h
  • src/a5/runtime/host_build_graph/runtime/pto_ring_buffer.h
  • src/a5/runtime/host_build_graph/runtime/pto_runtime2.h

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.

@ChaoZheng109
ChaoZheng109 force-pushed the port-1731-a5-off-ring-record branch from 5ab676d to a635be9 Compare August 11, 2026 07:27
…RAPH task

Ports a2a3 host_build_graph PR hw-native-sys#1731 to A5.

Mirrors hw-native-sys#1731 line-for-line. With hw-native-sys#1777 in place, the scalar-source
machinery hw-native-sys#1731's recording path depends on now exists on A5, so the
port is direct:

- PTO2TaskAllocator gains reserve_heap_scratch / restore_heap_top.
- The recording pass routes submit_task / submit_dummy_task /
  alloc_tensors to graph_record_submit_node, which records each node's
  layout off the ring — output buffers come from heap scratch (released
  in graph_end) instead of a task-window slot. No ring slot, tensormap,
  fanin-pool entry, or upload is produced for an internal node.
- A scope inside a Graph body is a no-op during recording.
- graph_end rolls the heap back to the recording watermark, compacts and
  caches the Definition, and emits the single outer GRAPH task. It now
  returns bool; when the outer task cannot be placed, the body re-runs on
  the ordinary path so its work is still submitted.
- The graph_end ops-table entry changes void -> bool in both mirrored
  ops structs.

The first invocation now occupies one ring slot and one heap block
instead of one per internal node.

Verified: full no-hardware C++ unit suite (92/92) and the A5
graph_execution a5sim scenes (3/3).
@ChaoZheng109
ChaoZheng109 merged commit af09fc2 into hw-native-sys:main Aug 11, 2026
18 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.

1 participant