Skip to content

Fix: render drain/drain_prepare/drain_publish swimlane phases#1358

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:fix/swimlane-converter-render-drain-phases
Jul 14, 2026
Merged

Fix: render drain/drain_prepare/drain_publish swimlane phases#1358
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:fix/swimlane-converter-render-drain-phases

Conversation

@ChaoWao

@ChaoWao ChaoWao commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

#1304 added the sync_start stop-the-world drain phase kinds — Drain,
DrainPrepare, DrainPublish — to both the device emit
(l2_swimlane_profiling.h) and the host serializer
(l2_swimlane_collector.cpp, which maps them to "drain" /
"drain_prepare" / "drain_publish"), but never taught the Python
renderer about them.

swimlane_converter.py drops any phase outside its sched-lane whitelist.
A sync_start SPMD cohort launches through handle_drain_mode
drain_stage_cores, so its actual launch is emitted as drain_publish,
not dispatch. Result: the drain records were produced on-device and
written to l2_swimlane_records.json, but silently filtered out at
render time — the scheduler dispatch work for every sync_start cohort
vanished from the Perfetto trace.

This wires the three phases into the renderer:

  • Add drain / drain_prepare / drain_publish to phase_colors
    (cq_build color family; the outer drain bar time-contains the two
    inner staging passes, so Perfetto nests them by depth on the track).
  • Add the three phases to the sched-lane render whitelist.

Testing

Verified on a2a3 silicon at l2_swimlane_level=4 — for each workload the
rendered scheduler-lane phase histogram now matches the raw record kinds:

workload drain drain_prepare drain_publish
spmd_sync_start 3 2 2
spmd_sync_start_early_dispatch 3 3 3
spmd_sync_start_stress 36 24 24

qwen3_14b_decode (no sync_start) is unaffected — dispatch/complete
render as before.

  • Hardware tests pass (a2a3, level-4 swimlane, four workloads)
  • Simulation tests (renderer-only Python change; not arch-specific)

hw-native-sys#1304 added the sync_start stop-the-world drain phase kinds (Drain,
DrainPrepare, DrainPublish) to the device and host emit sides
(l2_swimlane_profiling.h + host l2_swimlane_collector.cpp) but never
taught the Python renderer about them. swimlane_converter.py drops any
phase outside its sched-lane whitelist, so a sync_start cohort's launch
— emitted as drain_publish, not dispatch — was silently filtered out and
the scheduler dispatch work for sync_start SPMD cohorts vanished from the
trace.

- Add drain/drain_prepare/drain_publish to phase_colors (cq_build family;
  the outer drain bar time-contains the two inner staging passes so
  Perfetto nests them by depth)
- Add the three phases to the sched-lane render whitelist

Verified on a2a3 silicon at l2_swimlane_level=4: spmd_sync_start,
spmd_sync_start_early_dispatch, and spmd_sync_start_stress now render the
drain phases (rendered phase histogram matches the raw record kinds).
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ca9862ae-a82b-4d6a-8df4-eb23dacc3ed4

📥 Commits

Reviewing files that changed from the base of the PR and between cb75bec and c3ed783.

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

📝 Walkthrough

Walkthrough

Scheduler phase visualization now recognizes drain, drain_prepare, and drain_publish, assigning each a Perfetto color and allowing them through trace rendering.

Changes

Scheduler drain phases

Layer / File(s) Summary
Recognize and color drain phases
simpler_setup/tools/swimlane_converter.py
Adds colors for the three drain phases and includes them in the Scheduler’s allowed-phase filter.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Poem

I’m a rabbit with traces hopping bright,
Drain phases now bloom in colored light.
Prepare and publish join the run,
No unknown phase is skipped or shunned.
Three little names make swimlanes fun!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: rendering the new drain-related swimlane phases.
Description check ✅ Passed The description is directly related to the code change and accurately explains the renderer updates and motivation.
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.

@ChaoWao ChaoWao merged commit eda7258 into hw-native-sys:main Jul 14, 2026
16 checks passed
@ChaoWao ChaoWao deleted the fix/swimlane-converter-render-drain-phases branch July 14, 2026 07:00
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