a5 host_build_graph: converge scheduler_dispatch + runtime_maker with a2a3 - #1789
Conversation
… a2a3 scheduler_dispatch.cpp's first dispatch loop now calls handle_orchestrator_exit() at the loop top (it inlined an error-only check) and uses a plain fetch_add + continue for completion accounting (the helper detects completion next iteration) instead of the inline new_total check. Behavior-preserving; the file is byte-identical to a2a3. runtime_maker.cpp aligns relocate_host_orch_image and the host-orch path with a2a3: relocate-lambda naming, single-pass ring iteration (PTO2_MAX_RING_DEPTH == 1, so the depth loop was a no-op), entry_points/ bind structure, LOG strings, and drops the unused rt parameter. a5's richer inline comments and the A5-only simpler_aicpu_query_topology export are retained. Verified: builds clean; a5sim golden set passes (graph_execution x3, paged_attention). Co-Authored-By: Claude <noreply@anthropic.com>
📝 WalkthroughWalkthroughHost orchestration now supports direct single-ring relocation and explicit runtime binding. Scheduler resolution delegates orchestrator exits, continues draining after completion updates, and uses a cached task total for stall detection. ChangesHost orchestration and scheduler lifecycle
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant HostOrchestration
participant framework_bind_runtime
participant OrchestrationEntry
HostOrchestration->>framework_bind_runtime: resolve binding entry point
HostOrchestration->>framework_bind_runtime: bind orchestration runtime
HostOrchestration->>OrchestrationEntry: invoke orchestration entry
OrchestrationEntry-->>HostOrchestration: return submitted task count
Possibly related issues
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 |
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/a5/runtime/host_build_graph/host/runtime_maker.cpp`:
- Around line 381-383: Update the relocation contract comment near relocate() to
state that null pointers pass through unchanged, while non-null pointers outside
both recognized regions cause relocation to fail; remove the claim that foreign
pointers pass through untouched.
🪄 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: 5015712b-471f-4b65-97f7-6a2343ffd585
📒 Files selected for processing (2)
src/a5/runtime/host_build_graph/host/runtime_maker.cppsrc/a5/runtime/host_build_graph/runtime/scheduler/scheduler_dispatch.cpp
| // Rather than track which delta each field needs, relocate() classifies every | ||
| // pointer by the region it points INTO and applies that region's delta; foreign | ||
| // and null pointers pass through untouched. The fanout adjacency is wired inline |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the relocation contract comment.
Lines 381-383 state that foreign pointers pass through unchanged. Lines 420-427 reject a non-null pointer outside both windows and make relocation fail. State that null pointers pass through unchanged and external pointers cause failure.
Proposed fix
-// pointer by the region it points INTO and applies that region's delta; foreign
-// and null pointers pass through untouched. The fanout adjacency is wired inline
+// pointer by the region it points INTO and applies that region's delta. Null
+// pointers pass through unchanged. External pointers cause relocation failure.
+// The fanout adjacency is wired inline📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Rather than track which delta each field needs, relocate() classifies every | |
| // pointer by the region it points INTO and applies that region's delta; foreign | |
| // and null pointers pass through untouched. The fanout adjacency is wired inline | |
| // Rather than track which delta each field needs, relocate() classifies every | |
| // pointer by the region it points INTO and applies that region's delta. Null | |
| // pointers pass through unchanged. External pointers cause relocation failure. | |
| // The fanout adjacency is wired inline |
🤖 Prompt for 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.
In `@src/a5/runtime/host_build_graph/host/runtime_maker.cpp` around lines 381 -
383, Update the relocation contract comment near relocate() to state that null
pointers pass through unchanged, while non-null pointers outside both recognized
regions cause relocation to fail; remove the claim that foreign pointers pass
through untouched.
Summary
Converges the two remaining a5↔a2a3
host_build_graphcode forks (the last real logic-divergent files after #1759 made the orchestrator core identical; PMU + SDMA cache are excluded as known arch items).Changes
runtime/scheduler/scheduler_dispatch.cpp— now byte-identical to a2a3. The first dispatch loop:handle_orchestrator_exit()at the loop top instead of an inlined error-only check (the helper also does completion detection + the orch/sched error shutdown — a5 already had and used it at a second site);completed_tasks_.fetch_add(resolved_this_pass)+continuefor completion accounting instead of the inlinenew_total >= total_tasks_check (the helper detects completion on the next iteration).host/runtime_maker.cpp—relocate_host_orch_imageand the host-orchestration path aligned to a2a3: relocate-lambda naming, single-pass ring iteration (PTO2_MAX_RING_DEPTH == 1, so thefor rloop was a no-op),entry_points/bindstructure, LOG strings, and drops the unusedrtparameter.Retained: a5's richer inline comments and the A5-only
simpler_aicpu_query_topologyexport (real arch difference — A5 needs the topology query before the first launch; a2a3 does not).Residual a5↔a2a3 HBG diff after this
Header-guard style (
#pragma oncevs#ifndef), arch constants (RUNTIME_MAX_WORKER72↔108, platform string), comment drift, the topology symbol, and the (separately tracked) PMU record API + SDMA cache-invalidation.Verification
clang-tidy/cpplint/clang-formatgreen; incremental rebuild succeeds.graph_execution(×3) +paged_attention.🤖 Generated with Claude Code