projects/guix·blob javascript-team · refs

64 lines · 2.1 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 a/torch/csrc/profiler/kineto_shim.h b/torch/csrc/profiler/kineto_shim.h
6index c4efd7785..2caef1f1e 100644
7--- a/torch/csrc/profiler/kineto_shim.h
8+++ b/torch/csrc/profiler/kineto_shim.h
9@@ -12,7 +12,55 @@
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+
53+ PRIVATEUSE1_RUNTIME,
54+ PRIVATEUSE1_DRIVER,
55+
56+ ENUM_COUNT, // This is to add buffer and not used for any profiling logic. Add your new type before it.
57+ OPTIONAL_ACTIVITY_TYPE_START = CUDA_SYNC,
58+};
59+}
60+
61+#endif
62
63 #include <torch/csrc/Export.h>
64 #include <torch/csrc/profiler/api.h>