Skip to content

Commit ad8099d

Browse files
committed
Adding latest updates for gtpin headers
Change-Id: I75a5047e031e16cf96a5e9b067c39e912a804ae8
1 parent c46144a commit ad8099d

File tree

3 files changed

+250
-161
lines changed

3 files changed

+250
-161
lines changed

IGC/AdaptorOCL/ocl_igc_shared/gtpin/gtpin_driver_common.h

Lines changed: 65 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -24,80 +24,99 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424
2525
======================= end_copyright_notice ==================================*/
2626

27-
#ifndef _GPTIN_DRIVER_COMMON_
28-
#define _GPTIN_DRIVER_COMMON_
27+
#ifndef GPTIN_DRIVER_COMMON_H
28+
#define GPTIN_DRIVER_COMMON_H
2929

3030
#include <stdint.h>
3131

3232
#ifdef _WIN32
33-
#define GTPIN_DRIVER_CALLCONV __fastcall
33+
#define GTPIN_DRIVER_CALLCONV __fastcall
3434
#else
35-
#define GTPIN_DRIVER_CALLCONV
35+
#define GTPIN_DRIVER_CALLCONV
3636
#endif
3737

3838
/************************************************************************/
3939
/* Data Types */
4040
/************************************************************************/
4141
namespace gtpin
4242
{
43+
/// GTPin <-> Driver interface version
4344

44-
// GTPin <-> Driver interface version
45+
static const uint16_t GTPIN_COMMON_INTERFACE_VERSION = 6;
4546

46-
static const uint16_t GTPIN_COMMON_INTERFACE_VERSION = 3;
4747

48-
/*
48+
/*!
4949
* Common Interface Changelog:
50+
* 6. Added back context_handle_t for backward compatibility
51+
* 5. Added driver interface
52+
* 4. Removed GenerateDriverInterfaceVersion function
5053
* 3. Added command_buffer_handle_s for OpenCL support
5154
* 2. Added GTPIN_DRIVER_CALLCONV
5255
* 1. First introduction of GTPIN_COMMON_INTERFACE_VERSION, addition of debug_data,
5356
* 0. Not supported
5457
*/
5558

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+
6166

6267
typedef struct interface_version_s
6368
{
6469
uint16_t specific;
6570
uint16_t common;
6671
} interface_version_t;
6772

73+
6874
/**
69-
Gen Version
70-
*/
75+
* Gen Version
76+
*/
7177
typedef enum
7278
{
7379
GTPIN_GEN_INVALID,
7480
GTPIN_GEN_8,
7581
GTPIN_GEN_9,
7682
GTPIN_GEN_10,
77-
GTPIN_GEN_11
83+
GTPIN_GEN_11,
7884
} GTPIN_GEN_VERSION;
7985

86+
87+
/*!
88+
* Possible results of GTPin driver interface functions
89+
*/
8090
typedef enum
8191
{
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
8899
} GTPIN_DI_STATUS;
89100

101+
102+
/*!
103+
* Kernel types
104+
*/
90105
typedef enum
91106
{
92107
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
99114
} GTPIN_KERNEL_TYPE;
100115

116+
117+
/*!
118+
* SIMD widths
119+
*/
101120
typedef enum
102121
{
103122
GTPIN_SIMD_INVALID,
@@ -108,143 +127,35 @@ typedef enum
108127
} GTPIN_SIMD_WIDTH;
109128

110129

111-
/**
112-
Resource addressing mode
113-
*/
130+
/*!
131+
* GPU interfaces
132+
*/
114133
typedef enum
115134
{
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;
120138

121-
/**
122-
Platform info structure
123-
*/
139+
140+
/*!
141+
* Platform information
142+
*/
124143
typedef struct platform_info_s
125144
{
126-
GTPIN_GEN_VERSION gen_version;
145+
GTPIN_GEN_VERSION gen_version; /// should match KMD definition
127146
uint32_t device_id;
128-
129147
} platform_info_t;
130148

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;
175149

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
236154
{
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;
241158

242-
} driver_services_t;
243159

244-
inline uint32_t GenerateDriverInterfaceVersion(uint16_t common_version, uint16_t specific_version)
245-
{
246-
return (common_version << 16) | specific_version;
247160
}
248-
249-
}
250-
#endif
161+
#endif /// GPTIN_DRIVER_COMMON_H

0 commit comments

Comments
 (0)