This repository was archived by the owner on Sep 30, 2026. It is now read-only.
Repository navigation
[xpupti] Report the hardware engine per GPU op via PTI v2 records - #1555
Merged
ryanzhang22 merged 1 commit intoSep 4, 2026
Merged
Conversation
Why: Intel GPU traces show one swim lane per SYCL queue, which does not reveal which hardware engine an operation actually ran on. Analysing compute/copy overlap needs that mapping: on platforms that expose a single compute engine, overlapping SYCL-queue lanes do not imply concurrent execution. How: Consume the PTI v2 device activity records (pti_view_record_kernel_v2 and friends), which extend the v1 layout with the engine an operation ran on, and emit engine_ordinal/engine_index as per-op metadata. The v2 records are a binary extension of v1 under the same view kinds, so only the record type changes. Swim lanes stay one per SYCL queue, named "Stream <id>", to match how CUDA lays out streams. Building the plugin now requires PTI 1.0 or newer, which is where the v2 records were introduced.
Contributor
Author
|
@pytorchbot label "ciflow/xpu" |
Contributor
Author
|
@jgong5 @EikanWang @gujinghui — CI is green; requesting an Intel PR approver review for the Draft→Open gate. |
gujinghui
approved these changes
Sep 4, 2026
aostrowski-hbn
marked this pull request as ready for review
September 4, 2026 07:48
Contributor
Author
|
@ryanzhang22 @scotts please review |
ryanzhang22
approved these changes
Sep 4, 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.
Why
Intel GPU traces put one swim lane per SYCL queue. A SYCL queue is a software
queue: the driver maps its operations onto hardware engines, several queues can
share one engine, and a single queue's copies can be spread over several copy
engines. Nothing in the trace says which engine an operation actually ran on, so
two questions users regularly ask cannot be answered from a trace today:
same engine with misleading timestamps?
Both matter when judging compute/copy overlap. On parts that expose a single
compute engine, overlapping SYCL-queue lanes do not imply concurrent execution
at all — and there is currently no way to tell that from the trace.
How
PTI 1.0 introduced v2 device activity records (
pti_view_record_kernel_v2andfriends) which extend the v1 layout with the hardware engine an operation ran
on. They are a binary extension of v1, reported under the same view kinds, so
the plugin only changes the record type it casts to — no new view kinds to
enable, no change in collection.
The engine is then emitted as per-op metadata:
engine_ordinal— the engine group (compute, copy, …)engine_index— the engine within that groupmatching how Level Zero reports command queue groups.
Swim lanes are deliberately left unchanged: still one per SYCL queue, named
Stream <id>, mirroring how CUDA lays out streams.Alternative considered and rejected: keying swim lanes on the engine
Splitting lanes per hardware engine is worse in both directions:
round-robins a single queue's copies across them
(
ur_queue_group_t::getQueueIndex). Measured on Intel Data Center GPU MaxSeries with
UR_L0_USE_COPY_ENGINE=0:7: the 32 copies of one in-orderqueue landed on 8 different engines — one main copy engine plus seven
link copy engines. Engine-keyed lanes would shred that single stream across
eight tracks. (With default settings the same queue stays on a single copy
engine, so this is configuration-dependent — but the configuration is a plain
environment variable.)
collapse into one, merging genuinely distinct queues.
Ordering is preserved either way: even with the copies spread over eight
engines, the trace shows zero overlapping copy slices, because the in-order
queue serialises them. So an engine axis does not buy overlap insight that the
queue axis lacks — which is the other reason to keep it out of the lane key.
Per-op metadata gives the same information without changing the shape of the
trace, and keeps the lane axis (the SYCL queue) the one that actually separates
independent streams of work.
Naming the engine type in the lane label was also dropped: it needs an
additional PTI query and buys nothing once lanes are not engine-keyed.
Tests
XpuptiActivityHandlersTestgains three cases:KernelActivityExposesEngineIdsMemoryCopyActivityExposesEngineIdsSwimLanesStayPerSyclQueueNotPerEngine— pins the lane behaviour: a kernel anda copy on different engines but the same SYCL queue must share one lane,
named
Stream 64.ZeroDurationMemoryCopyOmitsBandwidthmoves to the v2 record type: a hand-builtv1 record would now be read past its end.
Built and ran on Intel Data Center GPU Max Series against PTI 1.2.0 —
XpuptiActivityHandlersTest13/13 pass.Note on the minimum PTI version
Building the xpupti plugin now requires PTI 1.0 or newer, which is where the
v2 records were introduced.