Fix coding style of ASM_OUTPUT_ALIGN.
[official-gcc.git] / libgomp / plugin / hsa_ext_finalize.h
blob15cb2fa797c4cb89ea6dcc9b5041b01335c688b2
1 /* HSA Extensions API 1.0.1 representation description.
2 Copyright (C) 2016-2018 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>.
25 The contents of the file was created by extracting data structures, enum,
26 typedef and other definitions from HSA Runtime Programmer’s Reference Manual
27 Version 1.0 (http://www.hsafoundation.com/standards/).
29 HTML version is provided on the following link:
30 http://www.hsafoundation.com/html/Content/Runtime/Topics/Runtime_title_page.htm
34 #ifndef _HSA_EXT_FINALIZE_H
35 #define _HSA_EXT_FINALIZE_H 1
37 struct BrigModuleHeader;
38 typedef struct BrigModuleHeader *BrigModule_t;
40 typedef enum {
41 HSA_EXT_IMAGE_GEOMETRY_1D = 0,
42 HSA_EXT_IMAGE_GEOMETRY_2D = 1,
43 HSA_EXT_IMAGE_GEOMETRY_3D = 2,
44 HSA_EXT_IMAGE_GEOMETRY_1DA = 3,
45 HSA_EXT_IMAGE_GEOMETRY_2DA = 4,
46 HSA_EXT_IMAGE_GEOMETRY_1DB = 5,
47 HSA_EXT_IMAGE_GEOMETRY_2DDEPTH = 6,
48 HSA_EXT_IMAGE_GEOMETRY_2DADEPTH = 7
49 } hsa_ext_image_geometry_t;
51 typedef enum {
52 HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT8 = 0,
53 HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT16 = 1,
54 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT8 = 2,
55 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT16 = 3,
56 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT24 = 4,
57 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555 = 5,
58 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565 = 6,
59 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_101010 = 7,
60 HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT8 = 8,
61 HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT16 = 9,
62 HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT32 = 10,
63 HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8 = 11,
64 HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16 = 12,
65 HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32 = 13,
66 HSA_EXT_IMAGE_CHANNEL_TYPE_HALF_FLOAT = 14,
67 HSA_EXT_IMAGE_CHANNEL_TYPE_FLOAT = 15
68 } hsa_ext_image_channel_type_t;
70 typedef enum {
71 HSA_EXT_IMAGE_CHANNEL_ORDER_A = 0,
72 HSA_EXT_IMAGE_CHANNEL_ORDER_R = 1,
73 HSA_EXT_IMAGE_CHANNEL_ORDER_RX = 2,
74 HSA_EXT_IMAGE_CHANNEL_ORDER_RG = 3,
75 HSA_EXT_IMAGE_CHANNEL_ORDER_RGX = 4,
76 HSA_EXT_IMAGE_CHANNEL_ORDER_RA = 5,
77 HSA_EXT_IMAGE_CHANNEL_ORDER_RGB = 6,
78 HSA_EXT_IMAGE_CHANNEL_ORDER_RGBX = 7,
79 HSA_EXT_IMAGE_CHANNEL_ORDER_RGBA = 8,
80 HSA_EXT_IMAGE_CHANNEL_ORDER_BGRA = 9,
81 HSA_EXT_IMAGE_CHANNEL_ORDER_ARGB = 10,
82 HSA_EXT_IMAGE_CHANNEL_ORDER_ABGR = 11,
83 HSA_EXT_IMAGE_CHANNEL_ORDER_SRGB = 12,
84 HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBX = 13,
85 HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBA = 14,
86 HSA_EXT_IMAGE_CHANNEL_ORDER_SBGRA = 15,
87 HSA_EXT_IMAGE_CHANNEL_ORDER_INTENSITY = 16,
88 HSA_EXT_IMAGE_CHANNEL_ORDER_LUMINANCE = 17,
89 HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH = 18,
90 HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH_STENCIL = 19
91 } hsa_ext_image_channel_order_t;
93 typedef struct hsa_ext_image_format_s
95 hsa_ext_image_channel_type_t channel_type;
96 hsa_ext_image_channel_order_t channel_order;
97 } hsa_ext_image_format_t;
99 typedef struct hsa_ext_sampler_s
101 uint64_t handle;
102 } hsa_ext_sampler_t;
103 typedef struct hsa_ext_image_data_info_s
105 size_t size;
106 size_t alignment;
107 } hsa_ext_image_data_info_t;
108 typedef enum {
109 HSA_EXT_SAMPLER_ADDRESSING_MODE_UNDEFINED = 0,
110 HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE = 1,
111 HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER = 2,
112 HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT = 3,
113 HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT = 4
114 } hsa_ext_sampler_addressing_mode_t;
115 typedef struct hsa_ext_image_s
117 uint64_t handle;
118 } hsa_ext_image_t;
119 typedef enum {
120 HSA_EXT_IMAGE_CAPABILITY_NOT_SUPPORTED = 0x0,
121 HSA_EXT_IMAGE_CAPABILITY_READ_ONLY = 0x1,
122 HSA_EXT_IMAGE_CAPABILITY_WRITE_ONLY = 0x2,
123 HSA_EXT_IMAGE_CAPABILITY_READ_WRITE = 0x4,
124 HSA_EXT_IMAGE_CAPABILITY_READ_MODIFY_WRITE = 0x8,
125 HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT = 0x10
126 } hsa_ext_image_capability_t;
127 typedef struct hsa_ext_control_directives_s
129 uint64_t control_directives_mask;
130 uint16_t break_exceptions_mask;
131 uint16_t detect_exceptions_mask;
132 uint32_t max_dynamic_group_size;
133 uint64_t max_flat_grid_size;
134 uint32_t max_flat_workgroup_size;
135 uint32_t reserved1;
136 uint64_t required_grid_size[3];
137 hsa_dim3_t required_workgroup_size;
138 uint8_t required_dim;
139 uint8_t reserved2[75];
140 } hsa_ext_control_directives_t;
141 typedef enum {
142 HSA_EXT_SAMPLER_FILTER_MODE_NEAREST = 0,
143 HSA_EXT_SAMPLER_FILTER_MODE_LINEAR = 1
144 } hsa_ext_sampler_filter_mode_t;
146 typedef enum {
147 HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED = 0,
148 HSA_EXT_SAMPLER_COORDINATE_MODE_NORMALIZED = 1
149 } hsa_ext_sampler_coordinate_mode_t;
150 typedef enum {
151 HSA_EXT_FINALIZER_CALL_CONVENTION_AUTO = -1
152 } hsa_ext_finalizer_call_convention_t;
153 typedef struct hsa_ext_program_s
155 uint64_t handle;
156 } hsa_ext_program_t;
157 typedef struct hsa_ext_image_descriptor_s
159 hsa_ext_image_geometry_t geometry;
160 size_t width;
161 size_t height;
162 size_t depth;
163 size_t array_size;
164 hsa_ext_image_format_t format;
165 } hsa_ext_image_descriptor_t;
166 typedef enum {
167 HSA_EXT_PROGRAM_INFO_MACHINE_MODEL = 0,
168 HSA_EXT_PROGRAM_INFO_PROFILE = 1,
169 HSA_EXT_PROGRAM_INFO_DEFAULT_FLOAT_ROUNDING_MODE = 2
170 } hsa_ext_program_info_t;
171 typedef BrigModule_t hsa_ext_module_t;
172 typedef struct hsa_ext_sampler_descriptor_s
174 hsa_ext_sampler_coordinate_mode_t coordinate_mode;
175 hsa_ext_sampler_filter_mode_t filter_mode;
176 hsa_ext_sampler_addressing_mode_t address_mode;
177 } hsa_ext_sampler_descriptor_t;
179 typedef struct hsa_ext_image_region_s
181 hsa_dim3_t offset;
182 hsa_dim3_t range;
183 } hsa_ext_image_region_t;
184 hsa_status_t hsa_ext_image_export (hsa_agent_t agent, hsa_ext_image_t src_image,
185 void *dst_memory, size_t dst_row_pitch,
186 size_t dst_slice_pitch,
187 const hsa_ext_image_region_t *image_region);
188 hsa_status_t hsa_ext_program_add_module (hsa_ext_program_t program,
189 hsa_ext_module_t module);
190 hsa_status_t hsa_ext_program_iterate_modules (
191 hsa_ext_program_t program,
192 hsa_status_t (*callback) (hsa_ext_program_t program, hsa_ext_module_t module,
193 void *data),
194 void *data);
195 hsa_status_t hsa_ext_program_create (
196 hsa_machine_model_t machine_model, hsa_profile_t profile,
197 hsa_default_float_rounding_mode_t default_float_rounding_mode,
198 const char *options, hsa_ext_program_t *program);
199 hsa_status_t
200 hsa_ext_image_data_get_info (hsa_agent_t agent,
201 const hsa_ext_image_descriptor_t *image_descriptor,
202 hsa_access_permission_t access_permission,
203 hsa_ext_image_data_info_t *image_data_info);
205 hsa_status_t hsa_ext_image_import (hsa_agent_t agent, const void *src_memory,
206 size_t src_row_pitch, size_t src_slice_pitch,
207 hsa_ext_image_t dst_image,
208 const hsa_ext_image_region_t *image_region);
209 hsa_status_t hsa_ext_program_get_info (hsa_ext_program_t program,
210 hsa_ext_program_info_t attribute,
211 void *value);
212 enum
214 HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED = 0x3000,
215 HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED = 0x3001
217 hsa_status_t hsa_ext_image_destroy (hsa_agent_t agent, hsa_ext_image_t image);
218 hsa_status_t hsa_ext_image_get_capability (
219 hsa_agent_t agent, hsa_ext_image_geometry_t geometry,
220 const hsa_ext_image_format_t *image_format, uint32_t *capability_mask);
221 enum
223 HSA_EXT_STATUS_ERROR_INVALID_PROGRAM = 0x2000,
224 HSA_EXT_STATUS_ERROR_INVALID_MODULE = 0x2001,
225 HSA_EXT_STATUS_ERROR_INCOMPATIBLE_MODULE = 0x2002,
226 HSA_EXT_STATUS_ERROR_MODULE_ALREADY_INCLUDED = 0x2003,
227 HSA_EXT_STATUS_ERROR_SYMBOL_MISMATCH = 0x2004,
228 HSA_EXT_STATUS_ERROR_FINALIZATION_FAILED = 0x2005,
229 HSA_EXT_STATUS_ERROR_DIRECTIVE_MISMATCH = 0x2006
231 hsa_status_t hsa_ext_sampler_destroy (hsa_agent_t agent,
232 hsa_ext_sampler_t sampler);
233 hsa_status_t hsa_ext_program_finalize (
234 hsa_ext_program_t program, hsa_isa_t isa, int32_t call_convention,
235 hsa_ext_control_directives_t control_directives, const char *options,
236 hsa_code_object_type_t code_object_type, hsa_code_object_t *code_object);
237 hsa_status_t hsa_ext_image_create (
238 hsa_agent_t agent, const hsa_ext_image_descriptor_t *image_descriptor,
239 const void *image_data, hsa_access_permission_t access_permission,
240 hsa_ext_image_t *image);
241 hsa_status_t hsa_ext_program_destroy (hsa_ext_program_t program);
242 hsa_status_t hsa_ext_image_copy (hsa_agent_t agent, hsa_ext_image_t src_image,
243 const hsa_dim3_t *src_offset,
244 hsa_ext_image_t dst_image,
245 const hsa_dim3_t *dst_offset,
246 const hsa_dim3_t *range);
247 hsa_status_t hsa_ext_image_clear (hsa_agent_t agent, hsa_ext_image_t image,
248 const void *data,
249 const hsa_ext_image_region_t *image_region);
250 enum
252 HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS = 0x3000,
253 HSA_EXT_AGENT_INFO_IMAGE_1DA_MAX_ELEMENTS = 0x3001,
254 HSA_EXT_AGENT_INFO_IMAGE_1DB_MAX_ELEMENTS = 0x3002,
255 HSA_EXT_AGENT_INFO_IMAGE_2D_MAX_ELEMENTS = 0x3003,
256 HSA_EXT_AGENT_INFO_IMAGE_2DA_MAX_ELEMENTS = 0x3004,
257 HSA_EXT_AGENT_INFO_IMAGE_2DDEPTH_MAX_ELEMENTS = 0x3005,
258 HSA_EXT_AGENT_INFO_IMAGE_2DADEPTH_MAX_ELEMENTS = 0x3006,
259 HSA_EXT_AGENT_INFO_IMAGE_3D_MAX_ELEMENTS = 0x3007,
260 HSA_EXT_AGENT_INFO_IMAGE_ARRAY_MAX_LAYERS = 0x3008,
261 HSA_EXT_AGENT_INFO_MAX_IMAGE_RD_HANDLES = 0x3009,
262 HSA_EXT_AGENT_INFO_MAX_IMAGE_RORW_HANDLES = 0x300A,
263 HSA_EXT_AGENT_INFO_MAX_SAMPLER_HANDLERS = 0x300B
265 hsa_status_t
266 hsa_ext_sampler_create (hsa_agent_t agent,
267 const hsa_ext_sampler_descriptor_t *sampler_descriptor,
268 hsa_ext_sampler_t *sampler);
270 #endif /* _HSA_EXT_FINALIZE_H */