@@ -24,80 +24,99 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
24
25
25
======================= end_copyright_notice ==================================*/
26
26
27
- #ifndef _GPTIN_DRIVER_COMMON_
28
- #define _GPTIN_DRIVER_COMMON_
27
+ #ifndef GPTIN_DRIVER_COMMON_H
28
+ #define GPTIN_DRIVER_COMMON_H
29
29
30
30
#include < stdint.h>
31
31
32
32
#ifdef _WIN32
33
- #define GTPIN_DRIVER_CALLCONV __fastcall
33
+ #define GTPIN_DRIVER_CALLCONV __fastcall
34
34
#else
35
- #define GTPIN_DRIVER_CALLCONV
35
+ #define GTPIN_DRIVER_CALLCONV
36
36
#endif
37
37
38
38
/* ***********************************************************************/
39
39
/* Data Types */
40
40
/* ***********************************************************************/
41
41
namespace gtpin
42
42
{
43
+ // / GTPin <-> Driver interface version
43
44
44
- // GTPin <-> Driver interface version
45
+ static const uint16_t GTPIN_COMMON_INTERFACE_VERSION = 6 ;
45
46
46
- static const uint16_t GTPIN_COMMON_INTERFACE_VERSION = 3 ;
47
47
48
- /*
48
+ /* !
49
49
* Common Interface Changelog:
50
+ * 6. Added back context_handle_t for backward compatibility
51
+ * 5. Added driver interface
52
+ * 4. Removed GenerateDriverInterfaceVersion function
50
53
* 3. Added command_buffer_handle_s for OpenCL support
51
54
* 2. Added GTPIN_DRIVER_CALLCONV
52
55
* 1. First introduction of GTPIN_COMMON_INTERFACE_VERSION, addition of debug_data,
53
56
* 0. Not supported
54
57
*/
55
58
56
- typedef struct resource_handle_s * resource_handle_t ; // driver's handle to the resource
57
- typedef struct context_handle_s * context_handle_t ; // driver's handle to the context/device
58
- typedef struct command_buffer_handle_s * command_buffer_handle_t ; // driver's handle to the command buffer
59
- typedef struct igc_init_s igc_init_t ; // info passed by IGC
60
- typedef struct igc_info_s igc_info_t ; // info passed by IGC
59
+
60
+ typedef struct resource_handle_s * resource_handle_t ; // / driver's handle to the resource
61
+ typedef struct device_handle_s * device_handle_t ; // / driver's handle to the device
62
+ typedef device_handle_t context_handle_t ; // / for backward compatibility
63
+ typedef struct igc_init_s igc_init_t ; // / info passed by IGC
64
+ typedef struct igc_info_s igc_info_t ; // / info passed by IGC
65
+
61
66
62
67
typedef struct interface_version_s
63
68
{
64
69
uint16_t specific;
65
70
uint16_t common;
66
71
} interface_version_t ;
67
72
73
+
68
74
/* *
69
- Gen Version
70
- */
75
+ * Gen Version
76
+ */
71
77
typedef enum
72
78
{
73
79
GTPIN_GEN_INVALID,
74
80
GTPIN_GEN_8,
75
81
GTPIN_GEN_9,
76
82
GTPIN_GEN_10,
77
- GTPIN_GEN_11
83
+ GTPIN_GEN_11,
78
84
} GTPIN_GEN_VERSION;
79
85
86
+
87
+ /* !
88
+ * Possible results of GTPin driver interface functions
89
+ */
80
90
typedef enum
81
91
{
82
- GTPIN_DI_SUCCESS = 0 ,
83
- GTPIN_DI_ERROR_INVALID_ARGUMENT,
84
- GTPIN_DI_ERROR_NO_INSTANCE, // no instance of GTPin inside the driver
85
- GTPIN_DI_ERROR_INSTANCE_ALREADY_CREATED, // GTPin was already initialized in the driver
86
- GTPIN_DI_ERROR_ALLOCATION_FAILED, // failed to allocate a buffer
87
- GTPIN_DI_ERROR_NO_VIRTUAL_ADDRESS_TO_BUFFER, // failed to obtain virtual address to the buffer
92
+ GTPIN_DI_SUCCESS = 0 , // / operation is successful
93
+ GTPIN_DI_ERROR_INVALID_ARGUMENT, // / one of the arguments is invalid (null)
94
+ GTPIN_DI_ERROR_NO_INSTANCE, // / no instance of GTPin inside the driver
95
+ GTPIN_DI_ERROR_INSTANCE_ALREADY_CREATED, // / GTPin was already initialized in the driver
96
+ GTPIN_DI_ERROR_ALLOCATION_FAILED, // / failed to allocate a buffer
97
+ GTPIN_DI_ERROR_NO_VIRTUAL_ADDRESS_TO_BUFFER, // / failed to obtain virtual address to the buffer
98
+ GTPIN_DI_FAIL, // / general failure
88
99
} GTPIN_DI_STATUS;
89
100
101
+
102
+ /* !
103
+ * Kernel types
104
+ */
90
105
typedef enum
91
106
{
92
107
GTPIN_KERNEL_TYPE_INVALID,
93
- GTPIN_KERNEL_TYPE_HS, // Hull Shader
94
- GTPIN_KERNEL_TYPE_DS, // Domain Shader
95
- GTPIN_KERNEL_TYPE_VS, // Vertex Shader
96
- GTPIN_KERNEL_TYPE_PS, // Pixel Shader
97
- GTPIN_KERNEL_TYPE_CS, // Compute Shader (GPGPU)
98
- GTPIN_KERNEL_TYPE_GS // Geometry Shader
108
+ GTPIN_KERNEL_TYPE_HS, / / / Hull Shader
109
+ GTPIN_KERNEL_TYPE_DS, / / / Domain Shader
110
+ GTPIN_KERNEL_TYPE_VS, / / / Vertex Shader
111
+ GTPIN_KERNEL_TYPE_PS, / / / Pixel Shader
112
+ GTPIN_KERNEL_TYPE_CS, / / / Compute Shader (GPGPU)
113
+ GTPIN_KERNEL_TYPE_GS / / / Geometry Shader
99
114
} GTPIN_KERNEL_TYPE;
100
115
116
+
117
+ /* !
118
+ * SIMD widths
119
+ */
101
120
typedef enum
102
121
{
103
122
GTPIN_SIMD_INVALID,
@@ -108,143 +127,35 @@ typedef enum
108
127
} GTPIN_SIMD_WIDTH;
109
128
110
129
111
- /* *
112
- Resource addressing mode
113
- */
130
+ /* !
131
+ * GPU interfaces
132
+ */
114
133
typedef enum
115
134
{
116
- GTPIN_BUFFER_BINDFULL, // using binding table index
117
- GTPIN_BUFFER_BINDLESS, // using an offset to the surface table in a register
118
- GTPIN_BUFFER_STATELESS, // using an address to the resource in a register
119
- } GTPIN_BUFFER_TYPE;
135
+ GFX_OPENCL,
136
+ GFX_CM,
137
+ } GFX_TARGET;
120
138
121
- /* *
122
- Platform info structure
123
- */
139
+
140
+ /* !
141
+ * Platform information
142
+ */
124
143
typedef struct platform_info_s
125
144
{
126
- GTPIN_GEN_VERSION gen_version;
145
+ GTPIN_GEN_VERSION gen_version; // / should match KMD definition
127
146
uint32_t device_id;
128
-
129
147
} platform_info_t ;
130
148
131
- /* *
132
- The offest of the register in the GRF.
133
- e.g. r2.5(dw) will be represented as 2*256 + 5*4
134
- */
135
- typedef struct reg_desc_s
136
- {
137
- uint32_t reg_offset; // the location of the register in the GRF (in bytes)
138
- uint32_t size; // size of the register in bytes
139
- } reg_desc_t ;
140
-
141
- /* *
142
- Buffer's descriptor - could be:
143
- 1. BTI - binding table index (in bindfull buffer addressing)
144
- 2. register (in bindless / stateless buffer addressing)
145
- */
146
- typedef union buffer_desc_s
147
- {
148
- uint32_t BTI;
149
- reg_desc_t reg_desc;
150
- } buffer_desc_t ;
151
-
152
-
153
- /* *
154
- kernel instrumentation parameters structure:
155
- */
156
- typedef struct instrument_params_s
157
- {
158
- GTPIN_KERNEL_TYPE kernel_type;
159
- GTPIN_SIMD_WIDTH simd;
160
- const uint8_t * orig_kernel_binary; // the original kernel binary
161
- uint32_t orig_kernel_size; // size of the kernel binary in bytes
162
-
163
- GTPIN_BUFFER_TYPE buffer_type;
164
- buffer_desc_t buffer_desc;
165
- uint64_t igc_hash_id;
166
-
167
- char * kernel_name; // the kernel name
168
- const igc_info_t * igc_info; // information form IGC
169
-
170
- // START Exists only from COMMON_SUPPORTED_FEATURE_SOURCELINE_MAPPING
171
- const void * debug_data; // debug data including the elf file
172
- uint32_t debug_data_size; // size of the elf file in bytes
173
- // End Exists only from COMMON_SUPPORTED_FEATURE_SOURCELINE_MAPPING
174
- } instrument_params_in_t ;
175
149
176
-
177
- /* *
178
- kernel instrumented data structure:
179
- */
180
- typedef struct instrument_params_out_s
181
- {
182
- uint8_t * inst_kernel_binary; // the instrumented binary
183
- uint32_t inst_kernel_size; // size in bytes on the instrumented binary
184
- uint64_t kernel_id; // GTPin's associated kernel id
185
- } instrument_params_out_t ;
186
-
187
-
188
- /* *
189
- Allocate a buffer(resource) for GTPin
190
-
191
- Params:
192
- (in) context - The handle to the context
193
- (in) size - Size of the buffer to allocate
194
- (out) resource - The handle to the created resource
195
- */
196
- typedef GTPIN_DI_STATUS (GTPIN_DRIVER_CALLCONV *BufferAllocateFPTR)(context_handle_t context, uint32_t size, resource_handle_t * resource);
197
-
198
- /* *
199
- Deallocate GTPin's buffer
200
-
201
- Params:
202
- (in) context - The handle to the context
203
- (in) resource - The handle to the resource
204
- */
205
- typedef GTPIN_DI_STATUS (GTPIN_DRIVER_CALLCONV *BufferDeallocateFPTR)(context_handle_t context, resource_handle_t resource);
206
-
207
- /* *
208
- Map GTPin's buffer to obtain the virtual address
209
- Params:
210
-
211
- (in) context - The handle to the context
212
- (in) resource - The handle to the resource
213
- (out) address - The virtual address of the resource
214
-
215
- */
216
- typedef GTPIN_DI_STATUS (GTPIN_DRIVER_CALLCONV *BufferMapFPTR)(context_handle_t context, resource_handle_t resource, uint8_t ** address);
217
-
218
- /* *
219
- UnMap GTPin's allocated buffer
220
-
221
- Params:
222
- (in) context - The handle to the context
223
- (in) resource - The handle to the resource
224
-
225
- */
226
- typedef GTPIN_DI_STATUS (GTPIN_DRIVER_CALLCONV *BufferUnMapFPTR)(context_handle_t context, resource_handle_t resource);
227
-
228
-
229
- /* ***********************************************************************/
230
- /* Services (GTPin -> Driver) */
231
- /* The following functions are implemented by the driver */
232
- /* and called by GTPin */
233
- /* ***********************************************************************/
234
-
235
- typedef struct driver_services_s
150
+ /* !
151
+ * Driver information
152
+ */
153
+ typedef struct driver_info_s
236
154
{
237
- BufferAllocateFPTR bufferAllocate; // request the Driver to allocate a buffer
238
- BufferDeallocateFPTR bufferDeallocate; // request the Driver to de-allocate a buffer
239
- BufferMapFPTR bufferMap; // request the Driver to map a buffer
240
- BufferUnMapFPTR bufferUnMap; // request the Driver to unmap a buffer
155
+ interface_version_t version; // / interface version supported by the driver
156
+ GFX_TARGET gfx_target;
157
+ } driver_info_t ;
241
158
242
- } driver_services_t ;
243
159
244
- inline uint32_t GenerateDriverInterfaceVersion (uint16_t common_version, uint16_t specific_version)
245
- {
246
- return (common_version << 16 ) | specific_version;
247
160
}
248
-
249
- }
250
- #endif
161
+ #endif // / GPTIN_DRIVER_COMMON_H
0 commit comments