Skip to content

Reduce hot-path logging footprint - #1437

Closed
vegetabledoww wants to merge 0 commit into
hw-native-sys:mainfrom
vegetabledoww:issue-1428-reduce-hot-path-logging
Closed

Reduce hot-path logging footprint#1437
vegetabledoww wants to merge 0 commit into
hw-native-sys:mainfrom
vegetabledoww:issue-1428-reduce-hot-path-logging

Conversation

@vegetabledoww

@vegetabledoww vegetabledoww commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • remove redundant success-path INFO logging from the A2A3 and A5 AICPU executors and scheduler paths
  • remove per-buffer and per-core logging from shared DFX collectors, together with logging-only bookkeeping
  • reduce normal host runtime lifecycle and copy-back logging while preserving errors, warnings, timeout/deadlock diagnostics, and V9 performance summaries

AICPU target paths no longer emit V0–V8 INFO logs.

Validation

  • editable full build: .venv/bin/pip install --no-build-isolation -e .
  • A2A3 host-build-graph matmul simulation
  • A2A3 TensorMap dummy-task simulation, including DenseFanoutFanin
  • all pre-commit hooks

Closes #1428

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 22, 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

Run ID: dab215dc-45fb-4191-bf37-20e6de54c07c

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

This change reduces informational logging across AICPU executors, host runtime builders, schedulers, PMU collectors, and profiling collectors. Core execution, buffer handling, synchronization, cleanup, and error paths remain active, with selected dispatch and accounting logic adjusted.

Changes

Runtime diagnostics reduction

