[xpupti] Fix CPU->GPU flow links via activity type, not an API-name allowlist#1467
Open
aostrowski-hbn wants to merge 1 commit into
Open
Conversation
…llowlist
The XPU profiler marked a host record as the start of a CPU->GPU ("ac2g")
flow arrow by exact-matching its API name against a hardcoded allowlist
(correlateRuntimeOps_). That list did not contain
urEnqueueKernelLaunchWithArgsExp -- the launch API used by the 2025.3+
SYCL runtime -- so kernel launches stopped emitting a flow start (ph:"s")
and the host->device arrow disappeared from the trace.
Instead of extending the name list (which needs a new entry on every UR
API rename/addition), decide the flow start from the record's activity
type: only host runtime (XPU_RUNTIME) records start a flow. The runtime
view is already filtered to work-submitting APIs via
ptiViewEnableRuntimeApiClass(PTI_API_CLASS_GPU_OPERATION_CORE), and driver
(XPU_DRIVER) records -- which share the runtime record's correlation id --
must not also start a flow, or the trace gets a duplicate flow start.
This removes the name allowlist entirely (robust to future UR renames) and
extracts the check into a static startsFlow() for unit testing. The gtest
XpuptiFlowCorrelationTest now asserts runtime records start a flow while
driver and device records do not.
Verified on Intel Data Center GPU Max (PVC), oneAPI 2026.0 / PTI 0.18:
- XpuptiFlowCorrelationTest passes; full xpupti ctest 10/10 passes.
- Rebuilt PyTorch against the patched kineto and ran a mixed workload
(H2D copy, add/relu/matmul/reduction, D2H copy): every kernel and memcpy
gets exactly one host->device arrow, with zero Perfetto flow errors
(no flow_duplicate_id) and no PyTorch duplicate-flow-start warnings.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3bae3a3 to
1d31654
Compare
Contributor
Author
|
@ryanzhang22 please import and 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. |
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
gujinghui
approved these changes
Jul 8, 2026
|
@ryanzhang22 @divyanshk @scotts This PR is ready for your review. Thanks. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The XPU profiler marked a host record as the start of a CPU→GPU ("ac2g") flow arrow by exact-matching its API name against a hardcoded allowlist (
correlateRuntimeOps_). That list did not containurEnqueueKernelLaunchWithArgsExp— the launch API used by the 2025.3+ SYCL runtime — so kernel launches stopped emitting a flow start (ph:"s") and the host→device arrow disappeared from the trace.Approach
Rather than add the new name to the list (which needs a new entry on every UR API rename/addition), decide the flow start from the record’s activity type: only host runtime (
XPU_RUNTIME) records start a flow.ptiViewEnableRuntimeApiClass(PTI_API_CLASS_GPU_OPERATION_CORE).XPU_DRIVER) records share the runtime record’s correlation id and must not also start a flow, or the trace gets a duplicate flow start.This removes the name allowlist entirely (robust to future UR renames) and extracts the check into a static
startsFlow()for unit testing. Net −35 lines.No PTI version gate needed
ptiViewEnableRuntimeApiClass/PTI_API_CLASS_GPU_OPERATION_COREexist since PTI 0.12.0 and are already called unconditionally onmain; this change references no PTI symbol (only the KinetoActivityTypeenum), so it builds on all currently-supported PTI versions (0.15–0.18 verified reasoning; 0.18 built).Test Plan
XpuptiFlowCorrelationTestnow asserts runtime records start a flow while driver and device records do not (hardware-free, in the CTest set).Verified on Intel Data Center GPU Max (PVC), oneAPI 2026.0 / PTI 0.18:
XpuptiFlowCorrelationTestpasses; full xpuptictest10/10 passes.flow_duplicate_id) and no PyTorch duplicate-flow-start warnings.