projects/guix·blob java-team · refs

65 lines · 2.2 KiB

1Even when building without Kineto, the <ActivityType.h> header is still
2imported and the ActivityType type is used. This patch was copied from
3https://github.com/pytorch/pytorch/pull/111048 and adapted.
4
5diff --git i/torch/csrc/profiler/kineto_shim.h w/torch/csrc/profiler/kineto_shim.h
6index c4efd7785b7..20cc657961c 100644
7--- i/torch/csrc/profiler/kineto_shim.h
8+++ w/torch/csrc/profiler/kineto_shim.h
9@@ -12,7 +12,56 @@
10 #undef USE_KINETO
11 #endif
12
13+#ifdef USE_KINETO
14 #include <ActivityType.h>
15+#else
16+namespace libkineto {
17+// copied from header
18+/*
19+ * Copyright (c) Meta Platforms, Inc. and affiliates.
20+ * All rights reserved.
21+ *
22+ * This source code is licensed under the BSD-style license found in the
23+ * LICENSE file in the root directory of this source tree.
24+ */
25+
26+// Note : All activity types are not enabled by default. Please add them
27+// at correct position in the enum
28+enum class ActivityType {
29+ // Activity types enabled by default
30+ CPU_OP = 0, // cpu side ops
31+ USER_ANNOTATION,
32+ GPU_USER_ANNOTATION,
33+ GPU_MEMCPY,
34+ GPU_MEMSET,
35+ CONCURRENT_KERNEL, // on-device kernels
36+ EXTERNAL_CORRELATION,
37+ CUDA_RUNTIME, // host side cuda runtime events
38+ CUDA_DRIVER, // host side cuda driver events
39+ CPU_INSTANT_EVENT, // host side point-like events
40+ PYTHON_FUNCTION,
41+ OVERHEAD, // CUPTI induced overhead events sampled from its overhead API.
42+
43+ // Optional Activity types
44+ CUDA_SYNC, // synchronization events between runtime and kernels
45+ GLOW_RUNTIME, // host side glow runtime events
46+ MTIA_RUNTIME, // host side MTIA runtime events
47+ CUDA_PROFILER_RANGE, // CUPTI Profiler range for performance metrics
48+ MTIA_CCP_EVENTS, // MTIA ondevice CCP events
49+ HPU_OP, // HPU host side runtime event
50+ XPU_RUNTIME, // host side xpu runtime events
51+ MTIA_WORKLOADD,
52+ MTIA_INSIGHT, // MTIA insight events (new in 2.8.0)
53+
54+ PRIVATEUSE1_RUNTIME,
55+ PRIVATEUSE1_DRIVER,
56+
57+ ENUM_COUNT, // This is to add buffer and not used for any profiling logic. Add your new type before it.
58+ OPTIONAL_ACTIVITY_TYPE_START = CUDA_SYNC,
59+};
60+}
61+
62+#endif
63
64 #include <torch/csrc/Export.h>
65 #include <torch/csrc/profiler/api.h>