Layer / File(s) Summary
Collector metrics and buffer diagnostics
src/common/platform/shared/aicpu/*collector_aicpu.cpp, src/a{2a3,5}/platform/shared/aicpu/pmu_collector_aicpu.cpp
Removes successful buffer, initialization, switch, and summary logs; args-dump counters are removed and dropped-record accounting is retained.
A2A3 host-build execution lifecycle
src/a2a3/runtime/host_build_graph/aicpu/aicpu_executor.cpp, src/a2a3/runtime/host_build_graph/host/runtime_maker.cpp
Removes executor lifecycle and host orchestration diagnostics while preserving registration, binding, copy-back, cleanup, and state-reset behavior.
A2A3 tensor runtime and scheduler paths
src/a2a3/runtime/tensormap_and_ringbuffer/{aicpu,host}/**, src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/*
Suppresses SO-loading, orchestration, tensor, scheduler, handshake, and completion logs while retaining runtime wiring and scheduler operations.
A5 host-build execution flow
src/a5/runtime/host_build_graph/aicpu/aicpu_executor.cpp, src/a5/runtime/host_build_graph/host/runtime_maker.cpp
Reduces execution diagnostics and changes selected handshake failure and dispatch ordering paths without changing public interfaces.
A5 tensor runtime and scheduler paths
src/a5/runtime/tensormap_and_ringbuffer/{aicpu,host}/**, src/a5/runtime/tensormap_and_ringbuffer/runtime/scheduler/*
Removes SO, orchestration, tensor copy-back, shutdown, handshake, and scheduler diagnostics while preserving operational paths.

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

Possibly related PRs

Poem

I’m a rabbit in a quieter run,
Where logs now hide from the morning sun.
Buffers still hop, queues still flow,
Cores still dance in rows below.
Less chatter, same bright beat—
A tidy burrow, fast and neat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 accurately summarizes the main change: reducing hot-path logging across executors and runtime paths.
Description check ✅ Passed The description is clearly related to the changeset and matches the logging reduction focus of the pull request.

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

🧹 Nitpick comments (2)
src/common/platform/shared/aicpu/l2_swimlane_collector_aicpu.cpp (1)

824-850: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the dead logging scaffolding.
Drop the unused const char *kind_label parameter and call-site argument, remove the empty if (buf != nullptr) {} branch, and invert the flush check to if (rc != 0) so the success path isn’t empty.

🤖 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/common/platform/shared/aicpu/l2_swimlane_collector_aicpu.cpp` around
lines 824 - 850, Remove the unused kind_label parameter from acquire_phase_slot
and all of its call sites, delete the empty if (buf != nullptr) branch after
pop_free, and update the flush result check to use if (rc != 0), leaving the
success path without an empty branch.
src/a2a3/runtime/host_build_graph/host/runtime_maker.cpp (1)

998-1002: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove empty branches left by log deletion.

The removed success logs leave an empty else block and an empty if (kernel_count > 0) block. Delete both; the surrounding error handling and unconditional cleanup call already provide the required behavior.

Proposed cleanup
             if (copy_rc != 0) {
                 LOG_ERROR("Failed to copy tensor %d from device: %d", i, copy_rc);
                 rc = copy_rc;
-            } else {
             }
 
@@
-    if (kernel_count > 0) {}
     runtime->clear_registered_kernels();

Also applies to: 1022-1028

🤖 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/a2a3/runtime/host_build_graph/host/runtime_maker.cpp` around lines 998 -
1002, Remove the empty else branch following the copy_rc error handling, and
remove the empty if (kernel_count > 0) block in the same runtime graph-building
flow. Preserve the existing error handling and keep the cleanup call
unconditional.
🤖 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/aicpu/aicpu_executor.cpp`:
- Line 1015: Update run() to capture the return value from
resolve_and_dispatch(), then preserve required buffer flushing and AICore
shutdown before returning that result. Ensure finished_count_ is not incremented
and finished_ is not published when resolve_and_dispatch() reports failure;
successful execution should retain the existing completion behavior.

---

Nitpick comments:
In `@src/a2a3/runtime/host_build_graph/host/runtime_maker.cpp`:
- Around line 998-1002: Remove the empty else branch following the copy_rc error
handling, and remove the empty if (kernel_count > 0) block in the same runtime
graph-building flow. Preserve the existing error handling and keep the cleanup
call unconditional.

In `@src/common/platform/shared/aicpu/l2_swimlane_collector_aicpu.cpp`:
- Around line 824-850: Remove the unused kind_label parameter from
acquire_phase_slot and all of its call sites, delete the empty if (buf !=
nullptr) branch after pop_free, and update the flush result check to use if (rc
!= 0), leaving the success path without an empty branch.
🪄 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: ae8edc52-c723-4975-b4c3-9681b355738b

📥 Commits

Reviewing files that changed from the base of the PR and between 56919a7 and 0e808c3.

📒 Files selected for processing (20)
  • src/a2a3/platform/shared/aicpu/pmu_collector_aicpu.cpp
  • src/a2a3/runtime/host_build_graph/aicpu/aicpu_executor.cpp
  • src/a2a3/runtime/host_build_graph/host/runtime_maker.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/aicpu/aicpu_executor.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/host/runtime_maker.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_cold_path.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_completion.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_dispatch.cpp
  • src/a5/platform/shared/aicpu/pmu_collector_aicpu.cpp
  • src/a5/runtime/host_build_graph/aicpu/aicpu_executor.cpp
  • src/a5/runtime/host_build_graph/host/runtime_maker.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/aicpu/aicpu_executor.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/host/runtime_maker.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_cold_path.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_completion.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_dispatch.cpp
  • src/common/platform/shared/aicpu/args_dump_aicpu.cpp
  • src/common/platform/shared/aicpu/dep_gen_collector_aicpu.cpp
  • src/common/platform/shared/aicpu/l2_swimlane_collector_aicpu.cpp
  • src/common/platform/shared/aicpu/scope_stats_collector_aicpu.cpp
💤 Files with no reviewable changes (13)
  • src/a5/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_dispatch.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_dispatch.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_completion.cpp
  • src/common/platform/shared/aicpu/dep_gen_collector_aicpu.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_completion.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_cold_path.cpp
  • src/a2a3/runtime/host_build_graph/aicpu/aicpu_executor.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/host/runtime_maker.cpp
  • src/a5/runtime/host_build_graph/host/runtime_maker.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/host/runtime_maker.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_cold_path.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/aicpu/aicpu_executor.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/aicpu/aicpu_executor.cpp

LOG_INFO_V0("Thread %d: Runtime has %d tasks", thread_idx, runtime->get_task_count());
int completed = resolve_and_dispatch(*runtime, thread_idx, cur_thread_cores, thread_cores_num_[thread_idx]);
LOG_INFO_V0("Thread %d: Executed %d tasks from runtime", thread_idx, completed);
resolve_and_dispatch(*runtime, thread_idx, cur_thread_cores, thread_cores_num_[thread_idx]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Propagate resolve_and_dispatch() failures.

resolve_and_dispatch() returns -1 on timeout/stuck-state paths, but run() discards the result and continues to mark the executor finished before returning 0. This masks failed execution as success.

Capture the return value and propagate it after required buffer flushing and AICore shutdown, before incrementing finished_count_ or publishing finished_.

Proposed fix
-    resolve_and_dispatch(*runtime, thread_idx, cur_thread_cores, thread_cores_num_[thread_idx]);
+    int dispatch_rc = resolve_and_dispatch(*runtime, thread_idx, cur_thread_cores, thread_cores_num_[thread_idx]);

     // ... flush profiling buffers ...

     int rc = shutdown_aicore(runtime, thread_idx, cur_thread_cores);
     if (rc != 0) {
         return rc;
     }
+    if (dispatch_rc < 0) {
+        return dispatch_rc;
+    }
📝 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.

Suggested change
resolve_and_dispatch(*runtime, thread_idx, cur_thread_cores, thread_cores_num_[thread_idx]);
int dispatch_rc = resolve_and_dispatch(*runtime, thread_idx, cur_thread_cores, thread_cores_num_[thread_idx]);
// ... flush profiling buffers ...
int rc = shutdown_aicore(runtime, thread_idx, cur_thread_cores);
if (rc != 0) {
return rc;
}
if (dispatch_rc < 0) {
return dispatch_rc;
}
🤖 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/aicpu/aicpu_executor.cpp` at line 1015,
Update run() to capture the return value from resolve_and_dispatch(), then
preserve required buffer flushing and AICore shutdown before returning that
result. Ensure finished_count_ is not incremented and finished_ is not published
when resolve_and_dispatch() reports failure; successful execution should retain
the existing completion behavior.

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.

[Code Health] Reduce redundant/hot-path logging footprint (a2a3 + a5)

2 participants