Skip to content

CI: reduce packaging, profiling, and unit-test overhead - #1805

Merged
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
doraemonmj:ci/streamline-ut
Aug 13, 2026
Merged

CI: reduce packaging, profiling, and unit-test overhead#1805
ChaoZheng109 merged 1 commit into
hw-native-sys:mainfrom
doraemonmj:ci/streamline-ut

Conversation

@doraemonmj

@doraemonmj doraemonmj commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reuse process-global runtime helpers and limit no-hardware UT builds to the simulator platforms they exercise.
  • Generate per-target profiling headers so all six flag combinations and both simulator architectures reuse unaffected objects.
  • Use an empty job-local ccache across packaging modes, normalize the macOS deployment target across all five modes, and fall back when ccache is unavailable.
  • Keep sanitizer builds on one host ABI and isolate sanitizer state between tests.
  • Build A3 C++ UT before NPU allocation, then run Python and C++ hardware UT under one allocation.
  • Validate packaging installs outside the source tree and keep every mode fully clean.
  • Upload POD diagnostics best-effort so artifact failures cannot replace the test result.

Scope and safety

  • Keeps profiling in one job; no job splitting and no coverage reduction.
  • Keeps one real cold build per packaging job and does not restore compiler objects across jobs.
  • ccache only reuses objects when compiler inputs match; CMake configuration, linking, installation, and smoke checks still run for every mode.
  • The macOS target is the runner's existing major.minor target, made explicit so pip and direct CMake receive the same compiler input.
  • Self-hosted runners without ccache keep the original uncached behavior.
  • Does not change the unrelated worker admission-fence timing test.

Observed CI result

Run 31666256787, before the macOS target-normalization experiment:

  • Profiling: 11m19s baseline to 6m33s total; the 12 build/test groups fell from about 9m30s to 4m51s.
  • Packaging Ubuntu: 10m34s to 4m00s total, with 79.14% ccache hits.
  • Packaging macOS: 10m19s to 9m50s total, with 62.72% hits.
  • All profiling, packaging, simulator, hardware, and POD jobs passed.
  • macOS Python UT hit an existing timing-boundary flake: 0.999468792s measured against a 1.0s assertion. This PR intentionally does not modify that unrelated test.

Validation

  • Rebased onto current upstream/main and kept as one commit.
  • Targeted runtime/toolchain UT: 66 passed.
  • Profiling matrix: 6 configurations × 2 simulator architectures passed.
  • Packaging matrix passed on Ubuntu and macOS before target normalization.
  • YAML and pre-commit checks passed for the normalization change.
  • Fresh CI is measuring macOS packaging time and ccache hits for the normalized target.

@coderabbitai

coderabbitai Bot commented Aug 12, 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: d8b48c08-c0d2-4d28-89ff-72f8f7fbeeb4

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 change updates runtime build reuse, conditional compiler verbosity, packaging dependency validation, isolated packaging smoke checks, and several GitHub Actions workflows for profiling and hardware tests. Documentation now reflects minimum dependency versions and the packaging verification matrix.

Changes

Build and CI updates

Layer / File(s) Summary
Runtime build orchestration
simpler_setup/build_runtimes.py, simpler_setup/runtime_builder.py, simpler_setup/runtime_compiler.py, tests/ut/py/test_build_runtimes.py, tests/ut/py/test_runtime_builder.py, tests/ut/py/test_runtime_compiler.py
Runtime builds pre-build shared libraries once and reuse them for individual runtimes. Compiler commands add --verbose only for debug logging. Tests cover both behaviors.
Packaging setup and verification
.github/workflows/_packaging.yml, docs/getting-started.md, docs/python-packaging.md, tools/verify_packaging.sh
Packaging setup installs missing tools conditionally. Documentation and verification enforce minimum dependency versions. Smoke checks run from a temporary directory and validate CMake and Ninja availability.
CI test execution paths
.github/workflows/_profiling-flags-smoke.yml, .github/workflows/_ut-no-hardware.yml, .github/workflows/_ut-npu-a2a3.yml
Profiling combinations run across architectures before the next combination. No-hardware setup uses packaged GoogleTest and build_package_sim. A2A3 workflows separate C++ compilation and run Python tests with CTest on non-x86 systems.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Poem

A rabbit checks each build with care,
Shared helpers wait, already there.
Tests hop through flags and platforms bright,
Packaging paths stay clean and light.
“Build once,” I say, “then run just right!” 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.94% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 summarizes the main CI efficiency improvements across packaging, profiling, and unit-test workflows.
Description check ✅ Passed The description directly explains the CI optimizations, validation results, scope, and remaining checks for the changeset.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔇 Additional comments (19)
.github/workflows/_packaging.yml (2)

44-57: LGTM!


73-73: LGTM!

docs/getting-started.md (1)

110-119: LGTM!

docs/python-packaging.md (2)

126-126: LGTM!


161-165: LGTM!

tools/verify_packaging.sh (3)

