Repository navigation
host_build_graph: route boot failure through common teardown; fix Level-1 docs - #1518
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 Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe runtime boot path now handles attachment failures through shared teardown and publishes initialization readiness in all boot outcomes. Profiling documentation now describes scheduler-only Level 1 execution and updates its log examples and counts. ChangesHost build graph boot and profiling
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant BootThread
participant RuntimeAttachment
participant WaitingThreads
participant SchedulerContext
BootThread->>RuntimeAttachment: Check prebuilt_arena and attach_populated
RuntimeAttachment-->>BootThread: Runtime or boot failure
BootThread->>WaitingThreads: Publish runtime_init_ready_
BootThread->>SchedulerContext: shutdown(thread_idx)
BootThread->>BootThread: Increment finished_count_
Possibly related PRs
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 |
cf9ec66 to
a643c85
Compare
…el-1 docs Since hw-native-sys#1452 the boot thread (aicpu_thread_num_ - 1) owns a non-empty core slice — handshake_partition assigns it [lo, total) during init(). The two boot-failure branches in run() (prebuilt_arena null, sm_handle attach failure) still returned -1 directly, skipping the common teardown that every other thread reaches: - shutdown(thread_idx): the boot thread's AICore cores never get their exit signal, so they spin forever on an unclosed register window. - finished_count_: the counter tops out at aicpu_thread_num_ - 1, so finished_ never publishes and runtime_destroy never runs — the host hangs into the op-execute timeout (507018), masking the real boot error. Record the failure in run_rc, leave rt null (the dispatch block already skips on rt == nullptr), publish runtime_init_ready_ at a single point so peers stop spinning, and fall through to the common teardown. Behavior on success is unchanged; the task-count latch still precedes the init-ready release. profiling_levels.md: the Level-1 section still described an on-device orchestrator (orch_start/orch_end/orch_cost lines, "PTO2 total submitted tasks" printed by the last orch thread, the N_orch count term, and a device-orch example capture). host_build_graph boots scheduler-only, so those lines never appear on device. Rewrite the section scheduler-only (count is N_sched*2, N_sched == aicpu_thread_num) with a 4-thread example, and correct the summary-table Level-1 count from 7 to 8. Fixes hw-native-sys#1515.
Summary
Follow-up on unaddressed review feedback from #1452. Fixes the three findings tracked in #1515 — one correctness bug and two stale-doc drifts.
1. (Bug, Major) Boot-thread failure bypasses AICore teardown and the finished-barrier
aicpu_executor.cpp— both boot-failure branches inrun()returned-1directly. Since #1452 made every AICPU thread schedule, the boot thread (thread_idx == aicpu_thread_num_ - 1) now owns a non-empty core slice (handshake_partitionassigns it[lo, total)ininit()), so an early return skips the common teardown:shutdown(thread_idx)— the boot thread's AICore cores never get their exit signal and spin forever on an unclosed register window.finished_count_— tops out ataicpu_thread_num_ - 1, sofinished_never publishes andruntime_destroynever runs; the host hangs into the op-execute timeout (507018), masking the real error.Fix: record the failure in
run_rc, leavertnull (the dispatch block already skips onrt == nullptr), publishruntime_init_ready_once so peers stop spinning, and fall through to the common teardown. Success-path behavior and the task-count-latch-before-release ordering are unchanged.2 & 3. (Docs)
profiling_levels.mdLevel-1 describes an on-device orchestratorhost_build_graph boots scheduler-only (orchestrator runs on the host), so the device log has no
orch_*lines and no "PTO2 total submitted tasks" line. The Level-1 section still listed them, used the count formulaN_sched*2 + N_orch*1 + 1, and showed a device-orch example capture; the summary table listed Level-1 = 7.Fix: rewrite the section scheduler-only (
N_sched*2,N_sched == aicpu_thread_num) with a 4-thread example, and correct the summary-table count 7 → 8.Testing
aicpu_executor.cppcompiles andlibaicpu_kernel.solinks cleanly.markdownlint-cli2passes onprofiling_levels.md.run().Fixes #1515.
🤖 Generated with Claude Code