-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAmdDxExtPerfProfileApi.h
279 lines (216 loc) · 9.1 KB
/
AmdDxExtPerfProfileApi.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
/*
***************************************************************************************************
*
* Copyright (c) 2011-2016 Advanced Micro Devices, Inc. All rights reserved.
*
***************************************************************************************************
*/
/**
***************************************************************************************************
* @file amddxextperfprofileapi.h
* @brief
* AMD D3D Perf Profile Exension API include file.
* This is the main include file for apps using perf profile extension.
***************************************************************************************************
*/
#ifndef _AMDDXEXTPERFPROFILEAPI_H_
#define _AMDDXEXTPERFPROFILEAPI_H_
#include "AmdDxExtApi.h"
#include "AmdDxExtIface.h"
#include "AmdDxExtPerfProfile.h"
// Perf Profile extension ID passed to IAmdDxExt::GetExtInterface()
const unsigned int AmdDxExtPerfProfileID = 8;
class IAmdDxExtPerfExperiment;
class IAmdDxExtDriverStats;
/**
***************************************************************************************************
* @brief Abstract perf profile extension interface class
***************************************************************************************************
*/
class IAmdDxExtPerfProfile : public IAmdDxExtInterface
{
public:
// Get information about feature support and HW capabilities.
virtual PE_RESULT GetGpuCaps(UINT gpuId, PE_CAPS_INFO* pCaps) = 0;
// Get information about profiling counter for a particular HW block.
virtual PE_RESULT GetBlockCounterInfo(UINT gpuId, PE_BLOCK_ID block,
PE_BLOCK_COUNTER_INFO* pBlockInfo) = 0;
/// Create empty performance experiment container.
virtual IAmdDxExtPerfExperiment* CreateExperiment() = 0;
// Get driver stats container.
virtual IAmdDxExtDriverStats* GetDriverStats(UINT gpuId) = 0;
/// Performance experiment container for CFX support
virtual IAmdDxExtPerfExperiment* CreateExperimentEx(UINT gpuId) = 0;
// Test if performance experiments can be performed on the given GPU
virtual PE_RESULT IsGpuProfileable(UINT gpuId, BOOL* pProfileable) = 0;
// Set the clock mode to the input type and return the current clock rates
virtual PE_RESULT SetClockMode(PE_CLOCK_MODE mode, PE_SET_CLOCK_MODE_OUTPUT* pOutput) = 0;
};
/**
***************************************************************************************************
* @brief Abstract perf profile extension perf counter interface class
***************************************************************************************************
*/
class IAmdDxExtPerfCounter
{
public:
// Set summary counter parameter.
virtual PE_RESULT SetParam(PE_COUNTER_PARAM param, UINT data) = 0;
// Get summary counter data.
virtual UINT64 GetData() = 0;
// Basic constructor
IAmdDxExtPerfCounter() {};
virtual ~IAmdDxExtPerfCounter() = 0 {};
};
/**
***************************************************************************************************
* @brief Abstract perf profile extension trace counter interface class
***************************************************************************************************
*/
class IAmdDxExtTraceCounter
{
public:
// Set trace counter parameter.
virtual PE_RESULT SetParam(PE_COUNTER_PARAM param, UINT data) = 0;
// Get trace counter slot.
virtual UINT GetSlotMapping() = 0;
// Basic constructor
IAmdDxExtTraceCounter() {};
virtual ~IAmdDxExtTraceCounter() = 0 {};
};
/**
***************************************************************************************************
* @brief Abstract perf profile extension trace counter interface class
***************************************************************************************************
*/
class IAmdDxExtStreamingCounter
{
public:
// Set trace counter parameter.
virtual PE_RESULT SetParam(PE_COUNTER_PARAM param, UINT data) = 0;
// Get trace counter slot.
virtual UINT GetSlotMapping() = 0;
// Basic constructor
IAmdDxExtStreamingCounter() {};
virtual ~IAmdDxExtStreamingCounter() = 0 {};
};
/**
***************************************************************************************************
* @brief Abstract perf profile extension trace base interface class
***************************************************************************************************
*/
class IAmdDxExtTrace
{
public:
// Set trace buffer parameter.
virtual PE_RESULT SetBufferParam(PE_TRACE_BUFFER_PARAM param, UINT data) = 0;
// Get number of trace buffers which have completed collecting data.
virtual UINT GetCollectedBufferCount() = 0;
// Lock trace buffer to access trace data.
virtual PE_RESULT Lock(UINT bufferId, PE_BUFFER_LOCK_DATA* pLockData) = 0;
// Unlock trace buffer.
virtual void Unlock(UINT bufferId) = 0;
// Basic constructor
IAmdDxExtTrace() {};
virtual ~IAmdDxExtTrace() = 0 {};
};
/**
***************************************************************************************************
* @brief Abstract perf profile extension thread trace interface class
***************************************************************************************************
*/
class IAmdDxExtThreadTrace : public IAmdDxExtTrace
{
public:
// Set thread trace parameter.
virtual PE_RESULT SetParam(PE_THREAD_TRACE_PARAM param, UINT data) = 0;
// Add a trace counter to the thread trace.
virtual PE_RESULT AddCounter(UINT eventId, IAmdDxExtTraceCounter** ppCounter) = 0;
// Basic constructor
IAmdDxExtThreadTrace() {};
virtual ~IAmdDxExtThreadTrace() = 0 {};
// Method to get maximum allocated buffer size for thread trace buffer
virtual unsigned long long GetMaxThreadTraceBufferSize() = 0;
};
/**
***************************************************************************************************
* @brief Abstract perf profile extension counter stream trace interface class
***************************************************************************************************
*/
class IAmdDxExtCounterStreamTrace : public IAmdDxExtTrace
{
public:
// Set counter stream trace parameter.
virtual PE_RESULT SetParam(PE_COUNTER_TRACE_PARAM param, UINT data) = 0;
// Add a trace counter to the counter stream trace.
virtual PE_RESULT AddCounter(PE_BLOCK_ID block, UINT instanceId, UINT eventId,
IAmdDxExtStreamingCounter** ppCounter) = 0;
// Get the number of bytes of data per output cycle.
virtual UINT GetByteStride() = 0;
// Basic constructor
IAmdDxExtCounterStreamTrace() {};
virtual ~IAmdDxExtCounterStreamTrace() = 0 {};
};
/**
***************************************************************************************************
* @brief Abstract perf profile extension experiment container interface class
***************************************************************************************************
*/
class IAmdDxExtPerfExperiment
{
public:
// Set experiment parameters
virtual PE_RESULT SetParam(PE_EXPERIMENT_PARAM param, UINT data) = 0;
// Set per engine parameters
virtual PE_RESULT SetEngineParam(UINT engineId, PE_ENGINE_PARAM param, UINT data) = 0;
// Add trace to experiment
virtual PE_RESULT AddTrace(UINT engineId, PE_TRACE_TYPE traceType,
IAmdDxExtTrace** ppTrace) = 0;
// Add counter to experiment
virtual PE_RESULT AddCounter(PE_BLOCK_ID blockId, UINT instanceId, UINT eventId,
IAmdDxExtPerfCounter** ppCounter) = 0;
// Build and finalize experiment
virtual PE_RESULT Finalize() = 0;
// Run experiment
virtual PE_RESULT Begin() = 0;
// Stop experiment
virtual void End() = 0;
// Insert data into thread traces.
virtual PE_RESULT InsertData(PE_TRACE_MARKER_DATA_TYPE param, UINT data) = 0;
// Waits for the experiment completion
virtual BOOL WaitCompletion(UINT milliseconds) = 0;
// Sync with MT worker thread and check how many CB submits ocurred
virtual UINT GetSubmitCount() = 0;
// Free internal experiment resources
virtual void ReleaseResources() = 0;
// Destroy experiment
virtual void Destroy() = 0;
// Basic constructor
IAmdDxExtPerfExperiment() {};
virtual ~IAmdDxExtPerfExperiment() = 0 {};
// Insert thread trace markers.
virtual void InsertThreadTraceMarker() = 0;
// Get the count of shader engine
virtual unsigned int GetNumShaderEngines() = 0;
};
/**
***************************************************************************************************
* @brief Abstract perf profile extension driver statistics interface class
***************************************************************************************************
*/
class IAmdDxExtDriverStats
{
public:
// Start counting driver profiling events
virtual void Begin() = 0;
// Start counting driver profiling events
virtual void End() = 0;
// Reset statistics
virtual void Reset() = 0;
// Get statistics for the driver event
virtual PE_RESULT GetEventData(PE_DRIVER_COUNTER counterId, UINT64* pData) = 0;
// Basic constructor
IAmdDxExtDriverStats() {};
virtual ~IAmdDxExtDriverStats() = 0 {};
};
#endif // _AMDDXEXTPERFPROFILEAPI_H_