Skip to content

Fix: anchor drain task flows in Perfetto - #1723

Closed
indigo1973 wants to merge 1 commit into
hw-native-sys:mainfrom
indigo1973:l2_0806
Closed

Fix: anchor drain task flows in Perfetto#1723
indigo1973 wants to merge 1 commit into
hw-native-sys:mainfrom
indigo1973:l2_0806

Conversation

@indigo1973

Copy link
Copy Markdown
Contributor

Give the submit -> drain -> Scheduler View/Worker View task path an explicit dependency attachment in Perfetto by routing drain-dispatched tasks through the owning scheduler's drain_prepare slice.

Keep ordinary dispatch flows unchanged and deduplicate submit-side arrows for subtasks sharing one preparation batch.

Give the submit -> drain -> Scheduler View/Worker View task path an
explicit dependency attachment in Perfetto by routing drain-dispatched
tasks through the owning scheduler's drain_prepare slice.

Keep ordinary dispatch flows unchanged and deduplicate submit-side
arrows for subtasks sharing one preparation batch.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The swimlane converter now assigns trace IDs to drain_prepare events. Completion, scheduler, and orchestrator flows use preparation-phase anchors and bindings when applicable. Non-drain tasks retain direct dispatch flows.

Changes

Drain preparation flow binding

Layer / File(s) Summary
Track drain-preparation phases
simpler_setup/tools/swimlane_converter.py
Scheduler phase events use reusable event objects with trace IDs. Helpers locate preparation phases and place endpoints inside phase slices.
Route completion and scheduler flows
simpler_setup/tools/swimlane_converter.py
Completion, worker, and Scheduler-View flows target drain_prepare events when available and otherwise use direct dispatch.
Route orchestrator flows
simpler_setup/tools/swimlane_converter.py
Orchestrator flows target unique preparation phases, bind event IDs, and use prepare-specific names.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant Completion
  participant Scheduler
  participant Worker
  participant SchedulerView
  participant Orchestrator
  Completion->>Scheduler: route to drain_prepare when present
  Scheduler->>Worker: bind preparation and destination events
  Scheduler->>SchedulerView: bind preparation and destination events
  Orchestrator->>Scheduler: submit unique preparation flow
  Scheduler-->>Orchestrator: return bound preparation completion event
Loading

Poem

A rabbit hops through lanes of light,
Trace IDs bind each phase just right.
Prepare flows where dispatch once ran,
No duplicate hops in the plan.
The scheduler’s paths now clearly gleam.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: anchoring drain task flows in Perfetto.
Description check ✅ Passed The description accurately explains the Perfetto tracing changes and flow deduplication.
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.

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

🤖 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 `@simpler_setup/tools/swimlane_converter.py`:
- Around line 2524-2526: Update the binding logic around task_to_event_id and
flow_f["bind_id"] so worker_event_id is assigned whenever it is not None,
without requiring source_event_id. Preserve the existing task/core lookup and
avoid changing source-event handling.
🪄 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: ffe720ce-19ba-43a1-be6c-04d2ad541316

📥 Commits

Reviewing files that changed from the base of the PR and between 3812f84 and c90b19a.

📒 Files selected for processing (1)
  • simpler_setup/tools/swimlane_converter.py

Comment on lines +2524 to +2526
worker_event_id = task_to_event_id.get((task["task_id"], task["core_id"]))
if source_event_id is not None and worker_event_id is not None:
flow_f["bind_id"] = worker_event_id

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Restore Worker View binding for direct dispatch flows.

Line 2525 requires source_event_id before it binds worker_event_id. Ordinary dispatch flows have no source_event_id, so they now lose the Worker View endpoint binding even when the destination event exists. Bind worker_event_id independently.

Proposed fix
-                if source_event_id is not None and worker_event_id is not None:
+                if worker_event_id is not None:
                     flow_f["bind_id"] = worker_event_id
📝 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
worker_event_id = task_to_event_id.get((task["task_id"], task["core_id"]))
if source_event_id is not None and worker_event_id is not None:
flow_f["bind_id"] = worker_event_id
worker_event_id = task_to_event_id.get((task["task_id"], task["core_id"]))
if worker_event_id is not None:
flow_f["bind_id"] = worker_event_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 `@simpler_setup/tools/swimlane_converter.py` around lines 2524 - 2526, Update
the binding logic around task_to_event_id and flow_f["bind_id"] so
worker_event_id is assigned whenever it is not None, without requiring
source_event_id. Preserve the existing task/core lookup and avoid changing
source-event handling.

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.

1 participant