This repository was archived by the owner on Sep 30, 2026. It is now read-only.
Repository navigation
[XPUPTI] Fix buffer lifetime and report processed-record stats with some minor improvements. - #1553
Merged
Merged
Conversation
Port the CUPTI completed-buffer fix to the XPU plugin: activityBuffers() now returns already-completed buffers when nothing is in flight, clearActivities() drops them on the early-return path, and bufferCompleted() rejects unknown buffer pointers instead of dereferencing an invalid map iterator. Replace processActivities()' std::pair<int, int> return with a named ActivitiesStats struct and log the record count/byte total, wiring up LOGGER_OBSERVER_ADD_EVENT_COUNT which XPU never reported. Match the signature convention used by XpuptiActivityApi::processActivities and avoid copying the std::function on every call. The handler is only invoked in-scope, never stored.
Contributor
Author
|
@aostrowski-hbn @gujinghui Please review. |
Contributor
Author
|
@pytorchbot label 'ciflow/xpu' |
|
The ciflow label(s) ciflow/xpu will be added, but CI won't be triggered until the workflows are approved (scroll to the bottom of this page). Please ping one of the reviewers if you do not have access to approve and run workflows. |
|
|
aostrowski-hbn
approved these changes
Aug 31, 2026
gujinghui
approved these changes
Sep 2, 2026
tsocha
marked this pull request as ready for review
September 2, 2026 08:02
Contributor
Author
|
@ryanzhang22 @scotts Could you review this PR, please? |
ryanzhang22
approved these changes
Sep 2, 2026
pytorchmergebot
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Sep 4, 2026
Includes the following commits: - [xpupti] Report the hardware engine per GPU op via PTI v2 records (pytorch/kineto#1555) 8b682ab - [Kineto] Reintroduce Windows timestamp fix in CUPTI test (pytorch/kineto#1556) 95fbe6f - [xpupti] Support more than 1 device in ptiMetricsScopeConfigure (pytorch/kineto#1479) 29a6d74 - [XPUPTI] Fix buffer lifetime and report processed-record stats with some minor improvements. (pytorch/kineto#1553) 33b47f8 - [XPU] Improve include hygiene in the XPU PTI Kineto plugin (pytorch/kineto#1548) 760cbb0 Pull Request resolved: #196015 Approved by: https://github.com/Skylion007
Sanskaaar1
pushed a commit
to Sanskaaar1/pytorch
that referenced
this pull request
Sep 8, 2026
Includes the following commits: - [xpupti] Report the hardware engine per GPU op via PTI v2 records (pytorch/kineto#1555) 8b682ab - [Kineto] Reintroduce Windows timestamp fix in CUPTI test (pytorch/kineto#1556) 95fbe6f - [xpupti] Support more than 1 device in ptiMetricsScopeConfigure (pytorch/kineto#1479) 29a6d74 - [XPUPTI] Fix buffer lifetime and report processed-record stats with some minor improvements. (pytorch/kineto#1553) 33b47f8 - [XPU] Improve include hygiene in the XPU PTI Kineto plugin (pytorch/kineto#1548) 760cbb0 Pull Request resolved: pytorch#196015 Approved by: https://github.com/Skylion007
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port the CUPTI completed-buffer fix to the XPU plugin: activityBuffers() now returns already-completed buffers when nothing is in flight, clearActivities() drops them on the early-return path, and bufferCompleted() rejects unknown buffer pointers instead of dereferencing an invalid map iterator.
Replace processActivities()' std::pair<int, int> return with a named ActivitiesStats struct and log the record count/byte total, wiring up LOGGER_OBSERVER_ADD_EVENT_COUNT which XPU never reported.
Match the signature convention used by XpuptiActivityApi::processActivities and avoid copying the std::function on every call. The handler is only invoked in-scope, never stored.