Skip to content

Add a2a3 CI job for on-device hello_world test#15

Merged
zhangqi-chen merged 1 commit intohw-native-sys:mainfrom
zhangqi-chen:ci
Mar 17, 2026
Merged

Add a2a3 CI job for on-device hello_world test#15
zhangqi-chen merged 1 commit intohw-native-sys:mainfrom
zhangqi-chen:ci

Conversation

@zhangqi-chen
Copy link
Collaborator

@zhangqi-chen zhangqi-chen commented Mar 17, 2026

Summary

  • Add a2a3 CI job that runs hello_world on a self-hosted ARM64 NPU runner with privileged container and Ascend driver mounts
  • Use aarch64 ptoas binary with SHA256 verification (matching pypto's system-tests pattern)
  • Switch hello_world.py to argparse, add --device flag for explicit device ID passthrough from CI environment

Testing

  • a2a3 job runs successfully on self-hosted NPU runner
  • sim job still passes (no regressions)
  • hello_world.py --sim and --device flags work correctly

Summary by CodeRabbit

Release Notes

  • Chores

    • Added ARM64 NPU test environment to CI pipeline.
  • Examples

    • Updated hello_world example with improved command-line argument support via --sim and --device flags.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's continuous integration capabilities by introducing a new CI job designed to test the hello_world example directly on ARM64 NPU hardware. This moves beyond simulation, providing more robust and realistic validation of the system's functionality. Additionally, the hello_world.py script has been updated to improve argument parsing, making it more flexible and adaptable for different testing scenarios.

Highlights

  • New CI Job: Added an a2a3 CI job to run the hello_world test on a self-hosted ARM64 NPU runner, including privileged container and Ascend driver mounts.
  • Binary Usage: Implemented the use of an aarch64 ptoas binary with SHA256 verification, aligning with existing system-tests patterns.
  • Script Refactoring: Refactored hello_world.py to utilize argparse for command-line arguments, introducing a new --device flag for explicit device ID passthrough from the CI environment.
Changelog
  • examples/hello_world.py
    • Switched from sys.argv to argparse for command-line argument parsing.
    • Added a --device flag to allow specifying the device ID, defaulting to 11.
    • Modified the compile_and_run function call to accept the new device_id argument.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

Warning

Rate limit exceeded

@zhangqi-chen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 30 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 811a45e8-ba1e-460b-8962-0365250dd269

📥 Commits

Reviewing files that changed from the base of the PR and between 0e86dc3 and 40ff1aa.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • examples/hello_world.py
📝 Walkthrough

Walkthrough

This pull request adds CI/CD infrastructure for ARM64 NPU testing via GitHub Actions and refactors the example script's command-line interface from direct sys.argv parsing to argparse for cleaner argument handling.

Changes

Cohort / File(s) Summary
CI/CD Configuration
.github/workflows/ci.yml
Introduces new GitHub Actions job (a2a3) targeting self-hosted ARM64 NPU environment. Job includes container setup, dependency installation (pip, nanobind, torch, pypto, PTOAS), repository cloning, and execution of hello_world test with NPU device bindings.
CLI Argument Handling
examples/hello_world.py
Refactors command-line argument parsing from sys.argv inspection to argparse module. Adds structured arguments: --sim (boolean flag) and --device (integer, default 11) to control platform selection and device ID.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hops through CI clouds with glee,
NPU jobs now run so free,
Argparse tames the argv dance,
With flags and defaults—what a chance!
Hardware testing hops along,
Our tests grow clever, ever strong. 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a new a2a3 CI job for on-device hello_world testing, which is the primary focus of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new CI job and updates the hello_world.py example to use argparse for command-line argument parsing. The switch to argparse is a good improvement for handling script parameters like --sim and the new --device flag. My review includes a suggestion to improve maintainability by centralizing the default value for the device ID, which is currently duplicated.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
examples/hello_world.py (1)

115-120: Consider adding help text for CLI arguments.

The argparse setup is functional, but adding help= strings would make the CLI self-documenting when users run --help.

📝 Suggested improvement
     parser = argparse.ArgumentParser()
-    parser.add_argument("--sim", action="store_true")
-    parser.add_argument("--device", type=int, default=11)
+    parser.add_argument("--sim", action="store_true", help="Run on simulator (a2a3sim) instead of hardware")
+    parser.add_argument("--device", type=int, default=11, help="NPU device ID for hardware runs")
     args = parser.parse_args()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/hello_world.py` around lines 115 - 120, Add descriptive help text to
the argparse options so the CLI becomes self-documenting: update the
parser.add_argument calls for "--sim" and "--device" to include help strings
(e.g., describe that "--sim" toggles simulation mode and "--device" selects the
device index, noting the default of 11) so that running the script with --help
displays meaningful descriptions; locate and modify the
parser.add_argument("--sim", action="store_true") and
parser.add_argument("--device", type=int, default=11) lines to add the help=
parameter.
.github/workflows/ci.yml (1)

84-92: Container image uses :latest tag, reducing build reproducibility.

Using :latest for ci-device-py310 means builds aren't pinned to a specific image version. If the image is updated, CI behavior could change unexpectedly without any PR changes.

Consider pinning to a digest or versioned tag for reproducible builds.

📌 Example with digest pinning
     container:
-      image: localhost:5000/ci-device-py310:latest
+      image: localhost:5000/ci-device-py310@sha256:<digest>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 84 - 92, The container image reference
"localhost:5000/ci-device-py310:latest" should be pinned to a specific,
immutable identifier to ensure reproducible CI runs; replace the ":latest" tag
with either a versioned tag (e.g., ci-device-py310:vX.Y.Z) or a content digest
(sha256:...) and update the image field accordingly so CI uses a fixed image for
every run.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 131-132: The workflow step "Run hello_world a2a3 test" passes
DEVICE_ID directly which may be unset and cause argparse to fail; update the CI
to either provide a safe default or validate DEVICE_ID before this step. Add a
preceding job/step (e.g., "Validate DEVICE_ID") that checks if the DEVICE_ID env
var is empty and fails with a clear error, or modify the run invocation to
fallback to a valid default (e.g., 0) when DEVICE_ID is not set; reference the
environment variable DEVICE_ID and the step name "Run hello_world a2a3 test"
when making the change.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 84-92: The container image reference
"localhost:5000/ci-device-py310:latest" should be pinned to a specific,
immutable identifier to ensure reproducible CI runs; replace the ":latest" tag
with either a versioned tag (e.g., ci-device-py310:vX.Y.Z) or a content digest
(sha256:...) and update the image field accordingly so CI uses a fixed image for
every run.

In `@examples/hello_world.py`:
- Around line 115-120: Add descriptive help text to the argparse options so the
CLI becomes self-documenting: update the parser.add_argument calls for "--sim"
and "--device" to include help strings (e.g., describe that "--sim" toggles
simulation mode and "--device" selects the device index, noting the default of
11) so that running the script with --help displays meaningful descriptions;
locate and modify the parser.add_argument("--sim", action="store_true") and
parser.add_argument("--device", type=int, default=11) lines to add the help=
parameter.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6f67e9bf-59b8-499d-80b7-d9926729e70b

📥 Commits

Reviewing files that changed from the base of the PR and between 3edb010 and 0e86dc3.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • examples/hello_world.py

- New a2a3 job runs on self-hosted ARM64 NPU runner with
  privileged container and Ascend driver mounts
- Uses aarch64 ptoas binary with SHA256 verification
- hello_world.py switches to argparse, adds --device flag
  for explicit device ID passthrough from CI environment
@zhangqi-chen zhangqi-chen merged commit ab85f17 into hw-native-sys:main Mar 17, 2026
4 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