1 /* HSA Extensions API 1.0.1 representation description.
2 Copyright (C) 2016 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)
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 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>.
20 The contents of the file was created by extracting data structures, enum,
21 typedef and other definitions from HSA Runtime Programmer’s Reference Manual
22 Version 1.0 (http://www.hsafoundation.com/standards/).
24 HTML version is provided on the following link:
25 http://www.hsafoundation.com/html/Content/Runtime/Topics/Runtime_title_page.htm
29 #ifndef _HSA_EXT_FINALIZE_H
30 #define _HSA_EXT_FINALIZE_H 1
32 struct BrigModuleHeader
;
33 typedef struct BrigModuleHeader
*BrigModule_t
;
36 HSA_EXT_IMAGE_GEOMETRY_1D
= 0,
37 HSA_EXT_IMAGE_GEOMETRY_2D
= 1,
38 HSA_EXT_IMAGE_GEOMETRY_3D
= 2,
39 HSA_EXT_IMAGE_GEOMETRY_1DA
= 3,
40 HSA_EXT_IMAGE_GEOMETRY_2DA
= 4,
41 HSA_EXT_IMAGE_GEOMETRY_1DB
= 5,
42 HSA_EXT_IMAGE_GEOMETRY_2DDEPTH
= 6,
43 HSA_EXT_IMAGE_GEOMETRY_2DADEPTH
= 7
44 } hsa_ext_image_geometry_t
;
47 HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT8
= 0,
48 HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT16
= 1,
49 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT8
= 2,
50 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT16
= 3,
51 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT24
= 4,
52 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555
= 5,
53 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565
= 6,
54 HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_101010
= 7,
55 HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT8
= 8,
56 HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT16
= 9,
57 HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT32
= 10,
58 HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8
= 11,
59 HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16
= 12,
60 HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32
= 13,
61 HSA_EXT_IMAGE_CHANNEL_TYPE_HALF_FLOAT
= 14,
62 HSA_EXT_IMAGE_CHANNEL_TYPE_FLOAT
= 15
63 } hsa_ext_image_channel_type_t
;
66 HSA_EXT_IMAGE_CHANNEL_ORDER_A
= 0,
67 HSA_EXT_IMAGE_CHANNEL_ORDER_R
= 1,
68 HSA_EXT_IMAGE_CHANNEL_ORDER_RX
= 2,
69 HSA_EXT_IMAGE_CHANNEL_ORDER_RG
= 3,
70 HSA_EXT_IMAGE_CHANNEL_ORDER_RGX
= 4,
71 HSA_EXT_IMAGE_CHANNEL_ORDER_RA
= 5,
72 HSA_EXT_IMAGE_CHANNEL_ORDER_RGB
= 6,
73 HSA_EXT_IMAGE_CHANNEL_ORDER_RGBX
= 7,
74 HSA_EXT_IMAGE_CHANNEL_ORDER_RGBA
= 8,
75 HSA_EXT_IMAGE_CHANNEL_ORDER_BGRA
= 9,
76 HSA_EXT_IMAGE_CHANNEL_ORDER_ARGB
= 10,
77 HSA_EXT_IMAGE_CHANNEL_ORDER_ABGR
= 11,
78 HSA_EXT_IMAGE_CHANNEL_ORDER_SRGB
= 12,
79 HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBX
= 13,
80 HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBA
= 14,
81 HSA_EXT_IMAGE_CHANNEL_ORDER_SBGRA
= 15,
82 HSA_EXT_IMAGE_CHANNEL_ORDER_INTENSITY
= 16,
83 HSA_EXT_IMAGE_CHANNEL_ORDER_LUMINANCE
= 17,
84 HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH
= 18,
85 HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH_STENCIL
= 19
86 } hsa_ext_image_channel_order_t
;
88 typedef struct hsa_ext_image_format_s
90 hsa_ext_image_channel_type_t channel_type
;
91 hsa_ext_image_channel_order_t channel_order
;
92 } hsa_ext_image_format_t
;
94 typedef struct hsa_ext_sampler_s
98 typedef struct hsa_ext_image_data_info_s
102 } hsa_ext_image_data_info_t
;
104 HSA_EXT_SAMPLER_ADDRESSING_MODE_UNDEFINED
= 0,
105 HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE
= 1,
106 HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER
= 2,
107 HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT
= 3,
108 HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT
= 4
109 } hsa_ext_sampler_addressing_mode_t
;
110 typedef struct hsa_ext_image_s
115 HSA_EXT_IMAGE_CAPABILITY_NOT_SUPPORTED
= 0x0,
116 HSA_EXT_IMAGE_CAPABILITY_READ_ONLY
= 0x1,
117 HSA_EXT_IMAGE_CAPABILITY_WRITE_ONLY
= 0x2,
118 HSA_EXT_IMAGE_CAPABILITY_READ_WRITE
= 0x4,
119 HSA_EXT_IMAGE_CAPABILITY_READ_MODIFY_WRITE
= 0x8,
120 HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT
= 0x10
121 } hsa_ext_image_capability_t
;
122 typedef struct hsa_ext_control_directives_s
124 uint64_t control_directives_mask
;
125 uint16_t break_exceptions_mask
;
126 uint16_t detect_exceptions_mask
;
127 uint32_t max_dynamic_group_size
;
128 uint64_t max_flat_grid_size
;
129 uint32_t max_flat_workgroup_size
;
131 uint64_t required_grid_size
[3];
132 hsa_dim3_t required_workgroup_size
;
133 uint8_t required_dim
;
134 uint8_t reserved2
[75];
135 } hsa_ext_control_directives_t
;
137 HSA_EXT_SAMPLER_FILTER_MODE_NEAREST
= 0,
138 HSA_EXT_SAMPLER_FILTER_MODE_LINEAR
= 1
139 } hsa_ext_sampler_filter_mode_t
;
142 HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED
= 0,
143 HSA_EXT_SAMPLER_COORDINATE_MODE_NORMALIZED
= 1
144 } hsa_ext_sampler_coordinate_mode_t
;
146 HSA_EXT_FINALIZER_CALL_CONVENTION_AUTO
= -1
147 } hsa_ext_finalizer_call_convention_t
;
148 typedef struct hsa_ext_program_s
152 typedef struct hsa_ext_image_descriptor_s
154 hsa_ext_image_geometry_t geometry
;
159 hsa_ext_image_format_t format
;
160 } hsa_ext_image_descriptor_t
;
162 HSA_EXT_PROGRAM_INFO_MACHINE_MODEL
= 0,
163 HSA_EXT_PROGRAM_INFO_PROFILE
= 1,
164 HSA_EXT_PROGRAM_INFO_DEFAULT_FLOAT_ROUNDING_MODE
= 2
165 } hsa_ext_program_info_t
;
166 typedef BrigModule_t hsa_ext_module_t
;
167 typedef struct hsa_ext_sampler_descriptor_s
169 hsa_ext_sampler_coordinate_mode_t coordinate_mode
;
170 hsa_ext_sampler_filter_mode_t filter_mode
;
171 hsa_ext_sampler_addressing_mode_t address_mode
;
172 } hsa_ext_sampler_descriptor_t
;
174 typedef struct hsa_ext_image_region_s
178 } hsa_ext_image_region_t
;
179 hsa_status_t
hsa_ext_image_export (hsa_agent_t agent
, hsa_ext_image_t src_image
,
180 void *dst_memory
, size_t dst_row_pitch
,
181 size_t dst_slice_pitch
,
182 const hsa_ext_image_region_t
*image_region
);
183 hsa_status_t
hsa_ext_program_add_module (hsa_ext_program_t program
,
184 hsa_ext_module_t module
);
185 hsa_status_t
hsa_ext_program_iterate_modules (
186 hsa_ext_program_t program
,
187 hsa_status_t (*callback
) (hsa_ext_program_t program
, hsa_ext_module_t module
,
190 hsa_status_t
hsa_ext_program_create (
191 hsa_machine_model_t machine_model
, hsa_profile_t profile
,
192 hsa_default_float_rounding_mode_t default_float_rounding_mode
,
193 const char *options
, hsa_ext_program_t
*program
);
195 hsa_ext_image_data_get_info (hsa_agent_t agent
,
196 const hsa_ext_image_descriptor_t
*image_descriptor
,
197 hsa_access_permission_t access_permission
,
198 hsa_ext_image_data_info_t
*image_data_info
);
200 hsa_status_t
hsa_ext_image_import (hsa_agent_t agent
, const void *src_memory
,
201 size_t src_row_pitch
, size_t src_slice_pitch
,
202 hsa_ext_image_t dst_image
,
203 const hsa_ext_image_region_t
*image_region
);
204 hsa_status_t
hsa_ext_program_get_info (hsa_ext_program_t program
,
205 hsa_ext_program_info_t attribute
,
209 HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED
= 0x3000,
210 HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED
= 0x3001
212 hsa_status_t
hsa_ext_image_destroy (hsa_agent_t agent
, hsa_ext_image_t image
);
213 hsa_status_t
hsa_ext_image_get_capability (
214 hsa_agent_t agent
, hsa_ext_image_geometry_t geometry
,
215 const hsa_ext_image_format_t
*image_format
, uint32_t *capability_mask
);
218 HSA_EXT_STATUS_ERROR_INVALID_PROGRAM
= 0x2000,
219 HSA_EXT_STATUS_ERROR_INVALID_MODULE
= 0x2001,
220 HSA_EXT_STATUS_ERROR_INCOMPATIBLE_MODULE
= 0x2002,
221 HSA_EXT_STATUS_ERROR_MODULE_ALREADY_INCLUDED
= 0x2003,
222 HSA_EXT_STATUS_ERROR_SYMBOL_MISMATCH
= 0x2004,
223 HSA_EXT_STATUS_ERROR_FINALIZATION_FAILED
= 0x2005,
224 HSA_EXT_STATUS_ERROR_DIRECTIVE_MISMATCH
= 0x2006
226 hsa_status_t
hsa_ext_sampler_destroy (hsa_agent_t agent
,
227 hsa_ext_sampler_t sampler
);
228 hsa_status_t
hsa_ext_program_finalize (
229 hsa_ext_program_t program
, hsa_isa_t isa
, int32_t call_convention
,
230 hsa_ext_control_directives_t control_directives
, const char *options
,
231 hsa_code_object_type_t code_object_type
, hsa_code_object_t
*code_object
);
232 hsa_status_t
hsa_ext_image_create (
233 hsa_agent_t agent
, const hsa_ext_image_descriptor_t
*image_descriptor
,
234 const void *image_data
, hsa_access_permission_t access_permission
,
235 hsa_ext_image_t
*image
);
236 hsa_status_t
hsa_ext_program_destroy (hsa_ext_program_t program
);
237 hsa_status_t
hsa_ext_image_copy (hsa_agent_t agent
, hsa_ext_image_t src_image
,
238 const hsa_dim3_t
*src_offset
,
239 hsa_ext_image_t dst_image
,
240 const hsa_dim3_t
*dst_offset
,
241 const hsa_dim3_t
*range
);
242 hsa_status_t
hsa_ext_image_clear (hsa_agent_t agent
, hsa_ext_image_t image
,
244 const hsa_ext_image_region_t
*image_region
);
247 HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS
= 0x3000,
248 HSA_EXT_AGENT_INFO_IMAGE_1DA_MAX_ELEMENTS
= 0x3001,
249 HSA_EXT_AGENT_INFO_IMAGE_1DB_MAX_ELEMENTS
= 0x3002,
250 HSA_EXT_AGENT_INFO_IMAGE_2D_MAX_ELEMENTS
= 0x3003,
251 HSA_EXT_AGENT_INFO_IMAGE_2DA_MAX_ELEMENTS
= 0x3004,
252 HSA_EXT_AGENT_INFO_IMAGE_2DDEPTH_MAX_ELEMENTS
= 0x3005,
253 HSA_EXT_AGENT_INFO_IMAGE_2DADEPTH_MAX_ELEMENTS
= 0x3006,
254 HSA_EXT_AGENT_INFO_IMAGE_3D_MAX_ELEMENTS
= 0x3007,
255 HSA_EXT_AGENT_INFO_IMAGE_ARRAY_MAX_LAYERS
= 0x3008,
256 HSA_EXT_AGENT_INFO_MAX_IMAGE_RD_HANDLES
= 0x3009,
257 HSA_EXT_AGENT_INFO_MAX_IMAGE_RORW_HANDLES
= 0x300A,
258 HSA_EXT_AGENT_INFO_MAX_SAMPLER_HANDLERS
= 0x300B
261 hsa_ext_sampler_create (hsa_agent_t agent
,
262 const hsa_ext_sampler_descriptor_t
*sampler_descriptor
,
263 hsa_ext_sampler_t
*sampler
);
265 #endif /* _HSA_EXT_FINALIZE_H */