File: gtpin_ocl_interface.h

package info (click to toggle)
intel-graphics-compiler2 2.18.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 107,080 kB
  • sloc: cpp: 807,289; lisp: 287,855; ansic: 16,414; python: 4,004; yacc: 2,588; lex: 1,666; pascal: 313; sh: 186; makefile: 35
file content (140 lines) | stat: -rw-r--r-- 5,003 bytes parent folder | download
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
/*========================== begin_copyright_notice ============================

Copyright (C) 2018-2021 Intel Corporation

SPDX-License-Identifier: MIT

============================= end_copyright_notice ===========================*/

#ifndef _GPTIN_OCL_INTERFACE_
#define _GPTIN_OCL_INTERFACE_

#include <stdint.h>
#include "gtpin_driver_common_bti.h"

namespace gtpin {
namespace ocl {
/*!
 * GTPin <-> OpenCL Driver Interface Changelog:
 * 2. File reordering
 * 1. IGC info added
 * 0. Official release of OpenCL support
 */
// GTPin <-> OpenCL driver interface version
static const uint8_t GTPIN_OCL_INTERNAL_INTERFACE_VERSION = 2; /// GTPIN INTERNAL VALUE
static const uint16_t GTPIN_OCL_INTERFACE_VERSION = GENERATE_SPECIFIC_VERSION(GTPIN_OCL_INTERNAL_INTERFACE_VERSION);

/************************************************************************/
/* General Comments:
1.   All memory management is done by the caller.
The callee should not make any assumptions about the availability
of the data out side the scope of the call.
The callee must copy all data that will be used out side
the scope of the call.
*/
/************************************************************************/

/************************************************************************/
/* Events (Driver -> GTPin)                                             */
/* The following functions are implemented by GTPin                     */
/* and called by the driver                                             */
/************************************************************************/

/**
Called up on a creation of a new Device by the application

Params:
(in)  context       - The context created.
(in)  platform_info - information about the platform
(out) igc_init      - IGC's initialization data
*/
typedef void (*OnContextCreateFPTR)(device_handle_t handle, platform_info_t *platform_info, igc_init_t **igc_init);

/**
Called up on a destruction of the device

Params:
(in) context - The context been destroyed.
**/
typedef void (*OnContextDestroyFPTR)(device_handle_t handle);

/**
Called on up the creation of a new shader by the application

Params:
(in) context        -  The handle of the context
(in)  params_in     -  All instrumentation parameters needed for GTPin's instrumentation
(out) params_out    -  GTPin's instrumentation artifacts
**/
typedef void (*OnKernelCreateFPTR)(device_handle_t handle, const instrument_params_in_t *params_in,
                                   instrument_params_out_t *params_out);

/**
Called up on applications call to the EnqueueNDRange API.
The driver shall call this function for each shader in the pipeline (PS, VS, ...)
and is submitted into the command buffer

Params:
(in)  cb            -  Driver's internal command buffer handle
(in)  kernel_id     -  Kernel's id as assigned by GTPin in KernelCreate function
(out) entry_offset  -  The entry point in the binary relative to the first instruction
(out) resource      -  GTPin's resource for this kernel
**/
typedef void (*OnKernelSubmitFPTR)(command_buffer_handle_t cb, uint64_t kernel_id, uint32_t *entry_offset,
                                   resource_handle_t *resource);

/**
Called up on the creation of driver's internal command buffer

Params:
(in) context -  The handle of the context
(in) cb      -  Driver's internal command buffer handle
**/
typedef void (*OnCommandBufferCreateFPTR)(device_handle_t handle, command_buffer_handle_t cb);

/**
Called up on the submissions for execution driver's internal command buffer

Params:
(in) cb         -  Driver's internal command buffer handle
(out) resource  -  GTPin's resource for polling on to identify command buffer completion
**/
typedef void (*OnCommandBufferCompleteFPTR)(command_buffer_handle_t cb);

/**
Event structure:
Holds the pointers for functions implemented by GTPin.
Those function will be called by the Driver upon a corresponding events.
*/
typedef struct gtpin_events_s {
  OnContextCreateFPTR onContextCreate;
  OnContextDestroyFPTR onContextDestroy;
  OnKernelCreateFPTR onKernelCreate;
  OnKernelSubmitFPTR onKernelSubmit;
  OnCommandBufferCreateFPTR onCommandBufferCreate;
  OnCommandBufferCompleteFPTR onCommandBufferComplete;

} gtpin_events_t;

/**
Initialize GTPin events and driver services structures
This is the entry point into the driver for GTPin and used for the handshake.

This function must be:
1. implemented with the name of GTPin_Init
2. exported and visible outside the driver's image
3. un-mangled with extern "C"

Params:
(in)   gtpin_events     - GTPin's events functions callbacks (if NULL ignored)
(out) driver_services   - Driver's services function callbacks (if NULL ignored)
(out) driver_version    - Driver's version of the interface (if NULL ignored)
*/

// extern "C"
// GTPIN_DI_STATUS GTPin_Init(gtpin::ocl::gtpin_events_t* gtpin_events, driver_services_t* driver_services,
//                            interface_version_t* driver_version);

} // namespace ocl
} // namespace gtpin
#endif