Skip to content

Add: declare A5 TMR pipeline contract - #1678

Merged
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
vegetabledoww:codex/issue-1582-a8-pipeline-contract
Aug 5, 2026
Merged

Add: declare A5 TMR pipeline contract#1678
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
vegetabledoww:codex/issue-1582-a8-pipeline-contract

Conversation

@vegetabledoww

@vegetabledoww vegetabledoww commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Declare the complete pipeline contract for the A5 tensor-map and ring-buffer runtime instead of relying on the conservative single-slot declaration.

The runtime now reports a pipeline depth of two and classifies all six resources it uses:

  • task arguments as HOST_PER_RUN
  • GM heap, GM shared memory, and the runtime image as shared DEVICE_SCRATCH
  • AICPU and AICore streams as per-run EXEC_HANDLE resources

Why

The previous A5 TMR declaration exposed no resources and a pipeline depth of one. As a result, ChipWorker could only provision the legacy single-slot path even though the runtime's resource lifetimes support two pipeline slots.

The explicit contract lets the worker allocate independent host runtime buffers and execution handles for each in-flight slot while continuing to reuse the pooled device arenas. Device operations remain serialized, so the arena resources do not require per-slot copies.

Implementation

  • Add a shared A5 TMR pipeline-contract definition used by the runtime export and tests.
  • Return the complete declaration from get_pipeline_contract().
  • Validate the ABI version, pipeline depth, arena topology, resource count, kinds, and resource classes in the C++ unit tests.

Validation

  • test_pipeline_contract: 22/22 tests passed locally.
  • A5 simulation libhost_runtime.so built successfully.
  • Confirmed that get_pipeline_contract is exported from the generated runtime library.
  • Formatting and pre-commit checks passed.

Related to #1582.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7685c207-a260-4822-a2b7-0c4040b7de52

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The A5 host runtime now defines and exports a TMR pipeline contract. The contract describes six resources, and unit tests validate its topology, depth, resource count, resource classes, kinds, and reserved sizes.

Changes

A5 TMR pipeline contract

Layer / File(s) Summary
Define and export the TMR contract
src/a5/runtime/tensormap_and_ringbuffer/host/tmr_pipeline_contract.h, src/a5/runtime/tensormap_and_ringbuffer/host/runtime_maker.cpp
Defines six TMR resources and exports them through get_pipeline_contract.
Validate the shipped contract
tests/ut/cpp/CMakeLists.txt, tests/ut/cpp/hierarchical/test_pipeline_contract.cpp
Adds the host include path and verifies the A5 contract topology, depth, resource count, kinds, classes, and reserved sizes.

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

Possibly related PRs

Poem

I’m a rabbit with six slots in line,
A TMR contract, crisp and fine.
The host now shares its planned array,
Tests check each resource’s stay.
Hop, hop—A5 is ready to run!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly and concisely describes the main change: adding the A5 TMR pipeline contract.
Description check ✅ Passed The description directly explains the contract changes, resource classifications, implementation, rationale, and validation.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch codex/issue-1582-a8-pipeline-contract

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.

@vegetabledoww
vegetabledoww force-pushed the codex/issue-1582-a8-pipeline-contract branch 3 times, most recently from b1200f5 to 91799f7 Compare August 4, 2026 12:03
Expose the A5 tensor-map and ring-buffer runtime's pipeline depth and resource ownership so ChipWorker can provision two in-flight slots correctly. Share the declaration with a unit test that validates its ABI, arena topology, and complete resource classification.
@ChaoZheng109
ChaoZheng109 force-pushed the codex/issue-1582-a8-pipeline-contract branch from 91799f7 to 78ea067 Compare August 5, 2026 08:39
@ChaoZheng109
ChaoZheng109 merged commit 6c4218f into hw-native-sys:main Aug 5, 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.

2 participants