Repository navigation
[xpupti] Don't emit ac2g flow endpoints on XPU_DRIVER records #1549
Changes from all commits
d60635a
bbb65fc
e4db789
1af54a0
f188869
263f135
fbb7270
4db6d0f
c6eae01
307a100
c61bb80
a532806
fb82b77
2c0c691
f3cfa27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,15 +31,6 @@ namespace KINETO_NAMESPACE { | |
| uint32_t XpuptiActivityProfilerSession::iterationCount_ = 0; | ||
| std::vector<DeviceUUIDsT> XpuptiActivityProfilerSession::deviceUUIDs_ = {}; | ||
|
|
||
| bool XpuptiActivityProfilerSession::startsFlow(ActivityType activityType) { | ||
| // Only host runtime records start the CPU->GPU flow. The runtime view is | ||
| // already filtered to work-submitting APIs via | ||
| // ptiViewEnableRuntimeApiClass(PTI_API_CLASS_GPU_OPERATION_CORE). Driver | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In XPU, is there an expectation that all driver calls produce a kernel event? I see that PTI_API_CLASS_GPU_OPERATION_CORE is used for filtering of runtime events, do you need the same thing for driver events? JFYI for CUDA jobs we check if we need a flow arrow on the API call level: https://github.com/pytorch/kineto/blob/main/libkineto/src/CuptiCbidRegistry.cpp#L87 This lets us filter out individual calls (but we don't do the runtime -> driver fallback).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not all driver calls produce kernels, but once we have filtering in place #1570 virtually all of them will (except barriers, I think). The user might still want to filter out driver events. |
||
| // (XPU_DRIVER) records share the same correlation id as the runtime record | ||
| // and must not also start a flow, or the trace gets a duplicate flow start. | ||
| return activityType == ActivityType::XPU_RUNTIME; | ||
| } | ||
|
|
||
| // =========== Session Constructor ============= // | ||
| XpuptiActivityProfilerSession::XpuptiActivityProfilerSession( | ||
| XpuptiActivityApi& xpti, | ||
|
|
@@ -48,10 +39,10 @@ XpuptiActivityProfilerSession::XpuptiActivityProfilerSession( | |
| const std::set<ActivityType>& activity_types) | ||
| : xpti_(xpti), | ||
| config_(config.clone()), | ||
| activity_types_(activity_types), | ||
| tracedTypes_(activity_types), | ||
| name_(name) { | ||
| enumDeviceUUIDs(); | ||
| xpti_.enableXpuptiActivities(activity_types_); | ||
| xpti_.enableXpuptiActivities(tracedTypes_); | ||
| } | ||
|
|
||
| XpuptiActivityProfilerSession::~XpuptiActivityProfilerSession() { | ||
|
|
@@ -65,15 +56,15 @@ void XpuptiActivityProfilerSession::start() { | |
| } | ||
|
|
||
| void XpuptiActivityProfilerSession::stop() { | ||
| xpti_.disablePtiActivities(activity_types_); | ||
| xpti_.disablePtiActivities(tracedTypes_); | ||
| profilerEndTs_ = libkineto::timeSinceEpoch(std::chrono::system_clock::now()); | ||
| } | ||
|
|
||
| void XpuptiActivityProfilerSession::toggleCollectionDynamic(const bool enable) { | ||
| if (enable) { | ||
| xpti_.enableXpuptiActivities(activity_types_); | ||
| xpti_.enableXpuptiActivities(tracedTypes_); | ||
| } else { | ||
| xpti_.disablePtiActivities(activity_types_); | ||
| xpti_.disablePtiActivities(tracedTypes_); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright (C) Intel Corporation | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "ActivityType.h" | ||
|
|
||
| #include <bitset> | ||
| #include <concepts> | ||
| #include <cstddef> | ||
| #include <set> | ||
|
|
||
| namespace KINETO_NAMESPACE { | ||
|
|
||
| // A set of activity types held as a bitset: built once, queried per record. | ||
| // Sized from the enum, so activity types can be added without outgrowing it, | ||
| // and a value outside the enum throws instead of shifting out of range. | ||
| class ActivityTypeMask { | ||
| public: | ||
| explicit ActivityTypeMask(const std::set<ActivityType>& types) { | ||
| for (const auto type : types) { | ||
| bits_.set(asIndex(type)); | ||
| } | ||
| } | ||
|
|
||
| bool contains(ActivityType type) const { | ||
| return bits_.test(asIndex(type)); | ||
| } | ||
|
|
||
| // Calls visit() for each activity type in the set, in ascending order. | ||
| void forEach(std::invocable<ActivityType> auto&& visit) const { | ||
|
aostrowski-hbn marked this conversation as resolved.
Resolved
|
||
| for (size_t type = 0; type < bits_.size(); ++type) { | ||
| if (bits_.test(type)) { | ||
| visit(static_cast<ActivityType>(type)); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private: | ||
| static constexpr size_t asIndex(ActivityType type) { | ||
| return static_cast<size_t>(type); | ||
| } | ||
|
|
||
| std::bitset<libkineto::activityTypeCount> bits_; | ||
| }; | ||
|
|
||
| } // namespace KINETO_NAMESPACE | ||
Uh oh!
There was an error while loading. Please reload this page.