Perf(l2-swimlane): drop per-task wmb in AICPU complete_task#1301
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:
📝 WalkthroughWalkthroughThis PR removes the per-record ChangesBarrier Removal and Rationale
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.
Code Review
This pull request removes the per-task 'wmb()' write memory barrier from the commit fast path in 'l2_swimlane_aicpu_complete_task' to improve uniformity across the collector paths, as the barrier is already handled during publication in 'enqueue_ready()'. The documentation in 'docs/investigations/2026-06-l2-swimlane-defer-wmb.md' has been updated to reflect this decision and its correctness. There are no review comments, so no feedback is provided.
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.
`l2_swimlane_aicpu_complete_task` was the only record-writer on the AICPU collector still issuing a per-record `wmb()` (ARM64 `dsb st`). The host never reads an AicpuTask buffer until it is published to the per-thread ready queue, and `L2SwimlaneTaskEngine::enqueue_ready` already issues the store barrier that drains the record + count stores before the tail advance the host polls. The phase-record and aicore_rotate paths already defer their barrier to publication; this makes the task-record path uniform with them. Verified onboard a2a3 (l2_swimlane DFX suite at level 2, where complete_task runs): 2 passed. Benefit is below the hardware noise floor; kept for uniformity, not measured speed. See docs/investigations/2026-06-l2-swimlane-defer-wmb.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
99c4675 to
b72308b
Compare
What
l2_swimlane_aicpu_complete_taskissued onewmb()(ARM64dsb st) perAICPU task record, right after
l2_swimlane_buf->count = new_count. Thisremoves it — it is the only record-writer on the AICPU collector still doing a
per-record barrier.
Why it's safe
The host never reads an
AicpuTaskbuffer until the AICPU publishes it tothe per-thread ready queue. Both publication paths — rotation
(
switch_records_buffer) and end-of-run flush (l2_swimlane_aicpu_flush) —funnel through
L2SwimlaneTaskEngine::enqueue_ready(
profiler_device_engine.h), which already issueswmb()(dsb st) beforethe ready-queue tail advance. That barrier drains the record +
countstoresof every buffer before the tail the host polls (with
rmb()). The AICore neverreads the
AicpuTaskbuffer (it owns a separate pool), so there is noconcurrent observer between
complete_taskreturning and publication.The phase-record and
aicore_rotatepaths already defer their barrierto publication — this makes the task-record path uniform with them
(
complete_taskwas the outlier).Why now (and the honest caveat on benefit)
The benefit is below the hardware noise floor — this is a uniformity
cleanup, not a measured speedup. Back-of-envelope ≈ 30 ns × N-records, swamped
by per-iteration variance; the AICPU
dsb stis the cheaper of swimlane's twoper-record barriers (the load-bearing one is the AICore-side per-record
write-back, which is not removable — AICore cache is non-coherent with the
consumer).
This exact change was investigated in 2026-06 and dropped as "no win above
noise". It is re-landed here for uniformity;
docs/investigations/2026-06-l2-swimlane-defer-wmb.mdis updated in this PR (verdict → landed) with the full rationale, per the
repo's investigation-tracking rule. Note the code was since unified into
src/common/...(#1262) so, unlike the 2026-06 3-hunk patch, only the removalis needed — the publication barrier already lives in
enqueue_ready.Validation
task-submit, device 4):tests/st/a2a3/tensormap_and_ringbuffer/dfx/l2_swimlaneat
@scene_test(level=2)— the level wherecomplete_taskruns and writesthe AICPU task record. 2 passed. The DFX suite validates record-count
reconciliation (no silent loss), which is exactly what a missing barrier would
break.
investigation.
Risk note
A sibling barrier change (hoisting
wmbacross distinct tasks in one pop) oncecaused a
spmd_sync_start_stress507018 drain-barrier hang (seedocs/investigations/2026-06-cross-task-batched-publish.md). This change isnarrower — a single per-record barrier whose only observer publishes through its
own barrier — and was validated onboard as above.
🤖 Generated with Claude Code