Fix: build host_build_graph orchestration on x86 hosts#1367
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAICPU cache maintenance now has non-AArch64 no-op implementations, while system-counter timing uses a scaled ChangesAICPU portability
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds support for non-aarch64 platforms in AICPU cache operations and device timing. Cache maintenance operations are stubbed out as inert on non-aarch64, and get_sys_cnt_aicpu is updated to emulate the hardware timer using a host-side clock. The review feedback correctly points out that std::chrono::high_resolution_clock should be replaced with std::chrono::steady_clock to guarantee monotonicity and avoid issues with system time adjustments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/common/platform/onboard/aicpu/device_time.cpp`:
- Line 29: Replace std::chrono::high_resolution_clock with
std::chrono::steady_clock when capturing now in the system counter tick
implementation, preserving the existing tick conversion and return behavior so
get_sys_cnt_aicpu() remains strictly monotonic like device_time_now_ticks().
🪄 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: b143a632-e472-466d-9b0e-49e8d8559379
📒 Files selected for processing (2)
src/common/platform/onboard/aicpu/cache_ops.cppsrc/common/platform/onboard/aicpu/device_time.cpp
4e997ca to
9b5a4b5
Compare
host_build_graph runs its orchestration .so on the host CPU, so compile_orchestration() builds it with the bare host g++. The orch compile unconditionally links the onboard AICPU helpers device_time.cpp and cache_ops.cpp, whose bodies are aarch64-only inline asm (mrs cntvct_el0, dc civac/cvac, dsb, isb). On an ARM64 runner the host g++ targets aarch64, so the asm assembled and the latent host-arch assumption stayed hidden. hw-native-sys#1361 made st-onboard-a2a3 eligible for x86_64 runners; there the host g++ feeds aarch64 asm to the x86 assembler and every host_build_graph L2 test fails with "Orchestration compilation failed ... no such instruction: mrs %rax,cntvct_el0". Gate the asm behind __aarch64__ and add a host-portable else branch: - device_time: get_sys_cnt_aicpu() now delegates the clock read to device_time_now_ticks() (monotonic steady_clock off aarch64), then rescales ns to the PLATFORM_PROF_SYS_CNT_FREQ unit it reports in, so the orchestrator's cycle-based timeouts (get_sys_cnt_aicpu() - t0 > ..._CYCLES) and DFX decode stay valid. The prior sim variant used the non-monotonic high_resolution_clock; unify both on device_time_now_ticks(). - cache_ops: no-op off aarch64. The host orchestrator reaches device memory only through driver H2D DMA (cache-coherent on x86), so the AICPU-side manual cache maintenance has no host-side referent. aarch64 (device AICPU and ARM64-host orchestration) is behaviorally unchanged; only the x86 host build gains a compilable path.
Why
host_build_graphruns its orchestration.soon the host CPU(build_config: "Host runs the orchestrator to completion, populating SM +
arena, then H2Ds the image to device"), so
compile_orchestration()builds it with the bare host
g++(ToolchainType.HOST_GXX). That orchcompile unconditionally links the onboard AICPU helpers
device_time.cpp/cache_ops.cpp(added by #1236 so orch SOs using thepublic AICPU helper headers resolve). Both files' bodies are
aarch64-only inline asm —
mrs cntvct_el0,dc civac/cvac,dsb,isb.On an ARM64 runner the host
g++targets aarch64, so the asm assembledand the latent "host is aarch64" assumption stayed hidden. #1361 made
st-onboard-a2a3eligible for the new x86_64 runners; there the hostg++feeds aarch64 asm to the x86 assembler and everyhost_build_graphL2 test fails at compile time:
tensormap_and_ringbufferis unaffected: its orch cross-compiles withAARCH64_GXXand runs on the device AICPU, never through the hostg++.What
Gate the asm behind
__aarch64__and add a host-portable#else:std::chrono, scaled tothe same
PLATFORM_PROF_SYS_CNT_FREQunit the DFX markers decodeagainst (mirrors the existing
simvariant).through driver H2D DMA (cache-coherent on x86), so the AICPU-side
manual cache maintenance has no host-side referent.
aarch64 (device AICPU and ARM64-host orchestration) takes the exact
same code as before — zero behavior change on every currently-working
path. Only the x86 host build gains a compilable path.
Verification
g++(both files).#elsebody verified as portable C++ (chrono+ macro, no asm).common/platform_config.his already on the orch include path(
get_platform_include_dirs()→src/a2a3/platform/include).st-onboard-a2a3on anx86_64 runner.
Note
The separate
st-onboard-a5red (/tmp/pytest-of-simpler_a5ci is not owned by the current user) is an a5-runner environment issue (stale tmpdir), unrelated to this change.