rocprofiler-sdk/kfd/kfd_id.h Source File

rocprofiler-sdk/kfd/kfd_id.h Source File#

ROCprofiler-SDK developer API: rocprofiler-sdk/kfd/kfd_id.h Source File
ROCprofiler-SDK developer API 1.0.0
ROCm Profiling API and tools
kfd_id.h
1// MIT License
2//
3// Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21// THE SOFTWARE.
22
23#pragma once
24
25#include <rocprofiler-sdk/defines.h>
26#include <rocprofiler-sdk/hsa.h>
27#include <rocprofiler-sdk/hsa/api_trace_version.h>
28#include <rocprofiler-sdk/version.h>
29
30#include <stdint.h>
31
32ROCPROFILER_EXTERN_C_INIT
33
34/**
35 * @brief Page migration event operations. @see
36 * rocprofiler_buffer_tracing_kfd_event_page_migrate_record_t
37 */
38typedef enum rocprofiler_kfd_event_page_migrate_operation_t
39{
40 ROCPROFILER_KFD_EVENT_PAGE_MIGRATE_NONE = -1,
41 ROCPROFILER_KFD_EVENT_PAGE_MIGRATE_PREFETCH, ///< Migration triggered by a prefetch
42 ROCPROFILER_KFD_EVENT_PAGE_MIGRATE_PAGEFAULT_GPU, ///< Migration triggered by a page fault on
43 ///< the GPU
44 ROCPROFILER_KFD_EVENT_PAGE_MIGRATE_PAGEFAULT_CPU, ///< Migration triggered by a page fault on
45 ///< the CPU
46 ROCPROFILER_KFD_EVENT_PAGE_MIGRATE_TTM_EVICTION, ///< Page evicted by linux TTM (Translation
47 ///< Table Manager)
48 ROCPROFILER_KFD_EVENT_PAGE_MIGRATE_END,
49 ROCPROFILER_KFD_EVENT_PAGE_MIGRATE_LAST,
50} rocprofiler_kfd_event_page_migrate_operation_t;
51
52/**
53 * @brief Page fault event operations. @see rocprofiler_buffer_tracing_kfd_event_page_fault_record_t
54 */
55typedef enum rocprofiler_kfd_event_page_fault_operation_t
56{
57 ROCPROFILER_KFD_EVENT_PAGE_FAULT_NONE = -1,
58 ROCPROFILER_KFD_EVENT_PAGE_FAULT_START,
59 ROCPROFILER_KFD_EVENT_PAGE_FAULT_START_READ_FAULT, ///< Page fault was due to a read operation
60 ROCPROFILER_KFD_EVENT_PAGE_FAULT_START_WRITE_FAULT, ///< Page fault was due to a write
61 ///< operation
62 ROCPROFILER_KFD_EVENT_PAGE_FAULT_END_PAGE_MIGRATED, ///< Fault resolved through a migration
63 ROCPROFILER_KFD_EVENT_PAGE_FAULT_END_PAGE_UPDATED, ///< Fault resolved through an update
64 ROCPROFILER_KFD_EVENT_PAGE_FAULT_LAST,
65} rocprofiler_kfd_event_page_fault_operation_t;
66
67/**
68 * @brief Queue evict/restore event operations. @see
69 * rocprofiler_buffer_tracing_kfd_event_queue_record_t
70 */
71typedef enum rocprofiler_kfd_event_queue_operation_t
72{
73 ROCPROFILER_KFD_EVENT_QUEUE_NONE = -1,
74 ROCPROFILER_KFD_EVENT_QUEUE_EVICT_SVM, ///< SVM Buffer migration
75 ROCPROFILER_KFD_EVENT_QUEUE_EVICT_USERPTR, ///< userptr movement
76 ROCPROFILER_KFD_EVENT_QUEUE_EVICT_TTM, ///< TTM move buffer
77 ROCPROFILER_KFD_EVENT_QUEUE_EVICT_SUSPEND, ///< GPU suspend
78 ROCPROFILER_KFD_EVENT_QUEUE_EVICT_CRIU_CHECKPOINT, ///< Queues evicted due to process
79 ///< checkpoint by CRIU
80 ROCPROFILER_KFD_EVENT_QUEUE_EVICT_CRIU_RESTORE, ///< Queues restored during process restore by
81 ///< CRIU
82
83 ROCPROFILER_KFD_EVENT_QUEUE_RESTORE_RESCHEDULED, ///< Queue was not restored; will be restored
84 ///< later
85 ROCPROFILER_KFD_EVENT_QUEUE_RESTORE, ///< Queue was restored
86 ROCPROFILER_KFD_EVENT_QUEUE_LAST,
87} rocprofiler_kfd_event_queue_operation_t;
88
89/**
90 * @brief Memory unmap from GPU event operations. @see
91 * rocprofiler_buffer_tracing_kfd_event_unmap_from_gpu_record_t
92 */
93typedef enum rocprofiler_kfd_event_unmap_from_gpu_operation_t
94{
95 ROCPROFILER_KFD_EVENT_UNMAP_FROM_GPU_NONE = -1,
96 ROCPROFILER_KFD_EVENT_UNMAP_FROM_GPU_MMU_NOTIFY, ///< MMU notifier CPU buffer movement
97 ROCPROFILER_KFD_EVENT_UNMAP_FROM_GPU_MMU_NOTIFY_MIGRATE, ///< MMU notifier page migration
98 ROCPROFILER_KFD_EVENT_UNMAP_FROM_GPU_UNMAP_FROM_CPU, ///< Unmap to free the buffer
99 ROCPROFILER_KFD_EVENT_UNMAP_FROM_GPU_LAST,
100} rocprofiler_kfd_event_unmap_from_gpu_operation_t;
101
102/**
103 * @brief KFD dropped event operations. @see
104 * rocprofiler_buffer_tracing_kfd_event_dropped_events_record_t
105 */
106typedef enum rocprofiler_kfd_event_dropped_events_operation_t
107{
108 ROCPROFILER_KFD_EVENT_DROPPED_EVENTS_NONE = -1,
109 ROCPROFILER_KFD_EVENT_DROPPED_EVENTS,
110 ROCPROFILER_KFD_EVENT_DROPPED_EVENTS_LAST,
111} rocprofiler_kfd_event_dropped_events_operation_t;
112
113/**
114 * @brief Operation kinds for @see rocprofiler_buffer_tracing_kfd_page_migrate_record_t
115 */
116typedef enum rocprofiler_kfd_page_migrate_operation_t
117{
118 ROCPROFILER_KFD_PAGE_MIGRATE_NONE = -1,
119 ROCPROFILER_KFD_PAGE_MIGRATE_PREFETCH, ///< Migration triggered by a prefetch
120 ROCPROFILER_KFD_PAGE_MIGRATE_PAGEFAULT_GPU, ///< Migration triggered by a page fault on the
121 ///< GPU
122 ROCPROFILER_KFD_PAGE_MIGRATE_PAGEFAULT_CPU, ///< Migration triggered by a page fault on the
123 ///< CPU
124 ROCPROFILER_KFD_PAGE_MIGRATE_TTM_EVICTION, ///< Page evicted by linux TTM (Translation Table
125 ///< Manager)
126 ROCPROFILER_KFD_PAGE_MIGRATE_LAST,
127} rocprofiler_kfd_page_migrate_operation_t;
128
129/**
130 * @brief Operation kinds for @see rocprofiler_buffer_tracing_kfd_page_fault_record_t
131 */
132typedef enum rocprofiler_kfd_page_fault_operation_t
133{
134 ROCPROFILER_KFD_PAGE_FAULT_NONE = -1,
135 ROCPROFILER_KFD_PAGE_FAULT_READ_FAULT_MIGRATED, ///< read fault resolved with a migrate
136 ROCPROFILER_KFD_PAGE_FAULT_READ_FAULT_UPDATED, ///< read fault resolved with an update
137 ROCPROFILER_KFD_PAGE_FAULT_WRITE_FAULT_MIGRATED, ///< write fault resolved with an migrate
138 ROCPROFILER_KFD_PAGE_FAULT_WRITE_FAULT_UPDATED, ///< write fault resolved with an update
139 ROCPROFILER_KFD_PAGE_FAULT_LAST,
140} rocprofiler_kfd_page_fault_operation_t;
141
142/**
143 * @brief Operation kinds for @see rocprofiler_buffer_tracing_kfd_queue_record_t
144 */
145typedef enum rocprofiler_kfd_queue_operation_t
146{
147 ROCPROFILER_KFD_QUEUE_NONE = -1,
148 ROCPROFILER_KFD_QUEUE_EVICT_SVM, ///< SVM Buffer migration
149 ROCPROFILER_KFD_QUEUE_EVICT_USERPTR, ///< userptr movement
150 ROCPROFILER_KFD_QUEUE_EVICT_TTM, ///< TTM move buffer
151 ROCPROFILER_KFD_QUEUE_EVICT_SUSPEND, ///< GPU suspend
152 ROCPROFILER_KFD_QUEUE_EVICT_CRIU_CHECKPOINT, ///< Queues evicted due to process checkpoint by
153 ///< CRIU
154 ROCPROFILER_KFD_QUEUE_EVICT_CRIU_RESTORE, ///< Queues restored during process restore by CRIU
155
156 ROCPROFILER_KFD_QUEUE_LAST,
157} rocprofiler_kfd_queue_operation_t;
158
159ROCPROFILER_EXTERN_C_FINI