codekingpro/portable-devtools
114k
1/*
2 * Copyright 2011-2023 NVIDIA Corporation. All rights reserved.
3 *
4 * NOTICE TO LICENSEE:
5 *
6 * This source code and/or documentation ("Licensed Deliverables") are
7 * subject to NVIDIA intellectual property rights under U.S. and
8 * international Copyright laws.
9 *
10 * These Licensed Deliverables contained herein is PROPRIETARY and
11 * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12 * conditions of a form of NVIDIA software license agreement by and
13 * between NVIDIA and Licensee ("License Agreement") or electronically
14 * accepted by Licensee. Notwithstanding any terms or conditions to
15 * the contrary in the License Agreement, reproduction or disclosure
16 * of the Licensed Deliverables to any third party without the express
17 * written consent of NVIDIA is prohibited.
18 *
19 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20 * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21 * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22 * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23 * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24 * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25 * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27 * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28 * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32 * OF THESE LICENSED DELIVERABLES.
33 *
34 * U.S. Government End Users. These Licensed Deliverables are a
35 * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36 * 1995), consisting of "commercial computer software" and "commercial
37 * computer software documentation" as such terms are used in 48
38 * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39 * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40 * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41 * U.S. Government End Users acquire the Licensed Deliverables with
42 * only those rights set forth herein.
43 *
44 * Any use of the Licensed Deliverables in individual and commercial
45 * software must include, in the user documentation and internal
46 * comments to the code, the above Disclaimer and U.S. Government End
47 * Users Notice.
48 */
49
50#if !defined(_CUPTI_ACTIVITY_H_)
51#define _CUPTI_ACTIVITY_H_
52
53/**
54 * Deprecated APIs and structures have been moved to the
55 * header :doc: `cupti_activity_deprecated.h`, which is included at
56 * the bottom of this file. Header cupti_activity.h contains
57 * only the latest version of APIs and structures.
58 */
59
60#include <cuda.h>
61#include <cupti_callbacks.h>
62#include <cupti_events.h>
63#include <cupti_metrics.h>
64#include <cupti_result.h>
65
66#if defined(CUPTI_DIRECTIVE_SUPPORT)
67#include <Openacc/cupti_openacc.h>
68#include <Openmp/cupti_openmp.h>
69#endif
70
71#include <cupti_common.h>
72
73#define CUPTI_UNIFIED_MEMORY_CPU_DEVICE_ID ((uint32_t) 0xFFFFFFFFU)
74#define CUPTI_INVALID_CONTEXT_ID ((uint32_t) 0xFFFFFFFFU)
75#define CUPTI_INVALID_STREAM_ID ((uint32_t) 0xFFFFFFFFU)
76#define CUPTI_INVALID_CHANNEL_ID ((uint32_t) 0xFFFFFFFFU)
77
78#if defined(__cplusplus)
79extern "C" {
80#endif
81
82#if defined(__GNUC__) && defined(CUPTI_LIB)
83 #pragma GCC visibility push(default)
84#endif
85
86#define invalidNumaId ((uint32_t) 0xFFFFFFFF)
87
88/**
89 * \defgroup CUPTI_ACTIVITY_API CUPTI Activity API
90 * Functions, types, and enums that implement the CUPTI Activity API.
91 * @{
92 */
93
94/**
95 * \brief The kinds of activity records.
96 *
97 * Each activity record kind represents information about a GPU or an
98 * activity occurring on a CPU or GPU. Each kind is associated with a
99 * activity record structure that holds the information associated
100 * with the kind.
101 * \see CUpti_Activity
102 * \see CUpti_ActivityAPI
103 * \see CUpti_ActivityContext
104 * \see CUpti_ActivityContext2
105 * \see CUpti_ActivityDevice
106 * \see CUpti_ActivityDevice2
107 * \see CUpti_ActivityDevice3
108 * \see CUpti_ActivityDevice4
109 * \see CUpti_ActivityDeviceAttribute
110 * \see CUpti_ActivityEvent
111 * \see CUpti_ActivityEventInstance
112 * \see CUpti_ActivityKernel
113 * \see CUpti_ActivityKernel2
114 * \see CUpti_ActivityKernel3
115 * \see CUpti_ActivityKernel4
116 * \see CUpti_ActivityKernel5
117 * \see CUpti_ActivityKernel6
118 * \see CUpti_ActivityKernel7
119 * \see CUpti_ActivityKernel8
120 * \see CUpti_ActivityKernel9
121 * \see CUpti_ActivityCdpKernel
122 * \see CUpti_ActivityPreemption
123 * \see CUpti_ActivityMemcpy
124 * \see CUpti_ActivityMemcpy3
125 * \see CUpti_ActivityMemcpy4
126 * \see CUpti_ActivityMemcpy5
127 * \see CUpti_ActivityMemcpyPtoP
128 * \see CUpti_ActivityMemcpyPtoP2
129 * \see CUpti_ActivityMemcpyPtoP3
130 * \see CUpti_ActivityMemcpyPtoP4
131 * \see CUpti_ActivityMemset
132 * \see CUpti_ActivityMemset2
133 * \see CUpti_ActivityMemset3
134 * \see CUpti_ActivityMemset4
135 * \see CUpti_ActivityMemory
136 * \see CUpti_ActivityMemory2
137 * \see CUpti_ActivityMemory3
138 * \see CUpti_ActivityMemoryPool
139 * \see CUpti_ActivityMemoryPool2
140 * \see CUpti_ActivityMetric
141 * \see CUpti_ActivityMetricInstance
142 * \see CUpti_ActivityName
143 * \see CUpti_ActivityMarker
144 * \see CUpti_ActivityMarker2
145 * \see CUpti_ActivityMarkerData
146 * \see CUpti_ActivitySourceLocator
147 * \see CUpti_ActivityGlobalAccess
148 * \see CUpti_ActivityGlobalAccess2
149 * \see CUpti_ActivityGlobalAccess3
150 * \see CUpti_ActivityBranch
151 * \see CUpti_ActivityBranch2
152 * \see CUpti_ActivityOverhead3
153 * \see CUpti_ActivityEnvironment
154 * \see CUpti_ActivityInstructionExecution
155 * \see CUpti_ActivityUnifiedMemoryCounter
156 * \see CUpti_ActivityFunction
157 * \see CUpti_ActivityModule
158 * \see CUpti_ActivitySharedAccess
159 * \see CUpti_ActivityPCSampling
160 * \see CUpti_ActivityPCSampling2
161 * \see CUpti_ActivityPCSampling3
162 * \see CUpti_ActivityPCSamplingRecordInfo
163 * \see CUpti_ActivityCudaEvent
164 * \see CUpti_ActivityStream
165 * \see CUpti_ActivitySynchronization
166 * \see CUpti_ActivityInstructionCorrelation
167 * \see CUpti_ActivityExternalCorrelation
168 * \see CUpti_ActivityUnifiedMemoryCounter2
169 * \see CUpti_ActivityOpenAccData
170 * \see CUpti_ActivityOpenAccLaunch
171 * \see CUpti_ActivityOpenAccOther
172 * \see CUpti_ActivityOpenMp
173 * \see CUpti_ActivityNvLink
174 * \see CUpti_ActivityNvLink2
175 * \see CUpti_ActivityNvLink3
176 * \see CUpti_ActivityNvLink4
177 * \see CUpti_ActivityPcie
178 */
179
180typedef enum {
181 /**
182 * The activity record is invalid.
183 */
184 CUPTI_ACTIVITY_KIND_INVALID = 0,
185
186 /**
187 * A host<->host, host<->device, or device<->device memory copy. The
188 * corresponding activity record structure is \ref
189 * CUpti_ActivityMemcpy5.
190 */
191 CUPTI_ACTIVITY_KIND_MEMCPY = 1,
192
193 /**
194 * A memory set executing on the GPU. The corresponding activity
195 * record structure is \ref CUpti_ActivityMemset4.
196 */
197 CUPTI_ACTIVITY_KIND_MEMSET = 2,
198
199 /**
200 * A kernel executing on the GPU. This activity kind may significantly change
201 * the overall performance characteristics of the application because all
202 * kernel executions are serialized on the GPU. Other activity kind for kernel
203 * CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL doesn't break kernel concurrency.
204 * The corresponding activity record structure is \ref CUpti_ActivityKernel9.
205 */
206 CUPTI_ACTIVITY_KIND_KERNEL = 3,
207
208 /**
209 * A CUDA driver API function execution. The corresponding activity
210 * record structure is \ref CUpti_ActivityAPI.
211 */
212 CUPTI_ACTIVITY_KIND_DRIVER = 4,
213
214 /**
215 * A CUDA runtime API function execution. The corresponding activity
216 * record structure is \ref CUpti_ActivityAPI.
217 */
218 CUPTI_ACTIVITY_KIND_RUNTIME = 5,
219
220 /**
221 * An event value. The corresponding activity record structure is
222 * \ref CUpti_ActivityEvent.
223 */
224 CUPTI_ACTIVITY_KIND_EVENT = 6,
225
226 /**
227 * A metric value. The corresponding activity record structure is
228 * \ref CUpti_ActivityMetric.
229 */
230 CUPTI_ACTIVITY_KIND_METRIC = 7,
231
232 /**
233 * Information about a device. The corresponding activity record
234 * structure is \ref CUpti_ActivityDevice5.
235 */
236 CUPTI_ACTIVITY_KIND_DEVICE = 8,
237
238 /**
239 * Information about a context. The corresponding activity record
240 * structure is \ref CUpti_ActivityContext2.
241 */
242 CUPTI_ACTIVITY_KIND_CONTEXT = 9,
243
244 /**
245 * A kernel executing on the GPU. This activity kind doesn't break
246 * kernel concurrency. The corresponding activity record structure
247 * is \ref CUpti_ActivityKernel9.
248 */
249 CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL = 10,
250
251 /**
252 * Resource naming done via NVTX APIs for thread, device, context, etc.
253 * The corresponding activity record structure is \ref CUpti_ActivityName.
254 */
255 CUPTI_ACTIVITY_KIND_NAME = 11,
256
257 /**
258 * Instantaneous, start, or end NVTX marker. The corresponding activity
259 * record structure is \ref CUpti_ActivityMarker2.
260 */
261 CUPTI_ACTIVITY_KIND_MARKER = 12,
262
263 /**
264 * Extended, optional, data about a marker. The corresponding
265 * activity record structure is \ref CUpti_ActivityMarkerData.
266 */
267 CUPTI_ACTIVITY_KIND_MARKER_DATA = 13,
268
269 /**
270 * Source information about source level result. The corresponding
271 * activity record structure is \ref CUpti_ActivitySourceLocator.
272 */
273 CUPTI_ACTIVITY_KIND_SOURCE_LOCATOR = 14,
274
275 /**
276 * Results for source-level global access. The
277 * corresponding activity record structure is \ref
278 * CUpti_ActivityGlobalAccess3.
279 */
280 CUPTI_ACTIVITY_KIND_GLOBAL_ACCESS = 15,
281
282 /**
283 * Results for source-level branch. The corresponding
284 * activity record structure is \ref CUpti_ActivityBranch2.
285 */
286 CUPTI_ACTIVITY_KIND_BRANCH = 16,
287
288 /**
289 * Overhead activity records. The
290 * corresponding activity record structure is
291 * \ref CUpti_ActivityOverhead3.
292 */
293 CUPTI_ACTIVITY_KIND_OVERHEAD = 17,
294
295 /**
296 * A CDP (CUDA Dynamic Parallel) kernel executing on the GPU. The
297 * corresponding activity record structure is \ref
298 * CUpti_ActivityCdpKernel. This activity can not be directly
299 * enabled or disabled. It is enabled and disabled through
300 * concurrent kernel activity i.e. _CONCURRENT_KERNEL.
301 */
302 CUPTI_ACTIVITY_KIND_CDP_KERNEL = 18,
303 /**
304 * Preemption activity record indicating a preemption of a CDP (CUDA
305 * Dynamic Parallel) kernel executing on the GPU. The corresponding
306 * activity record structure is \ref CUpti_ActivityPreemption.
307 */
308 CUPTI_ACTIVITY_KIND_PREEMPTION = 19,
309
310 /**
311 * Environment activity records indicating power, clock, thermal,
312 * etc. levels of the GPU. The corresponding activity record
313 * structure is \ref CUpti_ActivityEnvironment.
314 */
315 CUPTI_ACTIVITY_KIND_ENVIRONMENT = 20,
316
317 /**
318 * An event value associated with a specific event domain
319 * instance. The corresponding activity record structure is \ref
320 * CUpti_ActivityEventInstance.
321 */
322 CUPTI_ACTIVITY_KIND_EVENT_INSTANCE = 21,
323
324 /**
325 * A peer to peer memory copy. The corresponding activity record
326 * structure is \ref CUpti_ActivityMemcpyPtoP4.
327 */
328 CUPTI_ACTIVITY_KIND_MEMCPY2 = 22,
329
330 /**
331 * A metric value associated with a specific metric domain
332 * instance. The corresponding activity record structure is \ref
333 * CUpti_ActivityMetricInstance.
334 */
335 CUPTI_ACTIVITY_KIND_METRIC_INSTANCE = 23,
336
337 /**
338 * Results for source-level instruction execution.
339 * The corresponding activity record structure is \ref
340 * CUpti_ActivityInstructionExecution.
341 */
342 CUPTI_ACTIVITY_KIND_INSTRUCTION_EXECUTION = 24,
343
344 /**
345 * Unified Memory counter record. The corresponding activity
346 * record structure is \ref CUpti_ActivityUnifiedMemoryCounter2.
347 */
348 CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER = 25,
349
350 /**
351 * Device global/function record. The corresponding activity
352 * record structure is \ref CUpti_ActivityFunction.
353 */
354 CUPTI_ACTIVITY_KIND_FUNCTION = 26,
355
356 /**
357 * CUDA Module record. The corresponding activity
358 * record structure is \ref CUpti_ActivityModule.
359 */
360 CUPTI_ACTIVITY_KIND_MODULE = 27,
361
362 /**
363 * A device attribute value. The corresponding activity record
364 * structure is \ref CUpti_ActivityDeviceAttribute.
365 */
366 CUPTI_ACTIVITY_KIND_DEVICE_ATTRIBUTE = 28,
367
368 /**
369 * Results for source-level shared access. The
370 * corresponding activity record structure is \ref
371 * CUpti_ActivitySharedAccess.
372 */
373 CUPTI_ACTIVITY_KIND_SHARED_ACCESS = 29,
374
375 /**
376 * Enable PC sampling for kernels. This will serialize
377 * kernels. The corresponding activity record structure
378 * is \ref CUpti_ActivityPCSampling3.
379 */
380 CUPTI_ACTIVITY_KIND_PC_SAMPLING = 30,
381
382 /**
383 * Summary information about PC sampling records. The
384 * corresponding activity record structure is \ref
385 * CUpti_ActivityPCSamplingRecordInfo.
386 */
387 CUPTI_ACTIVITY_KIND_PC_SAMPLING_RECORD_INFO = 31,
388
389 /**
390 * SASS/Source line-by-line correlation record.
391 * This will generate sass/source correlation for functions that have source
392 * level analysis or pc sampling results. The records will be generated only
393 * when either of source level analysis or pc sampling activity is enabled.
394 * The corresponding activity record structure is \ref
395 * CUpti_ActivityInstructionCorrelation.
396 */
397 CUPTI_ACTIVITY_KIND_INSTRUCTION_CORRELATION = 32,
398
399 /**
400 * OpenACC data events.
401 * The corresponding activity record structure is \ref
402 * CUpti_ActivityOpenAccData.
403 */
404 CUPTI_ACTIVITY_KIND_OPENACC_DATA = 33,
405
406 /**
407 * OpenACC launch events.
408 * The corresponding activity record structure is \ref
409 * CUpti_ActivityOpenAccLaunch.
410 */
411 CUPTI_ACTIVITY_KIND_OPENACC_LAUNCH = 34,
412
413 /**
414 * OpenACC other events.
415 * The corresponding activity record structure is \ref
416 * CUpti_ActivityOpenAccOther.
417 */
418 CUPTI_ACTIVITY_KIND_OPENACC_OTHER = 35,
419
420 /**
421 * Information about a CUDA event. The
422 * corresponding activity record structure is \ref
423 * CUpti_ActivityCudaEvent.
424 */
425 CUPTI_ACTIVITY_KIND_CUDA_EVENT = 36,
426
427 /**
428 * Information about a CUDA stream. The
429 * corresponding activity record structure is \ref
430 * CUpti_ActivityStream.
431 */
432 CUPTI_ACTIVITY_KIND_STREAM = 37,
433
434 /**
435 * Records for synchronization management. The
436 * corresponding activity record structure is \ref
437 * CUpti_ActivitySynchronization.
438 */
439 CUPTI_ACTIVITY_KIND_SYNCHRONIZATION = 38,
440
441 /**
442 * Records for correlation of different programming APIs. The
443 * corresponding activity record structure is \ref
444 * CUpti_ActivityExternalCorrelation.
445 */
446 CUPTI_ACTIVITY_KIND_EXTERNAL_CORRELATION = 39,
447
448 /**
449 * NVLink information.
450 * The corresponding activity record structure is \ref
451 * CUpti_ActivityNvLink4.
452 */
453 CUPTI_ACTIVITY_KIND_NVLINK = 40,
454
455 /**
456 * Instantaneous Event information.
457 * The corresponding activity record structure is \ref
458 * CUpti_ActivityInstantaneousEvent.
459 */
460 CUPTI_ACTIVITY_KIND_INSTANTANEOUS_EVENT = 41,
461
462 /**
463 * Instantaneous Event information for a specific event
464 * domain instance.
465 * The corresponding activity record structure is \ref
466 * CUpti_ActivityInstantaneousEventInstance
467 */
468 CUPTI_ACTIVITY_KIND_INSTANTANEOUS_EVENT_INSTANCE = 42,
469
470 /**
471 * Instantaneous Metric information
472 * The corresponding activity record structure is \ref
473 * CUpti_ActivityInstantaneousMetric.
474 */
475 CUPTI_ACTIVITY_KIND_INSTANTANEOUS_METRIC = 43,
476
477 /**
478 * Instantaneous Metric information for a specific metric
479 * domain instance.
480 * The corresponding activity record structure is \ref
481 * CUpti_ActivityInstantaneousMetricInstance.
482 */
483 CUPTI_ACTIVITY_KIND_INSTANTANEOUS_METRIC_INSTANCE = 44,
484
485 /**
486 * Memory activity tracking allocation and freeing of the memory
487 * The corresponding activity record structure is \ref
488 * CUpti_ActivityMemory.
489 */
490 CUPTI_ACTIVITY_KIND_MEMORY = 45,
491
492 /**
493 * PCI devices information used for PCI topology.
494 * The corresponding activity record structure is \ref
495 * CUpti_ActivityPcie.
496 */
497 CUPTI_ACTIVITY_KIND_PCIE = 46,
498
499 /**
500 * OpenMP parallel events.
501 * The corresponding activity record structure is \ref
502 * CUpti_ActivityOpenMp.
503 */
504 CUPTI_ACTIVITY_KIND_OPENMP = 47,
505
506 /**
507 * A CUDA driver kernel launch occurring outside of any
508 * public API function execution. Tools can handle these
509 * like records for driver API launch functions, although
510 * the cbid field is not used here.
511 * The corresponding activity record structure is \ref
512 * CUpti_ActivityAPI.
513 */
514 CUPTI_ACTIVITY_KIND_INTERNAL_LAUNCH_API = 48,
515
516 /**
517 * Memory activity tracking allocation and freeing of the memory
518 * The corresponding activity record structure is \ref
519 * CUpti_ActivityMemory3.
520 */
521 CUPTI_ACTIVITY_KIND_MEMORY2 = 49,
522
523 /**
524 * Memory pool activity tracking creation, destruction and
525 * trimming of the memory pool.
526 * The corresponding activity record structure is \ref
527 * CUpti_ActivityMemoryPool2.
528 */
529 CUPTI_ACTIVITY_KIND_MEMORY_POOL = 50,
530
531 /**
532 * The corresponding activity record structure is
533 * \ref CUpti_ActivityGraphTrace2.
534 */
535 CUPTI_ACTIVITY_KIND_GRAPH_TRACE = 51,
536
537 /**
538 * JIT operation tracking
539 * The corresponding activity record structure is \ref
540 * CUpti_ActivityJit.
541 */
542 CUPTI_ACTIVITY_KIND_JIT = 52,
543
544 CUPTI_ACTIVITY_KIND_COUNT,
545
546 CUPTI_ACTIVITY_KIND_FORCE_INT = 0x7fffffff
547} CUpti_ActivityKind;
548
549/**
550 * \brief The kinds of activity objects.
551 * \see CUpti_ActivityObjectKindId
552 */
553typedef enum {
554 /**
555 * The object kind is not known.
556 */
557 CUPTI_ACTIVITY_OBJECT_UNKNOWN = 0,
558
559 /**
560 * A process.
561 */
562 CUPTI_ACTIVITY_OBJECT_PROCESS = 1,
563
564 /**
565 * A thread.
566 */
567 CUPTI_ACTIVITY_OBJECT_THREAD = 2,
568
569 /**
570 * A device.
571 */
572 CUPTI_ACTIVITY_OBJECT_DEVICE = 3,
573
574 /**
575 * A context.
576 */
577 CUPTI_ACTIVITY_OBJECT_CONTEXT = 4,
578
579 /**
580 * A stream.
581 */
582 CUPTI_ACTIVITY_OBJECT_STREAM = 5,
583
584 CUPTI_ACTIVITY_OBJECT_FORCE_INT = 0x7fffffff
585} CUpti_ActivityObjectKind;
586
587/**
588 * \brief Identifiers for object kinds as specified by
589 * CUpti_ActivityObjectKind.
590 * \see CUpti_ActivityObjectKind
591 */
592typedef union {
593 /**
594 * A process object requires that we identify the process ID. A
595 * thread object requires that we identify both the process and
596 * thread ID.
597 */
598 struct {
599 uint32_t processId;
600 uint32_t threadId;
601 } pt;
602
603 /**
604 * A device object requires that we identify the device ID. A
605 * context object requires that we identify both the device and
606 * context ID. A stream object requires that we identify device,
607 * context, and stream ID.
608 */
609 struct {
610 uint32_t deviceId;
611 uint32_t contextId;
612 uint32_t streamId;
613 } dcs;
614} CUpti_ActivityObjectKindId;
615
616/**
617 * \brief The structure to provide additional data for CUPTI_ACTIVITY_OVERHEAD_COMMAND_BUFFER_FULL.
618 */
619typedef struct {
620 /**
621 * The length of the command buffer.
622 *
623 */
624 uint32_t commandBufferLength;
625 /**
626 * The channel ID of the command buffer.
627 *
628 */
629 uint32_t channelID;
630 /**
631 * The channel type of the command buffer.
632 *
633 */
634 uint32_t channelType;
635} CUpti_ActivityOverheadCommandBufferFullData;
636
637/**
638 * \brief The kinds of activity overhead.
639 */
640typedef enum {
641 /**
642 * The overhead kind is not known.
643 */
644 CUPTI_ACTIVITY_OVERHEAD_UNKNOWN = 0,
645
646 /**
647 * Compiler overhead.
648 */
649 CUPTI_ACTIVITY_OVERHEAD_DRIVER_COMPILER = 1,
650
651 /**
652 * Activity buffer flush overhead.
653 */
654 CUPTI_ACTIVITY_OVERHEAD_CUPTI_BUFFER_FLUSH = 1<<16,
655
656 /**
657 * CUPTI instrumentation overhead.
658 */
659 CUPTI_ACTIVITY_OVERHEAD_CUPTI_INSTRUMENTATION = 2<<16,
660
661 /**
662 * CUPTI resource creation and destruction overhead.
663 */
664 CUPTI_ACTIVITY_OVERHEAD_CUPTI_RESOURCE = 3<<16,
665
666 /**
667 * CUDA Runtime triggered module loading overhead.
668 */
669 CUPTI_ACTIVITY_OVERHEAD_RUNTIME_TRIGGERED_MODULE_LOADING = 4<<16,
670
671 /**
672 * Lazy function loading overhead.
673 */
674 CUPTI_ACTIVITY_OVERHEAD_LAZY_FUNCTION_LOADING = 5<<16,
675
676 /**
677 * Overhead due to lack of command buffer space.
678 * Refer CUpti_ActivityOverheadCommandBufferFullData for more details.
679 */
680 CUPTI_ACTIVITY_OVERHEAD_COMMAND_BUFFER_FULL = 6<<16,
681
682 CUPTI_ACTIVITY_OVERHEAD_FORCE_INT = 0x7fffffff
683} CUpti_ActivityOverheadKind;
684
685/**
686 * \brief The kind of a compute API.
687 */
688typedef enum {
689 /**
690 * The compute API is not known.
691 */
692 CUPTI_ACTIVITY_COMPUTE_API_UNKNOWN = 0,
693
694 /**
695 * The compute APIs are for CUDA.
696 */
697 CUPTI_ACTIVITY_COMPUTE_API_CUDA = 1,
698
699 /**
700 * The compute APIs are for CUDA running
701 * in MPS (Multi-Process Service) environment.
702 */
703 CUPTI_ACTIVITY_COMPUTE_API_CUDA_MPS = 2,
704
705 CUPTI_ACTIVITY_COMPUTE_API_FORCE_INT = 0x7fffffff
706} CUpti_ActivityComputeApiKind;
707
708/**
709 * \brief Flags associated with activity records.
710 *
711 * Activity record flags. Flags can be combined by bitwise OR to
712 * associated multiple flags with an activity record. Each flag is
713 * specific to a certain activity kind, as noted below.
714 */
715typedef enum {
716 /**
717 * Indicates the activity record has no flags.
718 */
719 CUPTI_ACTIVITY_FLAG_NONE = 0,
720
721 /**
722 * Indicates the activity represents a device that supports
723 * concurrent kernel execution. Valid for
724 * CUPTI_ACTIVITY_KIND_DEVICE.
725 */
726 CUPTI_ACTIVITY_FLAG_DEVICE_CONCURRENT_KERNELS = 1 << 0,
727
728 /**
729 * Indicates if the activity represents a CUdevice_attribute value
730 * or a CUpti_DeviceAttribute value. Valid for
731 * CUPTI_ACTIVITY_KIND_DEVICE_ATTRIBUTE.
732 */
733 CUPTI_ACTIVITY_FLAG_DEVICE_ATTRIBUTE_CUDEVICE = 1 << 0,
734
735 /**
736 * Indicates the activity represents an asynchronous memcpy
737 * operation. Valid for CUPTI_ACTIVITY_KIND_MEMCPY.
738 */
739 CUPTI_ACTIVITY_FLAG_MEMCPY_ASYNC = 1 << 0,
740
741 /**
742 * Indicates the activity represents an instantaneous marker. Valid
743 * for CUPTI_ACTIVITY_KIND_MARKER.
744 */
745 CUPTI_ACTIVITY_FLAG_MARKER_INSTANTANEOUS = 1 << 0,
746
747 /**
748 * Indicates the activity represents a region start marker. Valid
749 * for CUPTI_ACTIVITY_KIND_MARKER.
750 */
751 CUPTI_ACTIVITY_FLAG_MARKER_START = 1 << 1,
752
753 /**
754 * Indicates the activity represents a region end marker. Valid for
755 * CUPTI_ACTIVITY_KIND_MARKER.
756 */
757 CUPTI_ACTIVITY_FLAG_MARKER_END = 1 << 2,
758
759 /**
760 * Indicates the activity represents an attempt to acquire a user
761 * defined synchronization object.
762 * Valid for CUPTI_ACTIVITY_KIND_MARKER.
763 */
764 CUPTI_ACTIVITY_FLAG_MARKER_SYNC_ACQUIRE = 1 << 3,
765
766 /**
767 * Indicates the activity represents success in acquiring the
768 * user defined synchronization object.
769 * Valid for CUPTI_ACTIVITY_KIND_MARKER.
770 */
771 CUPTI_ACTIVITY_FLAG_MARKER_SYNC_ACQUIRE_SUCCESS = 1 << 4,
772
773 /**
774 * Indicates the activity represents failure in acquiring the
775 * user defined synchronization object.
776 * Valid for CUPTI_ACTIVITY_KIND_MARKER.
777 */
778 CUPTI_ACTIVITY_FLAG_MARKER_SYNC_ACQUIRE_FAILED = 1 << 5,
779
780 /**
781 * Indicates the activity represents releasing a reservation on
782 * user defined synchronization object.
783 * Valid for CUPTI_ACTIVITY_KIND_MARKER.
784 */
785 CUPTI_ACTIVITY_FLAG_MARKER_SYNC_RELEASE = 1 << 6,
786
787 /**
788 * Indicates the activity represents a marker that does not specify
789 * a color. Valid for CUPTI_ACTIVITY_KIND_MARKER_DATA.
790 */
791 CUPTI_ACTIVITY_FLAG_MARKER_COLOR_NONE = 1 << 0,
792
793 /**
794 * Indicates the activity represents a marker that specifies a color
795 * in alpha-red-green-blue format. Valid for
796 * CUPTI_ACTIVITY_KIND_MARKER_DATA.
797 */
798 CUPTI_ACTIVITY_FLAG_MARKER_COLOR_ARGB = 1 << 1,
799
800 /**
801 * The number of bytes requested by each thread
802 * Valid for CUpti_ActivityGlobalAccess3.
803 */
804 CUPTI_ACTIVITY_FLAG_GLOBAL_ACCESS_KIND_SIZE_MASK = 0xFF << 0,
805
806 /**
807 * If bit in this flag is set, the access was load, else it is a
808 * store access. Valid for CUpti_ActivityGlobalAccess3.
809 */
810 CUPTI_ACTIVITY_FLAG_GLOBAL_ACCESS_KIND_LOAD = 1 << 8,
811
812 /**
813 * If this bit in flag is set, the load access was cached else it is
814 * uncached. Valid for CUpti_ActivityGlobalAccess3.
815 */
816 CUPTI_ACTIVITY_FLAG_GLOBAL_ACCESS_KIND_CACHED = 1 << 9,
817
818 /**
819 * If this bit in flag is set, the metric value overflowed. Valid
820 * for CUpti_ActivityMetric and CUpti_ActivityMetricInstance.
821 */
822 CUPTI_ACTIVITY_FLAG_METRIC_OVERFLOWED = 1 << 0,
823
824 /**
825 * If this bit in flag is set, the metric value couldn't be
826 * calculated. This occurs when a value(s) required to calculate the
827 * metric is missing. Valid for CUpti_ActivityMetric and
828 * CUpti_ActivityMetricInstance.
829 */
830 CUPTI_ACTIVITY_FLAG_METRIC_VALUE_INVALID = 1 << 1,
831
832 /**
833 * If this bit in flag is set, the source level metric value couldn't be
834 * calculated. This occurs when a value(s) required to calculate the
835 * source level metric cannot be evaluated.
836 * Valid for CUpti_ActivityInstructionExecution.
837 */
838 CUPTI_ACTIVITY_FLAG_INSTRUCTION_VALUE_INVALID = 1 << 0,
839
840 /**
841 * The mask for the instruction class, \ref CUpti_ActivityInstructionClass
842 * Valid for CUpti_ActivityInstructionExecution and
843 * CUpti_ActivityInstructionCorrelation
844 */
845 CUPTI_ACTIVITY_FLAG_INSTRUCTION_CLASS_MASK = 0xFF << 1,
846
847 /**
848 * When calling cuptiActivityFlushAll, this flag
849 * can be set to force CUPTI to flush all records in the buffer, whether
850 * finished or not
851 */
852 CUPTI_ACTIVITY_FLAG_FLUSH_FORCED = 1 << 0,
853
854 /**
855 * The number of bytes requested by each thread
856 * Valid for CUpti_ActivitySharedAccess.
857 */
858 CUPTI_ACTIVITY_FLAG_SHARED_ACCESS_KIND_SIZE_MASK = 0xFF << 0,
859
860 /**
861 * If bit in this flag is set, the access was load, else it is a
862 * store access. Valid for CUpti_ActivitySharedAccess.
863 */
864 CUPTI_ACTIVITY_FLAG_SHARED_ACCESS_KIND_LOAD = 1 << 8,
865
866 /**
867 * Indicates the activity represents an asynchronous memset
868 * operation. Valid for CUPTI_ACTIVITY_KIND_MEMSET.
869 */
870 CUPTI_ACTIVITY_FLAG_MEMSET_ASYNC = 1 << 0,
871
872 /**
873 * Indicates the activity represents thrashing in CPU.
874 * Valid for counter of kind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THRASHING in
875 * CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER
876 */
877 CUPTI_ACTIVITY_FLAG_THRASHING_IN_CPU = 1 << 0,
878
879 /**
880 * Indicates the activity represents page throttling in CPU.
881 * Valid for counter of kind CUPTI_ACTIVITY_UNIFIED_MEMORY_COUNTER_KIND_THROTTLING in
882 * CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER
883 */
884 CUPTI_ACTIVITY_FLAG_THROTTLING_IN_CPU = 1 << 0,
885
886 CUPTI_ACTIVITY_FLAG_FORCE_INT = 0x7fffffff
887} CUpti_ActivityFlag;
888
889/**
890 * \brief The stall reason for PC sampling activity.
891 */
892typedef enum {
893 /**
894 * Invalid reason
895 */
896 CUPTI_ACTIVITY_PC_SAMPLING_STALL_INVALID = 0,
897
898 /**
899 * No stall, instruction is selected for issue
900 */
901 CUPTI_ACTIVITY_PC_SAMPLING_STALL_NONE = 1,
902
903 /**
904 * Warp is blocked because next instruction is not yet available,
905 * because of instruction cache miss, or because of branching effects
906 */
907 CUPTI_ACTIVITY_PC_SAMPLING_STALL_INST_FETCH = 2,
908
909 /**
910 * Instruction is waiting on an arithmetic dependency
911 */
912 CUPTI_ACTIVITY_PC_SAMPLING_STALL_EXEC_DEPENDENCY = 3,
913
914 /**
915 * Warp is blocked because it is waiting for a memory access to complete.
916 */
917 CUPTI_ACTIVITY_PC_SAMPLING_STALL_MEMORY_DEPENDENCY = 4,
918
919 /**
920 * Texture sub-system is fully utilized or has too many outstanding requests.
921 */
922 CUPTI_ACTIVITY_PC_SAMPLING_STALL_TEXTURE = 5,
923
924 /**
925 * Warp is blocked as it is waiting at __syncthreads() or at memory barrier.
926 */
927 CUPTI_ACTIVITY_PC_SAMPLING_STALL_SYNC = 6,
928
929 /**
930 * Warp is blocked waiting for __constant__ memory and immediate memory access to complete.
931 */
932 CUPTI_ACTIVITY_PC_SAMPLING_STALL_CONSTANT_MEMORY_DEPENDENCY = 7,
933
934 /**
935 * Compute operation cannot be performed due to the required resources not
936 * being available.
937 */
938 CUPTI_ACTIVITY_PC_SAMPLING_STALL_PIPE_BUSY = 8,
939
940 /**
941 * Warp is blocked because there are too many pending memory operations.
942 * In Kepler architecture it often indicates high number of memory replays.
943 */
944 CUPTI_ACTIVITY_PC_SAMPLING_STALL_MEMORY_THROTTLE = 9,
945
946 /**
947 * Warp was ready to issue, but some other warp issued instead.
948 */
949 CUPTI_ACTIVITY_PC_SAMPLING_STALL_NOT_SELECTED = 10,
950
951 /**
952 * Miscellaneous reasons
953 */
954 CUPTI_ACTIVITY_PC_SAMPLING_STALL_OTHER = 11,
955
956 /**
957 * Sleeping.
958 */
959 CUPTI_ACTIVITY_PC_SAMPLING_STALL_SLEEPING = 12,
960
961 CUPTI_ACTIVITY_PC_SAMPLING_STALL_FORCE_INT = 0x7fffffff
962} CUpti_ActivityPCSamplingStallReason;
963
964/**
965 * \brief Sampling period for PC sampling method
966 *
967 * Sampling period can be set using \ref cuptiActivityConfigurePCSampling
968 */
969typedef enum {
970 /**
971 * The PC sampling period is not set.
972 */
973 CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_INVALID = 0,
974
975 /**
976 * Minimum sampling period available on the device.
977 */
978 CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_MIN = 1,
979
980 /**
981 * Sampling period in lower range.
982 */
983 CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_LOW = 2,
984
985 /**
986 * Medium sampling period.
987 */
988 CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_MID = 3,
989
990 /**
991 * Sampling period in higher range.
992 */
993 CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_HIGH = 4,
994
995 /**
996 * Maximum sampling period available on the device.
997 */
998 CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_MAX = 5,
999
1000 CUPTI_ACTIVITY_PC_SAMPLING_PERIOD_FORCE_INT = 0x7fffffff
1001} CUpti_ActivityPCSamplingPeriod;
1002
1003/**
1004 * \brief The kind of a memory copy, indicating the source and
1005 * destination targets of the copy.
1006 *
1007 * Each kind represents the source and destination targets of a memory
1008 * copy. Targets are host, device, and array.
1009 */
1010typedef enum {
1011 /**
1012 * The memory copy kind is not known.
1013 */
1014 CUPTI_ACTIVITY_MEMCPY_KIND_UNKNOWN = 0,
1015
1016 /**
1017 * A host to device memory copy.
1018 */
1019 CUPTI_ACTIVITY_MEMCPY_KIND_HTOD = 1,
1020
1021 /**
1022 * A device to host memory copy.
1023 */
1024 CUPTI_ACTIVITY_MEMCPY_KIND_DTOH = 2,
1025
1026 /**
1027 * A host to device array memory copy.
1028 */
1029 CUPTI_ACTIVITY_MEMCPY_KIND_HTOA = 3,
1030
1031 /**
1032 * A device array to host memory copy.
1033 */
1034 CUPTI_ACTIVITY_MEMCPY_KIND_ATOH = 4,
1035
1036 /**
1037 * A device array to device array memory copy.
1038 */
1039 CUPTI_ACTIVITY_MEMCPY_KIND_ATOA = 5,
1040
1041 /**
1042 * A device array to device memory copy.
1043 */
1044 CUPTI_ACTIVITY_MEMCPY_KIND_ATOD = 6,
1045
1046 /**
1047 * A device to device array memory copy.
1048 */
1049 CUPTI_ACTIVITY_MEMCPY_KIND_DTOA = 7,
1050
1051 /**
1052 * A device to device memory copy on the same device.
1053 */
1054 CUPTI_ACTIVITY_MEMCPY_KIND_DTOD = 8,
1055
1056 /**
1057 * A host to host memory copy.
1058 */
1059 CUPTI_ACTIVITY_MEMCPY_KIND_HTOH = 9,
1060
1061 /**
1062 * A peer to peer memory copy across different devices.
1063 */
1064 CUPTI_ACTIVITY_MEMCPY_KIND_PTOP = 10,
1065
1066 CUPTI_ACTIVITY_MEMCPY_KIND_FORCE_INT = 0x7fffffff
1067} CUpti_ActivityMemcpyKind;
1068
1069/**
1070 * \brief The kinds of memory accessed by a memory operation/copy.
1071 *
1072 * Each kind represents the type of the memory
1073 * accessed by a memory operation/copy.
1074 */
1075typedef enum {
1076 /**
1077 * The memory kind is unknown.
1078 */
1079 CUPTI_ACTIVITY_MEMORY_KIND_UNKNOWN = 0,
1080
1081 /**
1082 * The memory is pageable.
1083 */
1084 CUPTI_ACTIVITY_MEMORY_KIND_PAGEABLE = 1,
1085
1086 /**
1087 * The memory is pinned.
1088 */
1089 CUPTI_ACTIVITY_MEMORY_KIND_PINNED = 2,
1090
1091 /**
1092 * The memory is on the device.
1093 */
1094 CUPTI_ACTIVITY_MEMORY_KIND_DEVICE = 3,
1095
1096 /**
1097 * The memory is an array.
1098 */
1099 CUPTI_ACTIVITY_MEMORY_KIND_ARRAY = 4,
1100
1101 /**
1102 * The memory is managed
1103 */
1104 CUPTI_ACTIVITY_MEMORY_KIND_MANAGED = 5,
1105
1106 /**
1107 * The memory is device static
1108 */
1109 CUPTI_ACTIVITY_MEMORY_KIND_DEVICE_STATIC = 6,
1110
1111 /**
1112 * The memory is managed static
1113 */
1114 CUPTI_ACTIVITY_MEMORY_KIND_MANAGED_STATIC = 7,
1115
1116 CUPTI_ACTIVITY_MEMORY_KIND_FORCE_INT = 0x7fffffff
1117} CUpti_ActivityMemoryKind;
1118
1119/**
1120 * \brief The kind of a preemption activity.
1121 */
1122typedef enum {
1123 /**
1124 * The preemption kind is not known.
1125 */
1126 CUPTI_ACTIVITY_PREEMPTION_KIND_UNKNOWN = 0,
1127
1128 /**
1129 * Preemption to save CDP block.
1130 */
1131 CUPTI_ACTIVITY_PREEMPTION_KIND_SAVE = 1,
1132
1133 /**
1134 * Preemption to restore CDP block.
1135 */
1136 CUPTI_ACTIVITY_PREEMPTION_KIND_RESTORE = 2,
1137
1138 CUPTI_ACTIVITY_PREEMPTION_KIND_FORCE_INT = 0x7fffffff
1139} CUpti_ActivityPreemptionKind;
1140
1141/**
1142 * \brief The kind of environment data. Used to indicate what type of
1143 * data is being reported by an environment activity record.
1144 */
1145typedef enum {
1146 /**
1147 * Unknown data.
1148 */
1149 CUPTI_ACTIVITY_ENVIRONMENT_UNKNOWN = 0,
1150
1151 /**
1152 * The environment data is related to speed.
1153 */
1154 CUPTI_ACTIVITY_ENVIRONMENT_SPEED = 1,
1155
1156 /**
1157 * The environment data is related to temperature.
1158 */
1159 CUPTI_ACTIVITY_ENVIRONMENT_TEMPERATURE = 2,
1160
1161 /**
1162 * The environment data is related to power.
1163 */
1164 CUPTI_ACTIVITY_ENVIRONMENT_POWER = 3,
1165
1166 /**
1167 * The environment data is related to cooling.
1168 */
1169 CUPTI_ACTIVITY_ENVIRONMENT_COOLING = 4,
1170
1171 CUPTI_ACTIVITY_ENVIRONMENT_COUNT,
1172
1173 CUPTI_ACTIVITY_ENVIRONMENT_KIND_FORCE_INT = 0x7fffffff
1174} CUpti_ActivityEnvironmentKind;
1175
1176/**
1177 * \brief Reasons for clock throttling.
1178 *
1179 * The possible reasons that a clock can be throttled. There can be
1180 * more than one reason that a clock is being throttled so these types
1181 * can be combined by bitwise OR. These are used in the
1182 * clocksThrottleReason field in the Environment Activity Record.
1183 */
1184typedef enum {
1185 /**
1186 * Nothing is running on the GPU and the clocks are dropping to idle
1187 * state.
1188 */
1189 CUPTI_CLOCKS_THROTTLE_REASON_GPU_IDLE = 0x00000001,
1190
1191 /**
1192 * The GPU clocks are limited by a user specified limit.
1193 */
1194 CUPTI_CLOCKS_THROTTLE_REASON_USER_DEFINED_CLOCKS = 0x00000002,
1195
1196 /**
1197 * A software power scaling algorithm is reducing the clocks below
1198 * requested clocks.
1199 */
1200 CUPTI_CLOCKS_THROTTLE_REASON_SW_POWER_CAP = 0x00000004,
