Skip to content

Update: improve L2 swimlane SPMD flow anchors#1300

Open
indigo1973 wants to merge 1 commit into
hw-native-sys:mainfrom
indigo1973:spmd_0707
Open

Update: improve L2 swimlane SPMD flow anchors#1300
indigo1973 wants to merge 1 commit into
hw-native-sys:mainfrom
indigo1973:spmd_0707

Conversation

@indigo1973

Copy link
Copy Markdown
Contributor
  • Collapse SPMD dependency anchors by func_id and task_id using the earliest-start subtask so MIX AIC/AIV tasks stay distinct.
  • Fold AIC/AIV setup preview into the Worker View task bar while keeping kernel and setup durations in hover args.
  • Render resolve on a sibling scheduler lane and anchor complete flows on the same representative SPMD task slices as dependency flows.
  • Update the L2 swimlane documentation to describe the new lane and anchor semantics.

@coderabbitai

coderabbitai Bot commented Jul 8, 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: 517e25f4-7d18-4c42-b881-f4e1194c83b7

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 PR updates the Perfetto swimlane converter's Worker View task bar timing to start at receive_time_us (removing separate setup bars), introduces lane-aware scheduler tids via sched_lane_tid for resolve-phase rendering, and reworks SPMD/complete dependency-arrow anchoring to collapse by func_id with earliest-start selection. Documentation is updated to match.

Changes

Swimlane profiling rendering and anchoring changes

Layer / File(s) Summary
Worker View task bar timing and args
simpler_setup/tools/swimlane_converter.py, docs/dfx/l2-swimlane-profiling.md
Base-time tracking now accounts for v3 receive_time offsets; Worker View task bars start at receive_time_us/end at end_time_us, removing separate setup X events; adds kernel-duration-us/local_setup_us to args; docs updated to match.
Scheduler sub-lane tid helper and wiring
simpler_setup/tools/swimlane_converter.py, docs/dfx/l2-swimlane-profiling.md
New sched_lane_tid(thread_idx, lane) helper routes resolve-phase events and conditional thread-name metadata onto a sibling sub-lane instead of nesting; docs describe resolve as a sibling lane rather than a nested inner phase.
SPMD dependency anchor rows by func_id
simpler_setup/tools/swimlane_converter.py, docs/dfx/l2-swimlane-profiling.md
_dependency_flow_anchor_rows now collapses subtask rows by func_id, keeping the earliest-start row per func_id (tie-broken by core_id) instead of min-core_id per core_type; docs updated for the new anchoring rule.
Complete-phase and outbound flow arrow anchoring
simpler_setup/tools/swimlane_converter.py
Inbound "complete" arrows now anchor on Worker View anchor-subtask slices with optional bind_id; outbound complete→ready, dispatch, and orchestrator arrows now use sched_lane_tid(..., 0) instead of fixed 3000 + thread tids.

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

Possibly related PRs

  • hw-native-sys/simpler#1204: Both PRs modify _dependency_flow_anchor_rows and related dependency-arrow event construction with matching documentation updates.
  • hw-native-sys/simpler#1000: Both PRs modify the "complete-phase flow arrows" generation and anchoring logic in swimlane_converter.py.
  • hw-native-sys/simpler#1108: Both PRs modify generate_chrome_trace_json's lane routing for scheduler phases and tid/lane placement.

Poem

A rabbit hops through timing lanes,
Where receive_time now holds the reins.
No more setup bars in sight,
func_id anchors, earliest, right.
Sibling lanes for resolve to dwell—
This burrow's swimlanes render well! 🐇⏱️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: improving L2 swimlane SPMD flow anchors.
Description check ✅ Passed The description directly summarizes the swimlane anchor, lane, and documentation updates.
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.

@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
simpler_setup/tools/swimlane_converter.py (2)

1297-1298: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update stale SPMD anchoring comments and verbose message.

The _dependency_flow_anchor_rows function now collapses by func_id with earliest-start selection, but two comments still describe the old "min core_id per core_type" approach:

  • Line 1297–1298: # SPMD logical tasks anchor dependency arrows on the min-core_id subtask / # row per core_type (AIC and AIV separately when both are present).
  • Line 1355: "dependency arrows anchor on min core_id subtask per core_type"

These contradict the new implementation and the updated documentation in l2-swimlane-profiling.md (lines 475–482, 526–527).

📝 Proposed fix
     # SPMD logical tasks anchor dependency arrows on the earliest-start
-    # subtask row per core_type (AIC and AIV separately when both are present).
+    # subtask row per (func_id, task_id) group, so MIX tasks with shared
+    # task_id but distinct AIC/AIV func_id values remain distinct.
     flow_id = 0
                 print(
                     f"  SPMD tasks: {len(spmd_task_ids)} logical task(s); "
-                    "dependency arrows anchor on min core_id subtask per core_type"
+                    "dependency arrows anchor on earliest-start subtask per (func_id, task_id)"
                 )

