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