Skip to content

Add: [H2] serialize immutable HBG packets for HostArgs - #2174

Draft
TaoZQY wants to merge 1 commit into
hw-native-sys:mainfrom
TaoZQY:codex/hbg-pr-h2
Draft

Add: [H2] serialize immutable HBG packets for HostArgs#2174
TaoZQY wants to merge 1 commit into
hw-native-sys:mainfrom
TaoZQY:codex/hbg-pr-h2

Conversation

@TaoZQY

@TaoZQY TaoZQY commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

A leased Host build cannot outlive workspace reuse. Serialize it into an independently owned immutable packet containing pristine images of the frozen working regions, relative region descriptors and per-invocation identity. Relocate heap and Definition references while preserving caller tensor addresses and scalar values.

Produce a private writable HostArgs copy for every submission and bridge its single placeholder to CANN on the dedicated AICPU stream. Compact kernel layouts reserve bounded ready queues; each nonempty image includes the full frozen capacity and zeroed unused tails. The outer K1 header remains 64 bytes.

Validation

  • Both HBG C++ suites passed (44 cases per architecture), together with context and contract tests at this milestone.
  • Full rebased stack at H3 Add: [H3] seal and validate HBG execution slots #2175: 147 C++ test executables and 159 Python tests passed (4 hardware-marked skips), covering ABI, task interfaces and simulator DMA workspace.
  • Full-stack simulation with the pinned PTO ISA required: A2/A3 74 passed, 8 skipped; A5 71 passed.
  • Runtime libraries rebuilt; repository pre-commit checks passed. Each earlier milestone was independently compiled and tested.
  • mkdocs build --strict passed separately at all five PR heads. The HBG contract page is included in navigation from H1; the execution-slot page is included from H3.

The transport tests model CANN copy/patch behavior. Registered device entry points, independent execution-slot admission, semantic restore and the enclosing three-stream protocol are separate integration work; public kernel launch remains disabled.

Dependency and review scope

Draft 4/5: H2. Depends on #2173.

This draft is rebased onto main at a1aa7fddf42b2d28849bc3fb6fe1eb50ab891324 and squashed to one commit. The rebase retains the upstream documentation-theme update. Source and test files match the previous PR head exactly; the squash preserves the complete rebased tree. Applicable pre-commit checks passed again.

All five HBG drafts target main. Each PR has exactly one commit, containing K1 plus all HBG milestones through the stage in its title. Squashing changes commit history, not the cumulative code scope. The original isolated diff above remains available to review this stage alone. Rebase in dependency order after prerequisites land.

The K1 snapshot originally carried from 21fb15c0 is included in this squashed commit, with its human author retained as co-author. Upstream #2064 remains open and has advanced; alignment with its final version remains public execution integration work.

No idle onboard devices were available. Simulation golden checks cover existing program-mode regression; mixed ACLGraph capture/replay, DSV4 CSA device accuracy and comparative performance remain unvalidated.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

@TaoZQY TaoZQY changed the title Add: serialize immutable HBG graph packets for HostArgs launch Add: [H2] serialize immutable HBG packets for HostArgs Sep 10, 2026
Build compact kernel layouts and independently owned pristine graph
packets from leased Host build results and frozen context destinations.
Encode relative image regions, relocate heap and Definition references,
and preserve caller tensor addresses and scalar arguments.

Validate packet framing and integrity, produce a private writable copy
per submission, and bridge its single placeholder to the CANN HostArgs
API on the dedicated AICPU stream. Keep public kernel launch unsupported
until owner integration, device registration and restore are connected.

Cover ownership, relocation, malformed packets, capacity boundaries,
concurrent copies and launch failure propagation on both architectures.

Include the kernel-mode C ABI, state and invocation headers required
by this implementation. Retain the preceding HBG resource and packet
changes present in this draft where applicable. Public kernel launch
integration remains pending.

Co-authored-by: sunkaixuan2018 <baiyi@mail.ustc.edu.cn>
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