Also applies to: 1355-1355

🤖 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 1297 - 1298, Update
the stale SPMD anchoring comments and the verbose message in
_dependency_flow_anchor_rows to match the current func_id-based earliest-start
behavior, replacing the old “min-core_id per core_type” wording in the nearby
comment block and the dependency-arrow anchor message so they no longer describe
the outdated AIC/AIV-specific logic.

1390-1390: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update stale resolve phase comment.

Line 1390 still says # Inner phase — nests inside Complete or Dummy via time containment, but resolve is now rendered on a sibling scheduler sub-lane (lane 1 via sched_lane_tid(thread_idx, 1)), not nested via time containment. This contradicts the updated documentation at l2-swimlane-profiling.md lines 235–245 which states resolve is rendered on a sibling Sched_N tid.

📝 Proposed fix
-            # Inner phase — nests inside Complete or Dummy via time containment
+            # Inner phase — rendered on a sibling Sched_N sub-lane (adjacent tid)
             "resolve": "vsync_highlight_color",  # on_task_complete: walk consumer list
🤖 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` at line 1390, The comment in
swimlane_converter.py is stale and still describes resolve as an “Inner phase”
nested by time containment, but the current logic renders resolve on a sibling
scheduler sub-lane. Update the comment near the resolve-related code in the
swimlane conversion flow to match the actual behavior and terminology used by
sched_lane_tid(thread_idx, 1) and the sibling Sched_N lane documented in
l2-swimlane-profiling.md; keep the wording aligned with the resolved lane layout
rather than nesting semantics.
🧹 Nitpick comments (1)
simpler_setup/tools/swimlane_converter.py (1)

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

Consider consolidating the duplicate flow epsilon constants.

flow_epsilon (line 1303) and FLOW_EPSILON_US (line 1927) are both 0.01 but defined separately. Consolidating into a single module-level constant would prevent silent divergence if one is changed without the other.

Also applies to: 1303-1303

🤖 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` at line 1927, Duplicate flow
epsilon values are defined separately as flow_epsilon and FLOW_EPSILON_US;
consolidate them into a single module-level constant in swimlane_converter.py.
Update the code near the existing flow_epsilon definition and the
FLOW_EPSILON_US usage so both paths reference the same symbol, keeping one
source of truth for the epsilon value. Ensure any downstream references in the
related flow-conversion logic continue to use the shared constant.
🤖 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 `@simpler_setup/tools/swimlane_converter.py`:
- Around line 1297-1298: Update the stale SPMD anchoring comments and the
verbose message in _dependency_flow_anchor_rows to match the current
func_id-based earliest-start behavior, replacing the old “min-core_id per
core_type” wording in the nearby comment block and the dependency-arrow anchor
message so they no longer describe the outdated AIC/AIV-specific logic.
- Line 1390: The comment in swimlane_converter.py is stale and still describes
resolve as an “Inner phase” nested by time containment, but the current logic
renders resolve on a sibling scheduler sub-lane. Update the comment near the
resolve-related code in the swimlane conversion flow to match the actual
behavior and terminology used by sched_lane_tid(thread_idx, 1) and the sibling
Sched_N lane documented in l2-swimlane-profiling.md; keep the wording aligned
with the resolved lane layout rather than nesting semantics.

---

Nitpick comments:
In `@simpler_setup/tools/swimlane_converter.py`:
- Line 1927: Duplicate flow epsilon values are defined separately as
flow_epsilon and FLOW_EPSILON_US; consolidate them into a single module-level
constant in swimlane_converter.py. Update the code near the existing
flow_epsilon definition and the FLOW_EPSILON_US usage so both paths reference
the same symbol, keeping one source of truth for the epsilon value. Ensure any
downstream references in the related flow-conversion logic continue to use the
shared constant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f6450c5-5586-486e-996d-6d3c6280f47b

📥 Commits

Reviewing files that changed from the base of the PR and between bd1025f and f8fbcc1.

📒 Files selected for processing (2)
  • docs/dfx/l2-swimlane-profiling.md
  • simpler_setup/tools/swimlane_converter.py

- Collapse SPMD dependency anchors by func_id and task_id using the earliest-start subtask so MIX AIC/AIV tasks stay distinct.
- Fold AIC/AIV setup preview into the Worker View task bar while keeping kernel and setup durations in hover args.
- Render resolve on a sibling scheduler lane and anchor complete flows on the same representative SPMD task slices as dependency flows.
- Update the L2 swimlane documentation to describe the new lane and anchor semantics.
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