Fix: split A5 L2 record reserve and commit - #1603
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:
📝 WalkthroughWalkthroughAICore execution now conditionally captures L2 swimlane timing, reserves task records before ACK publication, and commits them after completion. A no-hardware unit test and CTest target validate reserved buffer generation behavior. ChangesAICore L2 swimlane recording
Estimated code review effort: 3 (Moderate) | ~20 minutes 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/a5/runtime/tensormap_and_ringbuffer/aicore/aicore_executor.cpp (1)
235-250: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winCommit the reserved L2 record before publishing FIN.
MAKE_FIN_VALUE(task_id)makes completion visible beforel2_swimlane_aicore_commit_task_recordwrites the record. The completion consumer can therefore observe an uncommitted/partial L2 entry. Commit after execution but before FIN.Proposed ordering fix
- last_reg_val = reg_val; - write_reg(RegId::COND, MAKE_FIN_VALUE(task_id)); - - if (dump_args_enabled) { - pipe_barrier(PIPE_ALL); - } - - if (l2_swimlane_enabled) { + if (l2_swimlane_enabled) { uint64_t task_token_raw = exec_payload->local_context.async_ctx.task_token.raw; l2_swimlane_aicore_commit_task_record( l2_swimlane_record, task_token_raw, task_id, receive_time, start_time, end_time ); } + + last_reg_val = reg_val; + write_reg(RegId::COND, MAKE_FIN_VALUE(task_id));🤖 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/tensormap_and_ringbuffer/aicore/aicore_executor.cpp` around lines 235 - 250, Move the l2_swimlane_aicore_commit_task_record call in the execution path before write_reg(RegId::COND, MAKE_FIN_VALUE(task_id)) publishes FIN. Keep the existing profiling guard and record arguments unchanged, ensuring the reserved L2 record is fully committed before completion becomes visible.
🤖 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.
Outside diff comments:
In `@src/a5/runtime/tensormap_and_ringbuffer/aicore/aicore_executor.cpp`:
- Around line 235-250: Move the l2_swimlane_aicore_commit_task_record call in
the execution path before write_reg(RegId::COND, MAKE_FIN_VALUE(task_id))
publishes FIN. Keep the existing profiling guard and record arguments unchanged,
ensuring the reserved L2 record is fully committed before completion becomes
visible.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 702151c7-aac7-43c8-9bef-0535e7b6d8c9
📒 Files selected for processing (3)
src/a5/runtime/tensormap_and_ringbuffer/aicore/aicore_executor.cpptests/ut/cpp/CMakeLists.txttests/ut/cpp/common/test_l2_swimlane_aicore.cpp
219bb78 to
7e5276b
Compare
|
@coderabbitai Reviewed the FIN/commit ordering against the shared AICore buffer protocol. Keeping the existing ordering intentionally: FIN does not publish the L2 buffer to the host. AICPU defers the old generation behind |
|
Tip For best results, initiate chat on the files or code changes.
I’m withdrawing the ordering concern. 🐇 ✏️ Learnings added
You are interacting with an AI system. |
Summary
Related to #1582 (missing item #5).
Correctness
The reserved L2 record remains bound to the buffer generation that was active before ACK. PMU data is still published before FIN for AICPU consumption, while the L2 record is committed after FIN using the reserved pointer.
Validation
Performance (
--enable-l2-swimlane 4)Same main commit (
ce81c973), device 4, serial execution. Each variant used 10 independent processes with--rounds 1 --enable-l2-swimlane 4, because the scene-test runner disables L2 swimlane when--roundsis greater than 1. All 40 valid case runs per variant passed.Deviceis the complete on-NPU AICPUrun_prepared.runner_run.device_wallspan emitted by[STRACE]; it excludes Python startup and host-side swimlane export/validation. Values below are arithmetic means over the 10 independent runs:A negative delta means the PR is faster. For example, paged-attention Case1 is
(2457.97 - 2467.15) / 2467.15 = -0.37%.No level-4 performance regression observed; three cases are effectively flat and manual-scope Case1 improves by about 2.2%-2.4%.