@@ -33,12 +33,130 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
33
#include < llvm/Support/DynamicLibrary.h>
34
34
#include " common/LLVMWarningsPop.hpp"
35
35
36
- #include " igcmc.h"
37
36
#include " Compiler/CodeGenPublic.h"
38
37
#include " common/LLVMWarningsPush.hpp"
39
38
#include " VectorCompiler/include/vc/GenXCodeGen/GenXWrapper.h"
40
39
#include " common/LLVMWarningsPop.hpp"
41
40
41
+ // optional resource access kind
42
+ enum class cmc_access_kind : int32_t {
43
+ undef,
44
+ read_only,
45
+ write_only,
46
+ read_write
47
+ };
48
+
49
+ enum class cmc_arg_kind : int32_t {
50
+ General,
51
+ LocalSize, // IMPLICIT_LOCAL_SIZE
52
+ GroupCount, // IMPLICIT_NUM_GROUPS
53
+ Buffer, // 1D buffer
54
+ SVM, // stateless global pointer
55
+ Sampler,
56
+ Image1d,
57
+ Image2d,
58
+ Image3d,
59
+ PrintBuffer,
60
+ PrivateBase
61
+ };
62
+
63
+ struct cmc_ocl_print_string {
64
+ static constexpr unsigned max_width = 256 ;
65
+ char s[max_width];
66
+ };
67
+
68
+ struct cmc_arg_info {
69
+ // The argument kind.
70
+ cmc_arg_kind kind = cmc_arg_kind::General;
71
+
72
+ // The argument index in this kernel.
73
+ int32_t index = 0 ;
74
+
75
+ // the byte offset of this argument in payload
76
+ int32_t offset = 0 ;
77
+
78
+ // The byte size of this argument in payload
79
+ int32_t sizeInBytes = 0 ;
80
+
81
+ // The BTI for this resource, if applicable.
82
+ int32_t BTI = 0 ;
83
+
84
+ // the optional resource access kind, if applicable.
85
+ cmc_access_kind access = cmc_access_kind::undef;
86
+ };
87
+
88
+ // compilation interface bewteen cmc and igc
89
+ struct cmc_kernel_info_v2 {
90
+ // / The kernel name.
91
+ const char *name;
92
+
93
+ // / The number of kernel arguments
94
+ unsigned num_args;
95
+
96
+ // / The kernel argument info.
97
+ cmc_arg_info *arg_descs;
98
+
99
+ // ThreadPayload
100
+ bool HasLocalIDx = false ;
101
+ bool HasLocalIDy = false ;
102
+ bool HasLocalIDz = false ;
103
+ bool HasGroupID = false ;
104
+
105
+ // ExecutionEnivronment
106
+ uint32_t CompiledSIMDSize = 8 ;
107
+ uint32_t SLMSize = 0 ;
108
+ uint32_t NumGRFRequired = 128 ;
109
+ uint32_t GRFByteSize = 32 ;
110
+ uint32_t HasBarriers = 0 ;
111
+ bool HasReadWriteImages = false ;
112
+ uint32_t ThreadPrivateMemSize = 0 ;
113
+ uint32_t StatelessPrivateMemSize = 0 ;
114
+
115
+ // / number of format strings in the kernel
116
+ unsigned num_print_strings = 0 ;
117
+ // / The kernel format string storage
118
+ cmc_ocl_print_string *print_string_descs = nullptr ;
119
+
120
+ struct TableInfo {
121
+ void *Buf = nullptr ;
122
+ uint32_t Size = 0 ;
123
+ uint32_t NumEntries = 0 ;
124
+ };
125
+
126
+ TableInfo RelocationTable;
127
+ TableInfo SymbolTable;
128
+ vc::ocl::ZEBinaryInfo ZEBinInfo;
129
+ };
130
+
131
+ struct cmc_compile_info_v2 {
132
+ // / The vISA binary size in bytes.
133
+ uint64_t binary_size;
134
+
135
+ // / The vISA binary data.
136
+ void * binary;
137
+
138
+ uint32_t pointer_size_in_bytes;
139
+
140
+ // / The vISA major version.
141
+ uint32_t visa_major_version;
142
+
143
+ // / The vISA minor version.
144
+ uint32_t visa_minor_version;
145
+
146
+ // / The number of kernel.
147
+ unsigned num_kernels;
148
+
149
+ // / Ugly stub for compatibility with cmc
150
+ void *compatibility_stub;
151
+
152
+ // / The context for this compilation. This opaque data holds all memory
153
+ // / allocations that will be freed in the end.
154
+ void * context;
155
+
156
+ // / The kernel infomation.
157
+ cmc_kernel_info_v2 *kernel_info_v2;
158
+ };
159
+
42
160
namespace iOpenCL {
43
161
class CGen8CMProgram ;
44
162
}
0 commit comments