Debian Codegraph @

IGC/AdaptorOCL/ocl_igc_shared/gtpin/gtpin_ocl_interface.h

raw
1 /*========================== begin_copyright_notice ============================
2
3 Copyright (C) 2018-2021 Intel Corporation
4
5 SPDX-License-Identifier: MIT
6
7 ============================= end_copyright_notice ===========================*/
8
9 #ifndef _GPTIN_OCL_INTERFACE_
10 #define _GPTIN_OCL_INTERFACE_
11
12 #include <stdint.h>
13 #include "gtpin_driver_common_bti.h"
14
15 namespace gtpin
16 {
17 namespace ocl
18 {
19 /*!
20 * GTPin <-> OpenCL Driver Interface Changelog:
21 * 2. File reordering
22 * 1. IGC info added
23 * 0. Official release of OpenCL support
24 */
25 // GTPin <-> OpenCL driver interface version
26 static const uint8_t GTPIN_OCL_INTERNAL_INTERFACE_VERSION = 2; /// GTPIN INTERNAL VALUE
27 static const uint16_t GTPIN_OCL_INTERFACE_VERSION = GENERATE_SPECIFIC_VERSION(GTPIN_OCL_INTERNAL_INTERFACE_VERSION);
28
29 /************************************************************************/
30 /* General Comments:
31 1. All memory management is done by the caller.
32 The callee should not make any assumptions about the availability
33 of the data out side the scope of the call.
34 The callee must copy all data that will be used out side
35 the scope of the call.
36 */
37 /************************************************************************/
38
39
40 /************************************************************************/
41 /* Events (Driver -> GTPin) */
42 /* The following functions are implemented by GTPin */
43 /* and called by the driver */
44 /************************************************************************/
45
46 /**
47 Called up on a creation of a new Device by the application
48
49 Params:
50 (in) context - The context created.
51 (in) platform_info - information about the platform
52 (out) igc_init - IGC's initialization data
53 */
54 typedef void(*OnContextCreateFPTR)(device_handle_t handle, platform_info_t* platform_info, igc_init_t** igc_init);
55
56 /**
57 Called up on a destruction of the device
58
59 Params:
60 (in) context - The context been destroyed.
61 **/
62 typedef void(*OnContextDestroyFPTR)(device_handle_t handle);
63
64 /**
65 Called on up the creation of a new shader by the application
66
67 Params:
68 (in) context - The handle of the context
69 (in) params_in - All instrumentation parameters needed for GTPin's instrumentation
70 (out) params_out - GTPin's instrumentation artifacts
71 **/
72 typedef void(*OnKernelCreateFPTR)(device_handle_t handle, const instrument_params_in_t* params_in, instrument_params_out_t* params_out);
73
74 /**
75 Called up on applications call to the EnqueueNDRange API.
76 The driver shall call this function for each shader in the pipeline (PS, VS, ...)
77 and is submitted into the command buffer
78
79 Params:
80 (in) cb - Driver's internal command buffer handle
81 (in) kernel_id - Kernel's id as assigned by GTPin in KernelCreate function
82 (out) entry_offset - The entry point in the binary relative to the first instruction
83 (out) resource - GTPin's resource for this kernel
84 **/
85 typedef void(*OnKernelSubmitFPTR)(command_buffer_handle_t cb, uint64_t kernel_id, uint32_t* entry_offset, resource_handle_t* resource);
86
87 /**
88 Called up on the creation of driver's internal command buffer
89
90 Params:
91 (in) context - The handle of the context
92 (in) cb - Driver's internal command buffer handle
93 **/
94 typedef void(*OnCommandBufferCreateFPTR)(device_handle_t handle, command_buffer_handle_t cb);
95
96 /**
97 Called up on the submissions for execution driver's internal command buffer
98
99 Params:
100 (in) cb - Driver's internal command buffer handle
101 (out) resource - GTPin's resource for polling on to identify command buffer completion
102 **/
103 typedef void(*OnCommandBufferCompleteFPTR)(command_buffer_handle_t cb);
104
105
106 /**
107 Event structure:
108 Holds the pointers for functions implemented by GTPin.
109 Those function will be called by the Driver upon a corresponding events.
110 */
111 typedef struct gtpin_events_s
112 {
113 OnContextCreateFPTR onContextCreate;
114 OnContextDestroyFPTR onContextDestroy;
115 OnKernelCreateFPTR onKernelCreate;
116 OnKernelSubmitFPTR onKernelSubmit;
117 OnCommandBufferCreateFPTR onCommandBufferCreate;
118 OnCommandBufferCompleteFPTR onCommandBufferComplete;
119
120 } gtpin_events_t;
121
122 /**
123 Initialize GTPin events and driver services structures
124 This is the entry point into the driver for GTPin and used for the handshake.
125
126 This function must be:
127 1. implemented with the name of GTPin_Init
128 2. exported and visible outside the driver's image
129 3. un-mangled with extern "C"
130
131 Params:
132 (in) gtpin_events - GTPin's events functions callbacks (if NULL ignored)
133 (out) driver_services - Driver's services function callbacks (if NULL ignored)
134 (out) driver_version - Driver's version of the interface (if NULL ignored)
135 */
136
137 //extern "C"
138 //GTPIN_DI_STATUS GTPin_Init(gtpin::ocl::gtpin_events_t* gtpin_events, driver_services_t* driver_services,
139 // interface_version_t* driver_version);
140
141 } // namespace ocl
142 } // namespace gtpin
143 #endif