forked from GPUOpen-Tools/gpu_performance_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpu_perf_api_stub.h
324 lines (251 loc) · 8.55 KB
/
gpu_perf_api_stub.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
//==============================================================================
// Copyright (c) 2018-2020 Advanced Micro Devices, Inc. All rights reserved.
/// \author AMD Developer Tools Team
/// \file
/// \brief GPA Stub entry points
//==============================================================================
#ifndef _GPUPERFAPI_STUB_H_
#define _GPUPERFAPI_STUB_H_
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable : 4100)
#endif
#include <string.h>
#define RETURN_GPA_SUCCESS return GPA_STATUS_OK
// Logging
static inline GPA_Status GPA_RegisterLoggingCallback(GPA_Logging_Type loggingType, GPA_LoggingCallbackPtrType pCallbackFuncPtr)
{
RETURN_GPA_SUCCESS;
}
// Init / Destroy GPA
static inline GPA_Status GPA_Initialize(GPA_InitializeFlags flags)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_Destroy()
{
RETURN_GPA_SUCCESS;
}
// Context Startup / Finish
static inline GPA_Status GPA_OpenContext(void* pContext, GPA_OpenContextFlags flags, GPA_ContextId* pContextId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_CloseContext(GPA_ContextId contextId)
{
RETURN_GPA_SUCCESS;
}
// Context Interrogation
static inline GPA_Status GPA_GetSupportedSampleTypes(GPA_ContextId contextId, GPA_ContextSampleTypeFlags* pSampleTypes)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetDeviceAndRevisionId(GPA_ContextId contextId, gpa_uint32* pDeviceId, gpa_uint32* pRevisionId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetDeviceName(GPA_ContextId contextId, const char** ppDeviceName)
{
RETURN_GPA_SUCCESS;
}
// Counter Interrogation
static inline GPA_Status GPA_GetNumCounters(GPA_ContextId contextId, gpa_uint32* pCount)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetCounterName(GPA_ContextId contextId, gpa_uint32 index, const char** ppName)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetCounterIndex(GPA_ContextId contextId, const char* pCounterName, gpa_uint32* pIndex)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetCounterGroup(GPA_ContextId contextId, gpa_uint32 index, const char** ppGroup)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetCounterDescription(GPA_ContextId contextId, gpa_uint32 index, const char** ppDescription)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetCounterDataType(GPA_ContextId contextId, gpa_uint32 index, GPA_Data_Type* pCounterDataType)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetCounterUsageType(GPA_ContextId contextId, gpa_uint32 index, GPA_Usage_Type* pCounterUsageType)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetCounterUuid(GPA_ContextId contextId, gpa_uint32 index, GPA_UUID* pCounterUuid)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetCounterSampleType(GPA_ContextId contextId, gpa_uint32 index, GPA_Counter_Sample_Type* pCounterSampleType)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetDataTypeAsStr(GPA_Data_Type counterDataType, const char** ppTypeStr)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetUsageTypeAsStr(GPA_Usage_Type counterUsageType, const char** ppUsageTypeStr)
{
RETURN_GPA_SUCCESS;
}
// Session handling
static inline GPA_Status GPA_CreateSession(GPA_ContextId contextId, GPA_Session_Sample_Type sampleType, GPA_SessionId* pSessionId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_DeleteSession(GPA_SessionId sessionId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_BeginSession(GPA_SessionId sessionId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_EndSession(GPA_SessionId sessionId)
{
RETURN_GPA_SUCCESS;
}
// Counter Scheduling
static inline GPA_Status GPA_EnableCounter(GPA_SessionId sessionId, gpa_uint32 index)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_DisableCounter(GPA_SessionId sessionId, gpa_uint32 index)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_EnableCounterByName(GPA_SessionId sessionId, const char* pCounterName)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_DisableCounterByName(GPA_SessionId sessionId, const char* pCounterName)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_EnableAllCounters(GPA_SessionId sessionId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_DisableAllCounters(GPA_SessionId sessionId)
{
RETURN_GPA_SUCCESS;
}
// Query Counter Scheduling
static inline GPA_Status GPA_GetPassCount(GPA_SessionId sessionId, gpa_uint32* pNumPasses)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetNumEnabledCounters(GPA_SessionId sessionId, gpa_uint32* pCount)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetEnabledIndex(GPA_SessionId sessionId, gpa_uint32 enabledNumber, gpa_uint32* pEnabledCounterIndex)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_IsCounterEnabled(GPA_SessionId sessionId, gpa_uint32 counterIndex)
{
RETURN_GPA_SUCCESS;
}
// Sample Handling
static inline GPA_Status GPA_BeginCommandList(GPA_SessionId sessionId,
gpa_uint32 passIndex,
void* pCommandList,
GPA_Command_List_Type commandListType,
GPA_CommandListId* pCommandListId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_EndCommandList(GPA_CommandListId commandListId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_BeginSample(gpa_uint32 sampleId, GPA_CommandListId commandListId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_EndSample(GPA_CommandListId commandListId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_ContinueSampleOnCommandList(gpa_uint32 srcSampleId, GPA_CommandListId primaryCommandListId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_CopySecondarySamples(GPA_CommandListId secondaryCommandListId,
GPA_CommandListId primaryCommandListId,
gpa_uint32 numSamples,
gpa_uint32* pNewSampleIds)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetSampleCount(GPA_SessionId sessionId, gpa_uint32* pSampleCount)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetSampleId(GPA_SessionId sessionId, gpa_uint32 index, gpa_uint32* pSampleId)
{
RETURN_GPA_SUCCESS;
}
// Query Results
static inline GPA_Status GPA_IsPassComplete(GPA_SessionId sessionId, gpa_uint32 passIndex)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_IsSessionComplete(GPA_SessionId sessionId)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetSampleResultSize(GPA_SessionId sessionId, gpa_uint32 sampleId, size_t* sampleResultSizeInBytes)
{
RETURN_GPA_SUCCESS;
}
static inline GPA_Status GPA_GetSampleResult(GPA_SessionId sessionId, gpa_uint32 sampleId, size_t sampleResultSizeInBytes, void* pCounterSampleResults)
{
RETURN_GPA_SUCCESS;
}
// Status / Error Query
static inline const char* GPA_GetStatusAsStr(GPA_Status status)
{
return NULL;
}
// GPA API Version
static inline GPA_Status GPA_GetVersion(gpa_uint32* pMajorVersion, gpa_uint32* pMinorVersion, gpa_uint32* pBuild, gpa_uint32* pUpdateVersion)
{
RETURN_GPA_SUCCESS;
}
// GPA API Table
static inline GPA_Status GPA_GetFuncTable(void* pGPAFuncTable)
{
// All of the GPA functions will reside in user memory as this structure will be compiled along with the user code.
// Fill the function table with the function in user memory.
GPAFunctionTable* pLocalFuncTable = (GPAFunctionTable*)(pGPAFuncTable);
gpa_uint32 majorVersion = GPA_FUNCTION_TABLE_MAJOR_VERSION_NUMBER;
gpa_uint32 correctMajorVersion = (majorVersion == pLocalFuncTable->m_majorVer ? 1 : 0);
gpa_uint32 clientSuppliedMinorVer = pLocalFuncTable->m_minorVer;
pLocalFuncTable->m_majorVer = GPA_FUNCTION_TABLE_MAJOR_VERSION_NUMBER;
pLocalFuncTable->m_minorVer = GPA_FUNCTION_TABLE_MINOR_VERSION_NUMBER;
if (!correctMajorVersion)
{
return GPA_STATUS_ERROR_LIB_LOAD_MAJOR_VERSION_MISMATCH;
}
if (clientSuppliedMinorVer > GPA_FUNCTION_TABLE_MINOR_VERSION_NUMBER)
{
return GPA_STATUS_ERROR_LIB_LOAD_MINOR_VERSION_MISMATCH;
}
GPAFunctionTable localFuncTable;
#define GPA_FUNCTION_PREFIX(func) localFuncTable.func = func; ///< Macro used by GPAFunctions.h
#include "GPAFunctions.h"
#undef GPA_FUNCTION_PREFIX
memcpy(pGPAFuncTable, &localFuncTable, clientSuppliedMinorVer);
return GPA_STATUS_OK;
}
#ifdef _WIN32
#pragma warning(pop)
#endif
#endif // _GPUPERFAPI_STUB_H_