32-34: LGTM!


44-88: LGTM!


91-145: LGTM!

simpler_setup/runtime_builder.py (1)

309-315: LGTM!

Also applies to: 326-328, 405-411

tests/ut/py/test_build_runtimes.py (1)

12-49: LGTM!

tests/ut/py/test_runtime_builder.py (1)

282-301: LGTM!

simpler_setup/runtime_compiler.py (1)

443-445: LGTM!

tests/ut/py/test_runtime_compiler.py (1)

14-35: LGTM!

.github/workflows/_profiling-flags-smoke.yml (1)

74-80: 🚀 Performance & Scalability

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify the helper-library cache lifetime.

Line 82 starts a new .venv/bin/python process for each architecture and profiling combination. A cache held only in process state cannot survive between those invocations. If reuse is process-local, this loop order does not share helper builds between a2a3sim and a5sim; use one build process for both platforms or a persistent cache keyed by DEFS.

.github/workflows/_ut-no-hardware.yml (2)

52-52: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that libgtest-dev provides every required test target.

The workflow now installs only libgtest-dev on Linux. If tests/ut/cpp links GTest::gmock, gmock_main, or another component not supplied by this package, CMake configuration or linking will fail.


64-67: 🎯 Functional Correctness

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that build_package_sim builds both simulator artifacts.

The comment states that worker tests require a2a3sim and a5sim, but the command names only one build target. Confirm that build_package_sim expands to both artifacts before relying on the later test jobs.

.github/workflows/_ut-npu-a2a3.yml (3)

49-54: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

Confirm that test_comm_lifecycle is the aggregate hardware-test target.

Line 54 builds only test_comm_lifecycle, but Line 69 runs every CTest case with the requires_hardware or requires_hardware_a2a3 label. If test_comm_lifecycle is a single executable, CTest will attempt to run other unbuilt binaries after device allocation.


56-61: LGTM!


72-72: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify the Python interpreter used inside task-submit.

The outer shell activates .venv, but Line 72 invokes python inside a task-managed command string. If task-submit does not preserve PATH and the virtual environment, pytest can run with system Python and miss the installed project dependencies. Use .venv/bin/python or activate the environment inside the submitted command if inheritance is not guaranteed.

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@simpler_setup/build_runtimes.py`:
- Around line 171-172: Update the process-global helper build flow around
builder.get_binaries so helpers consumed by mixed onboard and simulation
runtimes are built with one sanitizer-compatible toolchain, independent of
platforms[0] ordering; alternatively key helper outputs by toolchain. Preserve
compatible compiler and sanitizer-runtime selection for every consumer, and add
tests covering both mixed platform orders.
🪄 Autofix

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 Plus

Run ID: cfa5ea73-6069-4ef4-aa7b-16a57c3a7c47

📥 Commits

Reviewing files that changed from the base of the PR and between 50c0660 and af3beba.

📒 Files selected for processing (13)
  • .github/workflows/_packaging.yml
  • .github/workflows/_profiling-flags-smoke.yml
  • .github/workflows/_ut-no-hardware.yml
  • .github/workflows/_ut-npu-a2a3.yml
  • docs/getting-started.md
  • docs/python-packaging.md
  • simpler_setup/build_runtimes.py
  • simpler_setup/runtime_builder.py
  • simpler_setup/runtime_compiler.py
  • tests/ut/py/test_build_runtimes.py
  • tests/ut/py/test_runtime_builder.py
  • tests/ut/py/test_runtime_compiler.py
  • tools/verify_packaging.sh

Comment thread simpler_setup/build_runtimes.py Outdated
@doraemonmj
doraemonmj force-pushed the ci/streamline-ut branch 4 times, most recently from 545f435 to 058c06f Compare August 13, 2026 04:11
@doraemonmj doraemonmj changed the title CI: reduce packaging and unit-test setup overhead CI: reduce packaging, profiling, and unit-test overhead Aug 13, 2026
@doraemonmj
doraemonmj force-pushed the ci/streamline-ut branch 3 times, most recently from 52a72eb to af0fd17 Compare August 13, 2026 06:41
- Reuse process-global runtime helpers and limit no-hardware UT builds to the simulator platforms they exercise
- Generate per-target profiling headers so all six flag combinations and both simulator architectures reuse unaffected objects
- Use an empty job-local ccache across packaging modes, normalize macOS compiler inputs, and fall back when ccache is unavailable
- Keep sanitizer builds on one host ABI and isolate sanitizer state between tests
- Build A3 C++ UT before NPU allocation, then run Python and C++ hardware UT under one allocation
- Validate packaging installs outside the source tree and keep every mode fully clean
- Upload POD diagnostics best-effort so artifact failures cannot replace the test result
@ChaoZheng109
ChaoZheng109 merged commit 300fb6d into hw-native-sys:main Aug 13, 2026
34 of 35 checks passed
@doraemonmj
doraemonmj deleted the ci/streamline-ut branch August 18, 2026 02:48
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