Debian Codegraph @

IGC/AdaptorOCL/ocl_igc_shared/gtpin/gtpin_driver_common.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_DRIVER_COMMON_H
10 #define GPTIN_DRIVER_COMMON_H
11
12 #include <stdint.h>
13
14 #ifdef _WIN32
15 #define GTPIN_DRIVER_CALLCONV __fastcall
16 #else
17 #define GTPIN_DRIVER_CALLCONV
18 #endif
19
20 /************************************************************************/
21 /* Data Types */
22 /************************************************************************/
23 namespace gtpin
24 {
25 /// GTPin <-> Driver interface version
26
27 static const uint16_t GTPIN_COMMON_INTERFACE_VERSION = 6;
28
29
30 /*!
31 * Common Interface Changelog:
32 * 6. Added back context_handle_t for backward compatibility
33 * 5. Added driver interface
34 * 4. Removed GenerateDriverInterfaceVersion function
35 * 3. Added command_buffer_handle_s for OpenCL support
36 * 2. Added GTPIN_DRIVER_CALLCONV
37 * 1. First introduction of GTPIN_COMMON_INTERFACE_VERSION, addition of debug_data,
38 * 0. Not supported
39 */
40
41
42 typedef struct resource_handle_s* resource_handle_t; /// driver's handle to the resource
43 typedef struct device_handle_s* device_handle_t; /// driver's handle to the device
44 typedef device_handle_t context_handle_t; /// for backward compatibility
45 typedef struct igc_init_s igc_init_t; /// info passed by IGC
46 typedef struct igc_info_s igc_info_t; /// info passed by IGC
47
48
49 typedef struct interface_version_s
50 {
51 uint16_t specific;
52 uint16_t common;
53 } interface_version_t;
54
55
56 /**
57 * Gen Version
58 */
59 typedef enum
60 {
61 GTPIN_GEN_INVALID,
62 GTPIN_GEN_8,
63 GTPIN_GEN_9,
64 GTPIN_GEN_10,
65 GTPIN_GEN_11,
66 GTPIN_GEN_12_1,
67 GTPIN_XEHP_CORE,
68 GTPIN_XE_HPG_CORE,
69 GTPIN_XE_HPC_CORE = GTPIN_XE_HPG_CORE,
70 } GTPIN_GEN_VERSION;
71
72
73 /*!
74 * Possible results of GTPin driver interface functions
75 */
76 typedef enum
77 {
78 GTPIN_DI_SUCCESS = 0, /// operation is successful
79 GTPIN_DI_ERROR_INVALID_ARGUMENT, /// one of the arguments is invalid (null)
80 GTPIN_DI_ERROR_NO_INSTANCE, /// no instance of GTPin inside the driver
81 GTPIN_DI_ERROR_INSTANCE_ALREADY_CREATED, /// GTPin was already initialized in the driver
82 GTPIN_DI_ERROR_ALLOCATION_FAILED, /// failed to allocate a buffer
83 GTPIN_DI_ERROR_NO_VIRTUAL_ADDRESS_TO_BUFFER, /// failed to obtain virtual address to the buffer
84 GTPIN_DI_FAIL, /// general failure
85 } GTPIN_DI_STATUS;
86
87
88 /*!
89 * Kernel types
90 */
91 typedef enum
92 {
93 GTPIN_KERNEL_TYPE_INVALID,
94 GTPIN_KERNEL_TYPE_HS, /// Hull Shader
95 GTPIN_KERNEL_TYPE_DS, /// Domain Shader
96 GTPIN_KERNEL_TYPE_VS, /// Vertex Shader
97 GTPIN_KERNEL_TYPE_PS, /// Pixel Shader
98 GTPIN_KERNEL_TYPE_CS, /// Compute Shader (GPGPU)
99 GTPIN_KERNEL_TYPE_GS /// Geometry Shader
100 } GTPIN_KERNEL_TYPE;
101
102
103 /*!
104 * SIMD widths
105 */
106 typedef enum
107 {
108 GTPIN_SIMD_INVALID,
109 GTPIN_SIMD_4x2 = 4,
110 GTPIN_SIMD_8 = 8,
111 GTPIN_SIMD_16 = 16,
112 GTPIN_SIMD_32 = 32
113 } GTPIN_SIMD_WIDTH;
114
115
116 /*!
117 * GPU interfaces
118 */
119 typedef enum
120 {
121 GFX_OPENCL,
122 GFX_CM,
123 } GFX_TARGET;
124
125
126 /*!
127 * Platform information
128 */
129 typedef struct platform_info_s
130 {
131 GTPIN_GEN_VERSION gen_version;
132 uint32_t device_id;
133 } platform_info_t;
134
135
136 /*!
137 * Driver information
138 */
139 typedef struct driver_info_s
140 {
141 interface_version_t version;
142 GFX_TARGET gfx_target;
143 } driver_info_t;
144
145
146 }
147 #endif /// GPTIN_DRIVER_COMMON_H