1 /*========================== begin_copyright_notice ============================
2 
3 Copyright (C) 2020-2021 Intel Corporation
4 
5 SPDX-License-Identifier: MIT
6 
7 ============================= end_copyright_notice ===========================*/
8 
9 //===- ZEInfo.hpp -----------------------------------------------*- C++ -*-===//
10 // ZE Binary Utilitis
11 //
12 // \file
13 // This file declares the struct representation of .ze.info section
14 //===----------------------------------------------------------------------===//
15 
16 // ******************** DO NOT MODIFY DIRECTLY *********************************
17 // This file is auto-generated by ZEAutoTool/fileparser.py
18 
19 #ifndef ZE_INFO_HPP
20 #define ZE_INFO_HPP
21 
22 #include <string>
23 #include <vector>
24 
25 namespace zebin {
26 
27 typedef int64_t     zeinfo_int64_t;
28 typedef int32_t     zeinfo_int32_t;
29 typedef bool        zeinfo_bool_t;
30 typedef std::string zeinfo_str_t;
31 struct zeInfoExecutionEnv
32 {
operator ==zebin::zeInfoExecutionEnv33     bool operator==(const zeInfoExecutionEnv& other) const
34     {
35         return barrier_count == other.barrier_count && disable_mid_thread_preemption == other.disable_mid_thread_preemption && grf_count == other.grf_count && has_4gb_buffers == other.has_4gb_buffers && has_device_enqueue == other.has_device_enqueue && has_dpas == other.has_dpas && has_fence_for_image_access == other.has_fence_for_image_access && has_global_atomics == other.has_global_atomics && has_multi_scratch_spaces == other.has_multi_scratch_spaces && has_no_stateless_write == other.has_no_stateless_write && has_stack_calls == other.has_stack_calls && inline_data_payload_size == other.inline_data_payload_size && offset_to_skip_per_thread_data_load == other.offset_to_skip_per_thread_data_load && offset_to_skip_set_ffid_gp == other.offset_to_skip_set_ffid_gp && required_sub_group_size == other.required_sub_group_size && required_work_group_size == other.required_work_group_size && simd_size == other.simd_size && slm_size == other.slm_size && subgroup_independent_forward_progress == other.subgroup_independent_forward_progress && work_group_walk_order_dimensions == other.work_group_walk_order_dimensions;
36     }
37     zeinfo_int32_t barrier_count = 0;
38     zeinfo_bool_t disable_mid_thread_preemption = false;
39     zeinfo_int32_t grf_count = 0;
40     zeinfo_bool_t has_4gb_buffers = false;
41     zeinfo_bool_t has_device_enqueue = false;
42     zeinfo_bool_t has_dpas = false;
43     zeinfo_bool_t has_fence_for_image_access = false;
44     zeinfo_bool_t has_global_atomics = false;
45     zeinfo_bool_t has_multi_scratch_spaces = false;
46     zeinfo_bool_t has_no_stateless_write = false;
47     zeinfo_bool_t has_stack_calls = false;
48     zeinfo_int32_t inline_data_payload_size = 0;
49     zeinfo_int32_t offset_to_skip_per_thread_data_load = 0;
50     zeinfo_int32_t offset_to_skip_set_ffid_gp = 0;
51     zeinfo_int32_t required_sub_group_size = 0;
52     std::vector<zeinfo_int32_t> required_work_group_size;
53     zeinfo_int32_t simd_size = 0;
54     zeinfo_int32_t slm_size = 0;
55     zeinfo_bool_t subgroup_independent_forward_progress = false;
56     std::vector<zeinfo_int32_t> work_group_walk_order_dimensions;
57 };
58 struct zeInfoPayloadArgument
59 {
operator ==zebin::zeInfoPayloadArgument60     bool operator==(const zeInfoPayloadArgument& other) const
61     {
62         return arg_type == other.arg_type && offset == other.offset && size == other.size && arg_index == other.arg_index && addrmode == other.addrmode && addrspace == other.addrspace && access_type == other.access_type && sampler_index == other.sampler_index;
63     }
64     zeinfo_str_t arg_type;
65     zeinfo_int32_t offset = 0;
66     zeinfo_int32_t size = 0;
67     zeinfo_int32_t arg_index = -1;
68     zeinfo_str_t addrmode;
69     zeinfo_str_t addrspace;
70     zeinfo_str_t access_type;
71     zeinfo_int32_t sampler_index = -1;
72 };
73 struct zeInfoPerThreadPayloadArgument
74 {
operator ==zebin::zeInfoPerThreadPayloadArgument75     bool operator==(const zeInfoPerThreadPayloadArgument& other) const
76     {
77         return arg_type == other.arg_type && offset == other.offset && size == other.size;
78     }
79     zeinfo_str_t arg_type;
80     zeinfo_int32_t offset = 0;
81     zeinfo_int32_t size = 0;
82 };
83 struct zeInfoBindingTableIndex
84 {
operator ==zebin::zeInfoBindingTableIndex85     bool operator==(const zeInfoBindingTableIndex& other) const
86     {
87         return bti_value == other.bti_value && arg_index == other.arg_index;
88     }
89     zeinfo_int32_t bti_value = 0;
90     zeinfo_int32_t arg_index = 0;
91 };
92 struct zeInfoPerThreadMemoryBuffer
93 {
operator ==zebin::zeInfoPerThreadMemoryBuffer94     bool operator==(const zeInfoPerThreadMemoryBuffer& other) const
95     {
96         return type == other.type && usage == other.usage && size == other.size && slot == other.slot && is_simt_thread == other.is_simt_thread;
97     }
98     zeinfo_str_t type;
99     zeinfo_str_t usage;
100     zeinfo_int32_t size = 0;
101     zeinfo_int32_t slot = 0;
102     zeinfo_bool_t is_simt_thread = false;
103 };
104 struct zeInfoExperimentalProperties
105 {
operator ==zebin::zeInfoExperimentalProperties106     bool operator==(const zeInfoExperimentalProperties& other) const
107     {
108         return has_non_kernel_arg_load == other.has_non_kernel_arg_load && has_non_kernel_arg_store == other.has_non_kernel_arg_store && has_non_kernel_arg_atomic == other.has_non_kernel_arg_atomic;
109     }
110     zeinfo_int32_t has_non_kernel_arg_load = -1;
111     zeinfo_int32_t has_non_kernel_arg_store = -1;
112     zeinfo_int32_t has_non_kernel_arg_atomic = -1;
113 };
114 struct zeInfoDebugEnv
115 {
operator ==zebin::zeInfoDebugEnv116     bool operator==(const zeInfoDebugEnv& other) const
117     {
118         return sip_surface_bti == other.sip_surface_bti && sip_surface_offset == other.sip_surface_offset;
119     }
120     zeinfo_int32_t sip_surface_bti = -1;
121     zeinfo_int32_t sip_surface_offset = -1;
122 };
123 typedef std::vector<zeInfoPayloadArgument> PayloadArgumentsTy;
124 typedef std::vector<zeInfoPerThreadPayloadArgument> PerThreadPayloadArgumentsTy;
125 typedef std::vector<zeInfoBindingTableIndex> BindingTableIndicesTy;
126 typedef std::vector<zeInfoPerThreadMemoryBuffer> PerThreadMemoryBuffersTy;
127 struct zeInfoKernel
128 {
129     zeinfo_str_t name;
130     zeInfoExecutionEnv execution_env;
131     PayloadArgumentsTy payload_arguments;
132     PerThreadPayloadArgumentsTy per_thread_payload_arguments;
133     BindingTableIndicesTy binding_table_indices;
134     PerThreadMemoryBuffersTy per_thread_memory_buffers;
135     zeInfoExperimentalProperties experimental_properties;
136     zeInfoDebugEnv debug_env;
137 };
138 typedef std::vector<zeInfoKernel> KernelsTy;
139 struct zeInfoContainer
140 {
141     zeinfo_str_t version;
142     KernelsTy kernels;
143 };
144 struct PreDefinedAttrGetter{
getVersionNumberzebin::PreDefinedAttrGetter145     static zeinfo_str_t getVersionNumber() { return "1.8"; }
146 
147     enum class ArgType {
148         packed_local_ids,
149         local_id,
150         local_size,
151         group_count,
152         work_dimensions,
153         global_size,
154         enqueued_local_size,
155         global_id_offset,
156         private_base_stateless,
157         buffer_offset,
158         printf_buffer,
159         implicit_arg_buffer,
160         implicit_local_id_buffer,
161         arg_byvalue,
162         arg_bypointer
163     };
164     enum class ArgAddrMode {
165         stateless,
166         stateful,
167         bindless,
168         slm
169     };
170     enum class ArgAddrSpace {
171         global,
172         local,
173         constant,
174         image,
175         sampler
176     };
177     enum class ArgAccessType {
178         readonly,
179         writeonly,
180         readwrite
181     };
182     enum class MemBufferType {
183         global,
184         scratch,
185         slm
186     };
187     enum class MemBufferUsage {
188         private_space,
189         spill_fill_space,
190         single_space
191     };
getzebin::PreDefinedAttrGetter192     static zeinfo_str_t get(ArgType val) {
193         switch(val) {
194         case ArgType::packed_local_ids:
195             return "packed_local_ids";
196         case ArgType::local_id:
197             return "local_id";
198         case ArgType::local_size:
199             return "local_size";
200         case ArgType::group_count:
201             return "group_count";
202         case ArgType::work_dimensions:
203             return "work_dimensions";
204         case ArgType::global_size:
205             return "global_size";
206         case ArgType::enqueued_local_size:
207             return "enqueued_local_size";
208         case ArgType::global_id_offset:
209             return "global_id_offset";
210         case ArgType::private_base_stateless:
211             return "private_base_stateless";
212         case ArgType::buffer_offset:
213             return "buffer_offset";
214         case ArgType::printf_buffer:
215             return "printf_buffer";
216         case ArgType::implicit_arg_buffer:
217             return "implicit_arg_buffer";
218         case ArgType::implicit_local_id_buffer:
219             return "implicit_local_id_buffer";
220         case ArgType::arg_byvalue:
221             return "arg_byvalue";
222         case ArgType::arg_bypointer:
223             return "arg_bypointer";
224         default:
225             break;
226         }
227         return "";
228     }
getzebin::PreDefinedAttrGetter229     static zeinfo_str_t get(ArgAddrMode val) {
230         switch(val) {
231         case ArgAddrMode::stateless:
232             return "stateless";
233         case ArgAddrMode::stateful:
234             return "stateful";
235         case ArgAddrMode::bindless:
236             return "bindless";
237         case ArgAddrMode::slm:
238             return "slm";
239         default:
240             break;
241         }
242         return "";
243     }
getzebin::PreDefinedAttrGetter244     static zeinfo_str_t get(ArgAddrSpace val) {
245         switch(val) {
246         case ArgAddrSpace::global:
247             return "global";
248         case ArgAddrSpace::local:
249             return "local";
250         case ArgAddrSpace::constant:
251             return "constant";
252         case ArgAddrSpace::image:
253             return "image";
254         case ArgAddrSpace::sampler:
255             return "sampler";
256         default:
257             break;
258         }
259         return "";
260     }
getzebin::PreDefinedAttrGetter261     static zeinfo_str_t get(ArgAccessType val) {
262         switch(val) {
263         case ArgAccessType::readonly:
264             return "readonly";
265         case ArgAccessType::writeonly:
266             return "writeonly";
267         case ArgAccessType::readwrite:
268             return "readwrite";
269         default:
270             break;
271         }
272         return "";
273     }
getzebin::PreDefinedAttrGetter274     static zeinfo_str_t get(MemBufferType val) {
275         switch(val) {
276         case MemBufferType::global:
277             return "global";
278         case MemBufferType::scratch:
279             return "scratch";
280         case MemBufferType::slm:
281             return "slm";
282         default:
283             break;
284         }
285         return "";
286     }
getzebin::PreDefinedAttrGetter287     static zeinfo_str_t get(MemBufferUsage val) {
288         switch(val) {
289         case MemBufferUsage::private_space:
290             return "private_space";
291         case MemBufferUsage::spill_fill_space:
292             return "spill_fill_space";
293         case MemBufferUsage::single_space:
294             return "single_space";
295         default:
296             break;
297         }
298         return "";
299     }
300 };
301 }
302 #endif
303