1 | /* |
2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
3 | * All rights reserved. |
4 | * |
5 | * This source code is licensed under the BSD-style license found in the |
6 | * LICENSE file in the root directory of this source tree. |
7 | */ |
8 | |
9 | #pragma once |
10 | |
11 | #include <array> |
12 | #include <string> |
13 | |
14 | namespace libkineto { |
15 | |
16 | // Note : All activity types are not enabled by default. Please add them |
17 | // at correct position in the enum |
18 | enum class ActivityType { |
19 | // Activity types enabled by default |
20 | CPU_OP = 0, // cpu side ops |
21 | USER_ANNOTATION, |
22 | GPU_USER_ANNOTATION, |
23 | GPU_MEMCPY, |
24 | GPU_MEMSET, |
25 | CONCURRENT_KERNEL, // on-device kernels |
26 | EXTERNAL_CORRELATION, |
27 | CUDA_RUNTIME, // host side cuda runtime events |
28 | CPU_INSTANT_EVENT, // host side point-like events |
29 | PYTHON_FUNCTION, |
30 | OVERHEAD, // CUPTI induced overhead events sampled from its overhead API. |
31 | |
32 | // Optional Activity types |
33 | GLOW_RUNTIME, // host side glow runtime events |
34 | CUDA_PROFILER_RANGE, // CUPTI Profiler range for performance metrics |
35 | HPU_OP, // HPU host side runtime event |
36 | |
37 | ENUM_COUNT, // This is to add buffer and not used for any profiling logic. Add your new type before it. |
38 | OPTIONAL_ACTIVITY_TYPE_START = GLOW_RUNTIME, |
39 | }; |
40 | |
41 | const char* toString(ActivityType t); |
42 | ActivityType toActivityType(const std::string& str); |
43 | |
44 | // Return an array of all activity types except COUNT |
45 | constexpr int activityTypeCount = (int)ActivityType::ENUM_COUNT; |
46 | constexpr int defaultActivityTypeCount = (int)ActivityType::OPTIONAL_ACTIVITY_TYPE_START; |
47 | const std::array<ActivityType, activityTypeCount> activityTypes(); |
48 | const std::array<ActivityType, defaultActivityTypeCount> defaultActivityTypes(); |
49 | |
50 | } // namespace libkineto |
51 | |