Skip to content

Add XPU synchronization events to XPUPTI profiler#1395

Open
tsocha wants to merge 2 commits into
pytorch:mainfrom
intel-staging:dev/tsocha/oneccl-2
Open

Add XPU synchronization events to XPUPTI profiler#1395
tsocha wants to merge 2 commits into
pytorch:mainfrom
intel-staging:dev/tsocha/oneccl-2

Conversation

@tsocha
Copy link
Copy Markdown

@tsocha tsocha commented May 11, 2026

It's a part of #1335 2/3

Introduce a new ActivityType::XPU_SYNC that surfaces device synchronization records from PTI_VIEW_DEVICE_SYNCHRONIZATION in the XPUPTI plugin.

  • Register XPU_SYNC in ActivityType (value 27) and update ENUM_COUNT / name table.
  • Enable/disable PTI_VIEW_DEVICE_SYNCHRONIZATION alongside the other XPUPTI activity kinds.
  • Add handleSynchronizationActivity, including a synchronization-type -> string map, GPU vs. host barrier accounting, and metadata (context/queue/event handles, wait-event count, return code).
  • Generalize getApiName into a template so it works for both API and synchronization records; move it to the header.
  • Route PTI_VIEW_DEVICE_SYNCHRONIZATION in handlePtiActivity.
  • Cover the new handler with unit tests in XpuptiActivityHandlersTest.cpp.

Introduce a new ActivityType::XPU_SYNC that surfaces device
synchronization records from PTI_VIEW_DEVICE_SYNCHRONIZATION
in the XPUPTI plugin.

- Register XPU_SYNC in ActivityType (value 27) and update
  ENUM_COUNT / name table.
- Enable/disable PTI_VIEW_DEVICE_SYNCHRONIZATION alongside the
  other XPUPTI activity kinds.
- Add handleSynchronizationActivity, including a
  synchronization-type -> string map, GPU vs. host barrier
  accounting, and metadata (context/queue/event handles,
  wait-event count, return code).
- Generalize getApiName into a template so it works for both
  API and synchronization records; move it to the header.
- Route PTI_VIEW_DEVICE_SYNCHRONIZATION in handlePtiActivity.
- Cover the new handler with unit tests in
  XpuptiActivityHandlersTest.cpp.
@meta-cla meta-cla Bot added the cla signed label May 11, 2026
@tsocha
Copy link
Copy Markdown
Author

tsocha commented May 11, 2026

@gujinghui please review it.

#else
return std::string(activity->_name);
#endif
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why this change is a MUST?

Copy link
Copy Markdown
Author

@tsocha tsocha May 12, 2026

Choose a reason for hiding this comment

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

This function is now used with:

  • pti_view_record_api_t aka pti_view_record_api
  • pti_view_record_synchronization

Unfortunately these structs have no common base class in PTI.
I wanted to use the same logic with no code duplication.

@tsocha tsocha requested a review from gujinghui May 13, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants