hsa_ext_image.h revision 1.1 1 1.1 mrg ////////////////////////////////////////////////////////////////////////////////
2 1.1 mrg //
3 1.1 mrg // Copyright (C) 2014-2020 Advanced Micro Devices Inc. All rights reserved.
4 1.1 mrg //
5 1.1 mrg // Permission is hereby granted, free of charge, to any person or organization
6 1.1 mrg // obtaining a copy of the software and accompanying documentation covered by
7 1.1 mrg // this license (the "Software") to use, reproduce, display, distribute,
8 1.1 mrg // execute, and transmit the Software, and to prepare derivative works of the
9 1.1 mrg // Software, and to permit third-parties to whom the Software is furnished to
10 1.1 mrg // do so, all subject to the following:
11 1.1 mrg //
12 1.1 mrg // The copyright notices in the Software and this entire statement, including
13 1.1 mrg // the above license grant, this restriction and the following disclaimer,
14 1.1 mrg // must be included in all copies of the Software, in whole or in part, and
15 1.1 mrg // all derivative works of the Software, unless such copies or derivative
16 1.1 mrg // works are solely in the form of machine-executable object code generated by
17 1.1 mrg // a source language processor.
18 1.1 mrg //
19 1.1 mrg // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 1.1 mrg // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 1.1 mrg // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 1.1 mrg // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 1.1 mrg // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 1.1 mrg // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 1.1 mrg // DEALINGS IN THE SOFTWARE.
26 1.1 mrg //
27 1.1 mrg ////////////////////////////////////////////////////////////////////////////////
28 1.1 mrg
29 1.1 mrg #ifndef HSA_EXT_IMAGE_H
30 1.1 mrg #define HSA_EXT_IMAGE_H
31 1.1 mrg
32 1.1 mrg #include "hsa.h"
33 1.1 mrg
34 1.1 mrg #undef HSA_API
35 1.1 mrg #ifdef HSA_EXPORT_IMAGES
36 1.1 mrg #define HSA_API HSA_API_EXPORT
37 1.1 mrg #else
38 1.1 mrg #define HSA_API HSA_API_IMPORT
39 1.1 mrg #endif
40 1.1 mrg
41 1.1 mrg #ifdef __cplusplus
42 1.1 mrg extern "C" {
43 1.1 mrg #endif /*__cplusplus*/
44 1.1 mrg
45 1.1 mrg /** \defgroup ext-images Images and Samplers
46 1.1 mrg * @{
47 1.1 mrg */
48 1.1 mrg
49 1.1 mrg /**
50 1.1 mrg * @brief Enumeration constants added to ::hsa_status_t by this extension.
51 1.1 mrg *
52 1.1 mrg * @remark Additions to hsa_status_t
53 1.1 mrg */
54 1.1 mrg enum {
55 1.1 mrg /**
56 1.1 mrg * Image format is not supported.
57 1.1 mrg */
58 1.1 mrg HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED = 0x3000,
59 1.1 mrg /**
60 1.1 mrg * Image size is not supported.
61 1.1 mrg */
62 1.1 mrg HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED = 0x3001,
63 1.1 mrg /**
64 1.1 mrg * Image pitch is not supported or invalid.
65 1.1 mrg */
66 1.1 mrg HSA_EXT_STATUS_ERROR_IMAGE_PITCH_UNSUPPORTED = 0x3002,
67 1.1 mrg /**
68 1.1 mrg * Sampler descriptor is not supported or invalid.
69 1.1 mrg */
70 1.1 mrg HSA_EXT_STATUS_ERROR_SAMPLER_DESCRIPTOR_UNSUPPORTED = 0x3003
71 1.1 mrg };
72 1.1 mrg
73 1.1 mrg /**
74 1.1 mrg * @brief Enumeration constants added to ::hsa_agent_info_t by this
75 1.1 mrg * extension.
76 1.1 mrg *
77 1.1 mrg * @remark Additions to hsa_agent_info_t
78 1.1 mrg */
79 1.1 mrg enum {
80 1.1 mrg /**
81 1.1 mrg * Maximum number of elements in 1D images. Must be at least 16384. The type
82 1.1 mrg * of this attribute is size_t.
83 1.1 mrg */
84 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS = 0x3000,
85 1.1 mrg /**
86 1.1 mrg * Maximum number of elements in 1DA images. Must be at least 16384. The type
87 1.1 mrg * of this attribute is size_t.
88 1.1 mrg */
89 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_1DA_MAX_ELEMENTS = 0x3001,
90 1.1 mrg /**
91 1.1 mrg * Maximum number of elements in 1DB images. Must be at least 65536. The type
92 1.1 mrg * of this attribute is size_t.
93 1.1 mrg */
94 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_1DB_MAX_ELEMENTS = 0x3002,
95 1.1 mrg /**
96 1.1 mrg * Maximum dimensions (width, height) of 2D images, in image elements. The X
97 1.1 mrg * and Y maximums must be at least 16384. The type of this attribute is
98 1.1 mrg * size_t[2].
99 1.1 mrg */
100 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_2D_MAX_ELEMENTS = 0x3003,
101 1.1 mrg /**
102 1.1 mrg * Maximum dimensions (width, height) of 2DA images, in image elements. The X
103 1.1 mrg * and Y maximums must be at least 16384. The type of this attribute is
104 1.1 mrg * size_t[2].
105 1.1 mrg */
106 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_2DA_MAX_ELEMENTS = 0x3004,
107 1.1 mrg /**
108 1.1 mrg * Maximum dimensions (width, height) of 2DDEPTH images, in image
109 1.1 mrg * elements. The X and Y maximums must be at least 16384. The type of this
110 1.1 mrg * attribute is size_t[2].
111 1.1 mrg */
112 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_2DDEPTH_MAX_ELEMENTS = 0x3005,
113 1.1 mrg /**
114 1.1 mrg * Maximum dimensions (width, height) of 2DADEPTH images, in image
115 1.1 mrg * elements. The X and Y maximums must be at least 16384. The type of this
116 1.1 mrg * attribute is size_t[2].
117 1.1 mrg */
118 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_2DADEPTH_MAX_ELEMENTS = 0x3006,
119 1.1 mrg /**
120 1.1 mrg * Maximum dimensions (width, height, depth) of 3D images, in image
121 1.1 mrg * elements. The maximum along any dimension must be at least 2048. The type
122 1.1 mrg * of this attribute is size_t[3].
123 1.1 mrg */
124 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_3D_MAX_ELEMENTS = 0x3007,
125 1.1 mrg /**
126 1.1 mrg * Maximum number of image layers in a image array. Must be at least 2048. The
127 1.1 mrg * type of this attribute is size_t.
128 1.1 mrg */
129 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_ARRAY_MAX_LAYERS = 0x3008,
130 1.1 mrg /**
131 1.1 mrg * Maximum number of read-only image handles that can be created for an agent at any one
132 1.1 mrg * time. Must be at least 128. The type of this attribute is size_t.
133 1.1 mrg */
134 1.1 mrg HSA_EXT_AGENT_INFO_MAX_IMAGE_RD_HANDLES = 0x3009,
135 1.1 mrg /**
136 1.1 mrg * Maximum number of write-only and read-write image handles (combined) that
137 1.1 mrg * can be created for an agent at any one time. Must be at least 64. The type of this
138 1.1 mrg * attribute is size_t.
139 1.1 mrg */
140 1.1 mrg HSA_EXT_AGENT_INFO_MAX_IMAGE_RORW_HANDLES = 0x300A,
141 1.1 mrg /**
142 1.1 mrg * Maximum number of sampler handlers that can be created for an agent at any one
143 1.1 mrg * time. Must be at least 16. The type of this attribute is size_t.
144 1.1 mrg */
145 1.1 mrg HSA_EXT_AGENT_INFO_MAX_SAMPLER_HANDLERS = 0x300B,
146 1.1 mrg /**
147 1.1 mrg * Image pitch alignment. The agent only supports linear image data
148 1.1 mrg * layouts with a row pitch that is a multiple of this value. Must be
149 1.1 mrg * a power of 2. The type of this attribute is size_t.
150 1.1 mrg */
151 1.1 mrg HSA_EXT_AGENT_INFO_IMAGE_LINEAR_ROW_PITCH_ALIGNMENT = 0x300C
152 1.1 mrg };
153 1.1 mrg
154 1.1 mrg /**
155 1.1 mrg * @brief Image handle, populated by ::hsa_ext_image_create or
156 1.1 mrg * ::hsa_ext_image_create_with_layout. Image
157 1.1 mrg * handles are only unique within an agent, not across agents.
158 1.1 mrg *
159 1.1 mrg */
160 1.1 mrg typedef struct hsa_ext_image_s {
161 1.1 mrg /**
162 1.1 mrg * Opaque handle. For a given agent, two handles reference the same object of
163 1.1 mrg * the enclosing type if and only if they are equal.
164 1.1 mrg */
165 1.1 mrg uint64_t handle;
166 1.1 mrg
167 1.1 mrg } hsa_ext_image_t;
168 1.1 mrg
169 1.1 mrg /**
170 1.1 mrg * @brief Geometry associated with the image. This specifies the
171 1.1 mrg * number of image dimensions and whether the image is an image
172 1.1 mrg * array. See the <em>Image Geometry</em> section in the <em>HSA
173 1.1 mrg * Programming Reference Manual</em> for definitions on each
174 1.1 mrg * geometry. The enumeration values match the BRIG type @p
175 1.1 mrg * hsa_ext_brig_image_geometry_t.
176 1.1 mrg */
177 1.1 mrg typedef enum {
178 1.1 mrg /**
179 1.1 mrg * One-dimensional image addressed by width coordinate.
180 1.1 mrg */
181 1.1 mrg HSA_EXT_IMAGE_GEOMETRY_1D = 0,
182 1.1 mrg
183 1.1 mrg /**
184 1.1 mrg * Two-dimensional image addressed by width and height coordinates.
185 1.1 mrg */
186 1.1 mrg HSA_EXT_IMAGE_GEOMETRY_2D = 1,
187 1.1 mrg
188 1.1 mrg /**
189 1.1 mrg * Three-dimensional image addressed by width, height, and depth coordinates.
190 1.1 mrg */
191 1.1 mrg HSA_EXT_IMAGE_GEOMETRY_3D = 2,
192 1.1 mrg
193 1.1 mrg /**
194 1.1 mrg * Array of one-dimensional images with the same size and format. 1D arrays
195 1.1 mrg * are addressed by width and index coordinate.
196 1.1 mrg */
197 1.1 mrg HSA_EXT_IMAGE_GEOMETRY_1DA = 3,
198 1.1 mrg
199 1.1 mrg /**
200 1.1 mrg * Array of two-dimensional images with the same size and format. 2D arrays
201 1.1 mrg * are addressed by width, height, and index coordinates.
202 1.1 mrg */
203 1.1 mrg HSA_EXT_IMAGE_GEOMETRY_2DA = 4,
204 1.1 mrg
205 1.1 mrg /**
206 1.1 mrg * One-dimensional image addressed by width coordinate. It has
207 1.1 mrg * specific restrictions compared to ::HSA_EXT_IMAGE_GEOMETRY_1D. An
208 1.1 mrg * image with an opaque image data layout will always use a linear
209 1.1 mrg * image data layout, and one with an explicit image data layout
210 1.1 mrg * must specify ::HSA_EXT_IMAGE_DATA_LAYOUT_LINEAR.
211 1.1 mrg */
212 1.1 mrg HSA_EXT_IMAGE_GEOMETRY_1DB = 5,
213 1.1 mrg
214 1.1 mrg /**
215 1.1 mrg * Two-dimensional depth image addressed by width and height coordinates.
216 1.1 mrg */
217 1.1 mrg HSA_EXT_IMAGE_GEOMETRY_2DDEPTH = 6,
218 1.1 mrg
219 1.1 mrg /**
220 1.1 mrg * Array of two-dimensional depth images with the same size and format. 2D
221 1.1 mrg * arrays are addressed by width, height, and index coordinates.
222 1.1 mrg */
223 1.1 mrg HSA_EXT_IMAGE_GEOMETRY_2DADEPTH = 7
224 1.1 mrg } hsa_ext_image_geometry_t;
225 1.1 mrg
226 1.1 mrg /**
227 1.1 mrg * @brief Channel type associated with the elements of an image. See
228 1.1 mrg * the <em>Channel Type</em> section in the <em>HSA Programming Reference
229 1.1 mrg * Manual</em> for definitions on each channel type. The
230 1.1 mrg * enumeration values and definition match the BRIG type @p
231 1.1 mrg * hsa_ext_brig_image_channel_type_t.
232 1.1 mrg */
233 1.1 mrg typedef enum {
234 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT8 = 0,
235 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT16 = 1,
236 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT8 = 2,
237 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT16 = 3,
238 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT24 = 4,
239 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555 = 5,
240 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565 = 6,
241 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_101010 = 7,
242 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT8 = 8,
243 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT16 = 9,
244 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT32 = 10,
245 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8 = 11,
246 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16 = 12,
247 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32 = 13,
248 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_HALF_FLOAT = 14,
249 1.1 mrg HSA_EXT_IMAGE_CHANNEL_TYPE_FLOAT = 15
250 1.1 mrg } hsa_ext_image_channel_type_t;
251 1.1 mrg
252 1.1 mrg /**
253 1.1 mrg * @brief A fixed-size type used to represent ::hsa_ext_image_channel_type_t constants.
254 1.1 mrg */
255 1.1 mrg typedef uint32_t hsa_ext_image_channel_type32_t;
256 1.1 mrg
257 1.1 mrg /**
258 1.1 mrg *
259 1.1 mrg * @brief Channel order associated with the elements of an image. See
260 1.1 mrg * the <em>Channel Order</em> section in the <em>HSA Programming Reference
261 1.1 mrg * Manual</em> for definitions on each channel order. The
262 1.1 mrg * enumeration values match the BRIG type @p
263 1.1 mrg * hsa_ext_brig_image_channel_order_t.
264 1.1 mrg */
265 1.1 mrg typedef enum {
266 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_A = 0,
267 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_R = 1,
268 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_RX = 2,
269 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_RG = 3,
270 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_RGX = 4,
271 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_RA = 5,
272 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_RGB = 6,
273 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_RGBX = 7,
274 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_RGBA = 8,
275 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_BGRA = 9,
276 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_ARGB = 10,
277 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_ABGR = 11,
278 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_SRGB = 12,
279 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBX = 13,
280 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBA = 14,
281 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_SBGRA = 15,
282 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_INTENSITY = 16,
283 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_LUMINANCE = 17,
284 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH = 18,
285 1.1 mrg HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH_STENCIL = 19
286 1.1 mrg } hsa_ext_image_channel_order_t;
287 1.1 mrg
288 1.1 mrg /**
289 1.1 mrg * @brief A fixed-size type used to represent ::hsa_ext_image_channel_order_t constants.
290 1.1 mrg */
291 1.1 mrg typedef uint32_t hsa_ext_image_channel_order32_t;
292 1.1 mrg
293 1.1 mrg
294 1.1 mrg /**
295 1.1 mrg * @brief Image format.
296 1.1 mrg */
297 1.1 mrg typedef struct hsa_ext_image_format_s {
298 1.1 mrg /**
299 1.1 mrg * Channel type.
300 1.1 mrg */
301 1.1 mrg hsa_ext_image_channel_type32_t channel_type;
302 1.1 mrg
303 1.1 mrg /**
304 1.1 mrg * Channel order.
305 1.1 mrg */
306 1.1 mrg hsa_ext_image_channel_order32_t channel_order;
307 1.1 mrg } hsa_ext_image_format_t;
308 1.1 mrg
309 1.1 mrg /**
310 1.1 mrg * @brief Implementation independent image descriptor.
311 1.1 mrg */
312 1.1 mrg typedef struct hsa_ext_image_descriptor_s {
313 1.1 mrg /**
314 1.1 mrg * Image geometry.
315 1.1 mrg */
316 1.1 mrg hsa_ext_image_geometry_t geometry;
317 1.1 mrg /**
318 1.1 mrg * Width of the image, in components.
319 1.1 mrg */
320 1.1 mrg size_t width;
321 1.1 mrg /**
322 1.1 mrg * Height of the image, in components. Only used if the geometry is
323 1.1 mrg * ::HSA_EXT_IMAGE_GEOMETRY_2D, ::HSA_EXT_IMAGE_GEOMETRY_3D,
324 1.1 mrg * HSA_EXT_IMAGE_GEOMETRY_2DA, HSA_EXT_IMAGE_GEOMETRY_2DDEPTH, or
325 1.1 mrg * HSA_EXT_IMAGE_GEOMETRY_2DADEPTH, otherwise must be 0.
326 1.1 mrg */
327 1.1 mrg size_t height;
328 1.1 mrg /**
329 1.1 mrg * Depth of the image, in components. Only used if the geometry is
330 1.1 mrg * ::HSA_EXT_IMAGE_GEOMETRY_3D, otherwise must be 0.
331 1.1 mrg */
332 1.1 mrg size_t depth;
333 1.1 mrg /**
334 1.1 mrg * Number of image layers in the image array. Only used if the geometry is
335 1.1 mrg * ::HSA_EXT_IMAGE_GEOMETRY_1DA, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or
336 1.1 mrg * HSA_EXT_IMAGE_GEOMETRY_2DADEPTH, otherwise must be 0.
337 1.1 mrg */
338 1.1 mrg size_t array_size;
339 1.1 mrg /**
340 1.1 mrg * Image format.
341 1.1 mrg */
342 1.1 mrg hsa_ext_image_format_t format;
343 1.1 mrg } hsa_ext_image_descriptor_t;
344 1.1 mrg
345 1.1 mrg /**
346 1.1 mrg * @brief Image capability.
347 1.1 mrg */
348 1.1 mrg typedef enum {
349 1.1 mrg /**
350 1.1 mrg * Images of this geometry, format, and layout are not supported by
351 1.1 mrg * the agent.
352 1.1 mrg */
353 1.1 mrg HSA_EXT_IMAGE_CAPABILITY_NOT_SUPPORTED = 0x0,
354 1.1 mrg /**
355 1.1 mrg * Read-only images of this geometry, format, and layout are
356 1.1 mrg * supported by the agent.
357 1.1 mrg */
358 1.1 mrg HSA_EXT_IMAGE_CAPABILITY_READ_ONLY = 0x1,
359 1.1 mrg /**
360 1.1 mrg * Write-only images of this geometry, format, and layout are
361 1.1 mrg * supported by the agent.
362 1.1 mrg */
363 1.1 mrg HSA_EXT_IMAGE_CAPABILITY_WRITE_ONLY = 0x2,
364 1.1 mrg /**
365 1.1 mrg * Read-write images of this geometry, format, and layout are
366 1.1 mrg * supported by the agent.
367 1.1 mrg */
368 1.1 mrg HSA_EXT_IMAGE_CAPABILITY_READ_WRITE = 0x4,
369 1.1 mrg /**
370 1.1 mrg * @deprecated Images of this geometry, format, and layout can be accessed from
371 1.1 mrg * read-modify-write atomic operations in the agent.
372 1.1 mrg */
373 1.1 mrg HSA_EXT_IMAGE_CAPABILITY_READ_MODIFY_WRITE = 0x8,
374 1.1 mrg /**
375 1.1 mrg * Images of this geometry, format, and layout are guaranteed to
376 1.1 mrg * have a consistent data layout regardless of how they are
377 1.1 mrg * accessed by the associated agent.
378 1.1 mrg */
379 1.1 mrg HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT = 0x10
380 1.1 mrg } hsa_ext_image_capability_t;
381 1.1 mrg
382 1.1 mrg /**
383 1.1 mrg * @brief Image data layout.
384 1.1 mrg *
385 1.1 mrg * @details An image data layout denotes such aspects of image data
386 1.1 mrg * layout as tiling and organization of channels in memory. Some image
387 1.1 mrg * data layouts may only apply to specific image geometries, formats,
388 1.1 mrg * and access permissions. Different agents may support different
389 1.1 mrg * image layout identifiers, including vendor specific layouts. Note
390 1.1 mrg * that an agent may not support the same image data layout for
391 1.1 mrg * different access permissions to images with the same image
392 1.1 mrg * geometry, size, and format. If multiple agents support the same
393 1.1 mrg * image data layout then it is possible to use separate image handles
394 1.1 mrg * for each agent that references the same image data.
395 1.1 mrg */
396 1.1 mrg
397 1.1 mrg typedef enum {
398 1.1 mrg /**
399 1.1 mrg * An implementation specific opaque image data layout which can
400 1.1 mrg * vary depending on the agent, geometry, image format, image size,
401 1.1 mrg * and access permissions.
402 1.1 mrg */
403 1.1 mrg HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE = 0x0,
404 1.1 mrg /**
405 1.1 mrg * The image data layout is specified by the following rules in
406 1.1 mrg * ascending byte address order. For a 3D image, 2DA image array,
407 1.1 mrg * or 1DA image array, the image data is stored as a linear sequence
408 1.1 mrg * of adjacent 2D image slices, 2D images, or 1D images
409 1.1 mrg * respectively, spaced according to the slice pitch. Each 2D image
410 1.1 mrg * is stored as a linear sequence of adjacent image rows, spaced
411 1.1 mrg * according to the row pitch. Each 1D or 1DB image is stored as a
412 1.1 mrg * single image row. Each image row is stored as a linear sequence
413 1.1 mrg * of image elements. Each image element is stored as a linear
414 1.1 mrg * sequence of image components specified by the left to right
415 1.1 mrg * channel order definition. Each image component is stored using
416 1.1 mrg * the memory type specified by the channel type.
417 1.1 mrg *
418 1.1 mrg * The 1DB image geometry always uses the linear image data layout.
419 1.1 mrg */
420 1.1 mrg HSA_EXT_IMAGE_DATA_LAYOUT_LINEAR = 0x1
421 1.1 mrg } hsa_ext_image_data_layout_t;
422 1.1 mrg
423 1.1 mrg /**
424 1.1 mrg * @brief Retrieve the supported image capabilities for a given combination of
425 1.1 mrg * agent, geometry, and image format for an image created with an opaque image
426 1.1 mrg * data layout.
427 1.1 mrg *
428 1.1 mrg * @param[in] agent Agent to be associated with the image handle.
429 1.1 mrg *
430 1.1 mrg * @param[in] geometry Geometry.
431 1.1 mrg *
432 1.1 mrg * @param[in] image_format Pointer to an image format. Must not be NULL.
433 1.1 mrg *
434 1.1 mrg * @param[out] capability_mask Pointer to a memory location where the HSA
435 1.1 mrg * runtime stores a bit-mask of supported image capability
436 1.1 mrg * (::hsa_ext_image_capability_t) values. Must not be NULL.
437 1.1 mrg *
438 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
439 1.1 mrg *
440 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
441 1.1 mrg * initialized.
442 1.1 mrg *
443 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
444 1.1 mrg *
445 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_format is
446 1.1 mrg * NULL, or @p capability_mask is NULL.
447 1.1 mrg */
448 1.1 mrg hsa_status_t HSA_API hsa_ext_image_get_capability(
449 1.1 mrg hsa_agent_t agent,
450 1.1 mrg hsa_ext_image_geometry_t geometry,
451 1.1 mrg const hsa_ext_image_format_t *image_format,
452 1.1 mrg uint32_t *capability_mask);
453 1.1 mrg
454 1.1 mrg /**
455 1.1 mrg * @brief Retrieve the supported image capabilities for a given combination of
456 1.1 mrg * agent, geometry, image format, and image layout for an image created with
457 1.1 mrg * an explicit image data layout.
458 1.1 mrg *
459 1.1 mrg * @param[in] agent Agent to be associated with the image handle.
460 1.1 mrg *
461 1.1 mrg * @param[in] geometry Geometry.
462 1.1 mrg *
463 1.1 mrg * @param[in] image_format Pointer to an image format. Must not be NULL.
464 1.1 mrg *
465 1.1 mrg * @param[in] image_data_layout The image data layout.
466 1.1 mrg * It is invalid to use ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE; use
467 1.1 mrg * ::hsa_ext_image_get_capability instead.
468 1.1 mrg *
469 1.1 mrg * @param[out] capability_mask Pointer to a memory location where the HSA
470 1.1 mrg * runtime stores a bit-mask of supported image capability
471 1.1 mrg * (::hsa_ext_image_capability_t) values. Must not be NULL.
472 1.1 mrg *
473 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
474 1.1 mrg *
475 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
476 1.1 mrg * initialized.
477 1.1 mrg *
478 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
479 1.1 mrg *
480 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_format is
481 1.1 mrg * NULL, @p image_data_layout is ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE,
482 1.1 mrg * or @p capability_mask is NULL.
483 1.1 mrg */
484 1.1 mrg hsa_status_t HSA_API hsa_ext_image_get_capability_with_layout(
485 1.1 mrg hsa_agent_t agent,
486 1.1 mrg hsa_ext_image_geometry_t geometry,
487 1.1 mrg const hsa_ext_image_format_t *image_format,
488 1.1 mrg hsa_ext_image_data_layout_t image_data_layout,
489 1.1 mrg uint32_t *capability_mask);
490 1.1 mrg
491 1.1 mrg /**
492 1.1 mrg * @brief Agent specific image size and alignment requirements, populated by
493 1.1 mrg * ::hsa_ext_image_data_get_info and ::hsa_ext_image_data_get_info_with_layout.
494 1.1 mrg */
495 1.1 mrg typedef struct hsa_ext_image_data_info_s {
496 1.1 mrg /**
497 1.1 mrg * Image data size, in bytes.
498 1.1 mrg */
499 1.1 mrg size_t size;
500 1.1 mrg
501 1.1 mrg /**
502 1.1 mrg * Image data alignment, in bytes. Must always be a power of 2.
503 1.1 mrg */
504 1.1 mrg size_t alignment;
505 1.1 mrg
506 1.1 mrg } hsa_ext_image_data_info_t;
507 1.1 mrg
508 1.1 mrg /**
509 1.1 mrg * @brief Retrieve the image data requirements for a given combination of agent, image
510 1.1 mrg * descriptor, and access permission for an image created with an opaque image
511 1.1 mrg * data layout.
512 1.1 mrg *
513 1.1 mrg * @details The optimal image data size and alignment requirements may
514 1.1 mrg * vary depending on the image attributes specified in @p
515 1.1 mrg * image_descriptor, the @p access_permission, and the @p agent. Also,
516 1.1 mrg * different implementations of the HSA runtime may return different
517 1.1 mrg * requirements for the same input values.
518 1.1 mrg *
519 1.1 mrg * The implementation must return the same image data requirements for
520 1.1 mrg * different access permissions with matching image descriptors as long
521 1.1 mrg * as ::hsa_ext_image_get_capability reports
522 1.1 mrg * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT. Image
523 1.1 mrg * descriptors match if they have the same values, with the exception
524 1.1 mrg * that s-form channel orders match the corresponding non-s-form
525 1.1 mrg * channel order and vice versa.
526 1.1 mrg *
527 1.1 mrg * @param[in] agent Agent to be associated with the image handle.
528 1.1 mrg *
529 1.1 mrg * @param[in] image_descriptor Pointer to an image descriptor. Must not be NULL.
530 1.1 mrg *
531 1.1 mrg * @param[in] access_permission Access permission of the image when
532 1.1 mrg * accessed by @p agent. The access permission defines how the agent
533 1.1 mrg * is allowed to access the image and must match the corresponding
534 1.1 mrg * HSAIL image handle type. The @p agent must support the image format
535 1.1 mrg * specified in @p image_descriptor for the given @p
536 1.1 mrg * access_permission.
537 1.1 mrg *
538 1.1 mrg * @param[out] image_data_info Memory location where the runtime stores the
539 1.1 mrg * size and alignment requirements. Must not be NULL.
540 1.1 mrg *
541 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
542 1.1 mrg *
543 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
544 1.1 mrg * initialized.
545 1.1 mrg *
546 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
547 1.1 mrg *
548 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED The @p
549 1.1 mrg * agent does not support the image format specified by @p
550 1.1 mrg * image_descriptor with the specified @p access_permission.
551 1.1 mrg *
552 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED The agent
553 1.1 mrg * does not support the image dimensions specified by @p
554 1.1 mrg * image_descriptor with the specified @p access_permission.
555 1.1 mrg *
556 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_descriptor is NULL, @p
557 1.1 mrg * access_permission is not a valid access permission value, or @p
558 1.1 mrg * image_data_info is NULL.
559 1.1 mrg */
560 1.1 mrg hsa_status_t HSA_API hsa_ext_image_data_get_info(
561 1.1 mrg hsa_agent_t agent,
562 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
563 1.1 mrg hsa_access_permission_t access_permission,
564 1.1 mrg hsa_ext_image_data_info_t *image_data_info);
565 1.1 mrg
566 1.1 mrg /**
567 1.1 mrg * @brief Retrieve the image data requirements for a given combination of
568 1.1 mrg * image descriptor, access permission, image data layout, image data row pitch,
569 1.1 mrg * and image data slice pitch for an image created with an explicit image
570 1.1 mrg * data layout.
571 1.1 mrg *
572 1.1 mrg * @details The image data size and alignment requirements may vary
573 1.1 mrg * depending on the image attributes specified in @p image_descriptor,
574 1.1 mrg * the @p access_permission, and the image layout. However, different
575 1.1 mrg * implementations of the HSA runtime will return the same
576 1.1 mrg * requirements for the same input values.
577 1.1 mrg *
578 1.1 mrg * The implementation must return the same image data requirements for
579 1.1 mrg * different access permissions with matching image descriptors and
580 1.1 mrg * matching image layouts as long as ::hsa_ext_image_get_capability
581 1.1 mrg * reports
582 1.1 mrg * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT. Image
583 1.1 mrg * descriptors match if they have the same values, with the exception
584 1.1 mrg * that s-form channel orders match the corresponding non-s-form
585 1.1 mrg * channel order and vice versa. Image layouts match if they are the
586 1.1 mrg * same image data layout and use the same image row and slice pitch
587 1.1 mrg * values.
588 1.1 mrg *
589 1.1 mrg * @param[in] image_descriptor Pointer to an image descriptor. Must not be NULL.
590 1.1 mrg *
591 1.1 mrg * @param[in] access_permission Access permission of the image when
592 1.1 mrg * accessed by an agent. The access permission defines how the agent
593 1.1 mrg * is allowed to access the image and must match the corresponding
594 1.1 mrg * HSAIL image handle type.
595 1.1 mrg *
596 1.1 mrg * @param[in] image_data_layout The image data layout to use.
597 1.1 mrg * It is invalid to use ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE; use
598 1.1 mrg * ::hsa_ext_image_data_get_info instead.
599 1.1 mrg *
600 1.1 mrg * @param[in] image_data_row_pitch The size in bytes for a single row
601 1.1 mrg * of the image in the image data. If 0 is specified then the default
602 1.1 mrg * row pitch value is used: image width * image element byte size.
603 1.1 mrg * The value used must be greater than or equal to the default row
604 1.1 mrg * pitch, and be a multiple of the image element byte size. For the
605 1.1 mrg * linear image layout it must also be a multiple of the image linear
606 1.1 mrg * row pitch alignment for the agents that will access the image data
607 1.1 mrg * using image instructions.
608 1.1 mrg *
609 1.1 mrg * @param[in] image_data_slice_pitch The size in bytes of a single
610 1.1 mrg * slice of a 3D image, or the size in bytes of each image layer in an
611 1.1 mrg * image array in the image data. If 0 is specified then the default
612 1.1 mrg * slice pitch value is used: row pitch * height if geometry is
613 1.1 mrg * ::HSA_EXT_IMAGE_GEOMETRY_3D, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or
614 1.1 mrg * ::HSA_EXT_IMAGE_GEOMETRY_2DADEPTH; row pitch if geometry is
615 1.1 mrg * ::HSA_EXT_IMAGE_GEOMETRY_1DA; and 0 otherwise. The value used must
616 1.1 mrg * be 0 if the default slice pitch is 0, be greater than or equal to
617 1.1 mrg * the default slice pitch, and be a multiple of the row pitch.
618 1.1 mrg *
619 1.1 mrg * @param[out] image_data_info Memory location where the runtime stores the
620 1.1 mrg * size and alignment requirements. Must not be NULL.
621 1.1 mrg *
622 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
623 1.1 mrg *
624 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
625 1.1 mrg * initialized.
626 1.1 mrg *
627 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED The image
628 1.1 mrg * format specified by @p image_descriptor is not supported for the
629 1.1 mrg * @p access_permission and @p image_data_layout specified.
630 1.1 mrg *
631 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED The image
632 1.1 mrg * dimensions specified by @p image_descriptor are not supported for
633 1.1 mrg * the @p access_permission and @p image_data_layout specified.
634 1.1 mrg *
635 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_PITCH_UNSUPPORTED The row and
636 1.1 mrg * slice pitch specified by @p image_data_row_pitch and @p
637 1.1 mrg * image_data_slice_pitch are invalid or not supported.
638 1.1 mrg *
639 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_descriptor is
640 1.1 mrg * NULL, @p image_data_layout is ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE,
641 1.1 mrg * or @p image_data_info is NULL.
642 1.1 mrg */
643 1.1 mrg hsa_status_t HSA_API hsa_ext_image_data_get_info_with_layout(
644 1.1 mrg hsa_agent_t agent,
645 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
646 1.1 mrg hsa_access_permission_t access_permission,
647 1.1 mrg hsa_ext_image_data_layout_t image_data_layout,
648 1.1 mrg size_t image_data_row_pitch,
649 1.1 mrg size_t image_data_slice_pitch,
650 1.1 mrg hsa_ext_image_data_info_t *image_data_info);
651 1.1 mrg
652 1.1 mrg /**
653 1.1 mrg * @brief Creates an agent specific image handle to an image with an
654 1.1 mrg * opaque image data layout.
655 1.1 mrg *
656 1.1 mrg * @details Images with an opaque image data layout created with
657 1.1 mrg * different access permissions but matching image descriptors and
658 1.1 mrg * same agent can share the same image data if
659 1.1 mrg * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT is reported
660 1.1 mrg * by ::hsa_ext_image_get_capability for the image format specified in
661 1.1 mrg * the image descriptor. Image descriptors match if they have the same
662 1.1 mrg * values, with the exception that s-form channel orders match the
663 1.1 mrg * corresponding non-s-form channel order and vice versa.
664 1.1 mrg *
665 1.1 mrg * If necessary, an application can use image operations (import,
666 1.1 mrg * export, copy, clear) to prepare the image for the intended use
667 1.1 mrg * regardless of the access permissions.
668 1.1 mrg *
669 1.1 mrg * @param[in] agent agent to be associated with the image handle created.
670 1.1 mrg *
671 1.1 mrg * @param[in] image_descriptor Pointer to an image descriptor. Must not be NULL.
672 1.1 mrg *
673 1.1 mrg * @param[in] image_data Image data buffer that must have been allocated
674 1.1 mrg * according to the size and alignment requirements dictated by
675 1.1 mrg * ::hsa_ext_image_data_get_info. Must not be NULL.
676 1.1 mrg *
677 1.1 mrg * Any previous memory contents are preserved upon creation. The application is
678 1.1 mrg * responsible for ensuring that the lifetime of the image data exceeds that of
679 1.1 mrg * all the associated images.
680 1.1 mrg *
681 1.1 mrg * @param[in] access_permission Access permission of the image when
682 1.1 mrg * accessed by agent. The access permission defines how the agent
683 1.1 mrg * is allowed to access the image using the image handle created and
684 1.1 mrg * must match the corresponding HSAIL image handle type. The agent
685 1.1 mrg * must support the image format specified in @p image_descriptor for
686 1.1 mrg * the given @p access_permission.
687 1.1 mrg *
688 1.1 mrg * @param[out] image Pointer to a memory location where the HSA runtime stores
689 1.1 mrg * the newly created image handle. Must not be NULL.
690 1.1 mrg *
691 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
692 1.1 mrg *
693 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
694 1.1 mrg * initialized.
695 1.1 mrg *
696 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
697 1.1 mrg *
698 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED The agent
699 1.1 mrg * does not have the capability to support the image format contained
700 1.1 mrg * in @p image_descriptor using the specified @p access_permission.
701 1.1 mrg *
702 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED The agent
703 1.1 mrg * does not support the image dimensions specified by @p
704 1.1 mrg * image_descriptor using the specified @p access_permission.
705 1.1 mrg *
706 1.1 mrg * @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate
707 1.1 mrg * the required resources.
708 1.1 mrg *
709 1.1 mrg * support the creation of more image handles with the given @p access_permission).
710 1.1 mrg *
711 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_descriptor is NULL, @p
712 1.1 mrg * image_data is NULL, @p image_data does not have a valid alignment,
713 1.1 mrg * @p access_permission is not a valid access permission
714 1.1 mrg * value, or @p image is NULL.
715 1.1 mrg */
716 1.1 mrg hsa_status_t HSA_API hsa_ext_image_create(
717 1.1 mrg hsa_agent_t agent,
718 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
719 1.1 mrg const void *image_data,
720 1.1 mrg hsa_access_permission_t access_permission,
721 1.1 mrg hsa_ext_image_t *image);
722 1.1 mrg
723 1.1 mrg /**
724 1.1 mrg * @brief Creates an agent specific image handle to an image with an explicit
725 1.1 mrg * image data layout.
726 1.1 mrg *
727 1.1 mrg * @details Images with an explicit image data layout created with
728 1.1 mrg * different access permissions but matching image descriptors and
729 1.1 mrg * matching image layout can share the same image data if
730 1.1 mrg * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT is reported
731 1.1 mrg * by ::hsa_ext_image_get_capability_with_layout for the image format
732 1.1 mrg * specified in the image descriptor and specified image data
733 1.1 mrg * layout. Image descriptors match if they have the same values, with
734 1.1 mrg * the exception that s-form channel orders match the corresponding
735 1.1 mrg * non-s-form channel order and vice versa. Image layouts match if
736 1.1 mrg * they are the same image data layout and use the same image row and
737 1.1 mrg * slice values.
738 1.1 mrg *
739 1.1 mrg * If necessary, an application can use image operations (import, export, copy,
740 1.1 mrg * clear) to prepare the image for the intended use regardless of the access
741 1.1 mrg * permissions.
742 1.1 mrg *
743 1.1 mrg * @param[in] agent agent to be associated with the image handle created.
744 1.1 mrg *
745 1.1 mrg * @param[in] image_descriptor Pointer to an image descriptor. Must not be NULL.
746 1.1 mrg *
747 1.1 mrg * @param[in] image_data Image data buffer that must have been allocated
748 1.1 mrg * according to the size and alignment requirements dictated by
749 1.1 mrg * ::hsa_ext_image_data_get_info_with_layout. Must not be NULL.
750 1.1 mrg *
751 1.1 mrg * Any previous memory contents are preserved upon creation. The application is
752 1.1 mrg * responsible for ensuring that the lifetime of the image data exceeds that of
753 1.1 mrg * all the associated images.
754 1.1 mrg *
755 1.1 mrg * @param[in] access_permission Access permission of the image when
756 1.1 mrg * accessed by the agent. The access permission defines how the agent
757 1.1 mrg * is allowed to access the image and must match the corresponding
758 1.1 mrg * HSAIL image handle type. The agent must support the image format
759 1.1 mrg * specified in @p image_descriptor for the given @p access_permission
760 1.1 mrg * and @p image_data_layout.
761 1.1 mrg *
762 1.1 mrg * @param[in] image_data_layout The image data layout to use for the
763 1.1 mrg * @p image_data. It is invalid to use
764 1.1 mrg * ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE; use ::hsa_ext_image_create
765 1.1 mrg * instead.
766 1.1 mrg *
767 1.1 mrg * @param[in] image_data_row_pitch The size in bytes for a single row
768 1.1 mrg * of the image in the image data. If 0 is specified then the default
769 1.1 mrg * row pitch value is used: image width * image element byte size.
770 1.1 mrg * The value used must be greater than or equal to the default row
771 1.1 mrg * pitch, and be a multiple of the image element byte size. For the
772 1.1 mrg * linear image layout it must also be a multiple of the image linear
773 1.1 mrg * row pitch alignment for the agents that will access the image data
774 1.1 mrg * using image instructions.
775 1.1 mrg *
776 1.1 mrg * @param[in] image_data_slice_pitch The size in bytes of a single
777 1.1 mrg * slice of a 3D image, or the size in bytes of each image layer in an
778 1.1 mrg * image array in the image data. If 0 is specified then the default
779 1.1 mrg * slice pitch value is used: row pitch * height if geometry is
780 1.1 mrg * ::HSA_EXT_IMAGE_GEOMETRY_3D, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or
781 1.1 mrg * ::HSA_EXT_IMAGE_GEOMETRY_2DADEPTH; row pitch if geometry is
782 1.1 mrg * ::HSA_EXT_IMAGE_GEOMETRY_1DA; and 0 otherwise. The value used must
783 1.1 mrg * be 0 if the default slice pitch is 0, be greater than or equal to
784 1.1 mrg * the default slice pitch, and be a multiple of the row pitch.
785 1.1 mrg *
786 1.1 mrg * @param[out] image Pointer to a memory location where the HSA runtime stores
787 1.1 mrg * the newly created image handle. Must not be NULL.
788 1.1 mrg *
789 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
790 1.1 mrg *
791 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
792 1.1 mrg * initialized.
793 1.1 mrg *
794 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
795 1.1 mrg *
796 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED The agent does
797 1.1 mrg * not have the capability to support the image format contained in the image
798 1.1 mrg * descriptor using the specified @p access_permission and @p image_data_layout.
799 1.1 mrg *
800 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED The agent
801 1.1 mrg * does not support the image dimensions specified by @p
802 1.1 mrg * image_descriptor using the specified @p access_permission and @p
803 1.1 mrg * image_data_layout.
804 1.1 mrg *
805 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_PITCH_UNSUPPORTED The agent does
806 1.1 mrg * not support the row and slice pitch specified by @p image_data_row_pitch
807 1.1 mrg * and @p image_data_slice_pitch, or the values are invalid.
808 1.1 mrg *
809 1.1 mrg * @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate
810 1.1 mrg * the required resources.
811 1.1 mrg *
812 1.1 mrg * support the creation of more image handles with the given @p access_permission).
813 1.1 mrg *
814 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_descriptor is NULL, @p
815 1.1 mrg * image_data is NULL, @p image_data does not have a valid alignment,
816 1.1 mrg * @p image_data_layout is ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE,
817 1.1 mrg * or @p image is NULL.
818 1.1 mrg */
819 1.1 mrg hsa_status_t HSA_API hsa_ext_image_create_with_layout(
820 1.1 mrg hsa_agent_t agent,
821 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
822 1.1 mrg const void *image_data,
823 1.1 mrg hsa_access_permission_t access_permission,
824 1.1 mrg hsa_ext_image_data_layout_t image_data_layout,
825 1.1 mrg size_t image_data_row_pitch,
826 1.1 mrg size_t image_data_slice_pitch,
827 1.1 mrg hsa_ext_image_t *image);
828 1.1 mrg
829 1.1 mrg /**
830 1.1 mrg * @brief Destroy an image handle previously created using ::hsa_ext_image_create or
831 1.1 mrg * ::hsa_ext_image_create_with_layout.
832 1.1 mrg *
833 1.1 mrg * @details Destroying the image handle does not free the associated image data,
834 1.1 mrg * or modify its contents. The application should not destroy an image handle while
835 1.1 mrg * there are references to it queued for execution or currently being used in a
836 1.1 mrg * kernel dispatch.
837 1.1 mrg *
838 1.1 mrg * @param[in] agent Agent associated with the image handle.
839 1.1 mrg *
840 1.1 mrg * @param[in] image Image handle to destroy.
841 1.1 mrg *
842 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
843 1.1 mrg *
844 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
845 1.1 mrg * initialized.
846 1.1 mrg *
847 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
848 1.1 mrg */
849 1.1 mrg hsa_status_t HSA_API hsa_ext_image_destroy(
850 1.1 mrg hsa_agent_t agent,
851 1.1 mrg hsa_ext_image_t image);
852 1.1 mrg
853 1.1 mrg /**
854 1.1 mrg * @brief Copies a portion of one image (the source) to another image (the
855 1.1 mrg * destination).
856 1.1 mrg *
857 1.1 mrg * @details The source and destination image formats should be the
858 1.1 mrg * same, with the exception that s-form channel orders match the
859 1.1 mrg * corresponding non-s-form channel order and vice versa. For example,
860 1.1 mrg * it is allowed to copy a source image with a channel order of
861 1.1 mrg * HSA_EXT_IMAGE_CHANNEL_ORDER_SRGB to a destination image with a
862 1.1 mrg * channel order of HSA_EXT_IMAGE_CHANNEL_ORDER_RGB.
863 1.1 mrg *
864 1.1 mrg * The source and destination images do not have to be of the same geometry and
865 1.1 mrg * appropriate scaling is performed by the HSA runtime. It is possible to copy
866 1.1 mrg * subregions between any combinations of source and destination geometries, provided
867 1.1 mrg * that the dimensions of the subregions are the same. For example, it is
868 1.1 mrg * allowed to copy a rectangular region from a 2D image to a slice of a 3D
869 1.1 mrg * image.
870 1.1 mrg *
871 1.1 mrg * If the source and destination image data overlap, or the combination of
872 1.1 mrg * offset and range references an out-out-bounds element in any of the images,
873 1.1 mrg * the behavior is undefined.
874 1.1 mrg *
875 1.1 mrg * @param[in] agent Agent associated with both the source and destination image handles.
876 1.1 mrg *
877 1.1 mrg * @param[in] src_image Image handle of source image. The agent associated with the source
878 1.1 mrg * image handle must be identical to that of the destination image.
879 1.1 mrg *
880 1.1 mrg * @param[in] src_offset Pointer to the offset within the source image where to
881 1.1 mrg * copy the data from. Must not be NULL.
882 1.1 mrg *
883 1.1 mrg * @param[in] dst_image Image handle of destination image.
884 1.1 mrg *
885 1.1 mrg * @param[in] dst_offset Pointer to the offset within the destination
886 1.1 mrg * image where to copy the data. Must not be NULL.
887 1.1 mrg *
888 1.1 mrg * @param[in] range Dimensions of the image portion to be copied. The HSA
889 1.1 mrg * runtime computes the size of the image data to be copied using this
890 1.1 mrg * argument. Must not be NULL.
891 1.1 mrg *
892 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
893 1.1 mrg *
894 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
895 1.1 mrg * initialized.
896 1.1 mrg *
897 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
898 1.1 mrg *
899 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p src_offset is
900 1.1 mrg * NULL, @p dst_offset is NULL, or @p range is NULL.
901 1.1 mrg */
902 1.1 mrg hsa_status_t HSA_API hsa_ext_image_copy(
903 1.1 mrg hsa_agent_t agent,
904 1.1 mrg hsa_ext_image_t src_image,
905 1.1 mrg const hsa_dim3_t* src_offset,
906 1.1 mrg hsa_ext_image_t dst_image,
907 1.1 mrg const hsa_dim3_t* dst_offset,
908 1.1 mrg const hsa_dim3_t* range);
909 1.1 mrg
910 1.1 mrg /**
911 1.1 mrg * @brief Image region.
912 1.1 mrg */
913 1.1 mrg typedef struct hsa_ext_image_region_s {
914 1.1 mrg /**
915 1.1 mrg * Offset within an image (in coordinates).
916 1.1 mrg */
917 1.1 mrg hsa_dim3_t offset;
918 1.1 mrg
919 1.1 mrg /**
920 1.1 mrg * Dimension size of the image range (in coordinates). The x, y, and z dimensions
921 1.1 mrg * correspond to width, height, and depth or index respectively.
922 1.1 mrg */
923 1.1 mrg hsa_dim3_t range;
924 1.1 mrg } hsa_ext_image_region_t;
925 1.1 mrg
926 1.1 mrg /**
927 1.1 mrg * @brief Import a linearly organized image data from memory directly to an
928 1.1 mrg * image handle.
929 1.1 mrg *
930 1.1 mrg * @details This operation updates the image data referenced by the image handle
931 1.1 mrg * from the source memory. The size of the data imported from memory is
932 1.1 mrg * implicitly derived from the image region.
933 1.1 mrg *
934 1.1 mrg * It is the application's responsibility to avoid out of bounds memory access.
935 1.1 mrg *
936 1.1 mrg * None of the source memory or destination image data memory can
937 1.1 mrg * overlap. Overlapping of any of the source and destination image
938 1.1 mrg * data memory within the import operation produces undefined results.
939 1.1 mrg *
940 1.1 mrg * @param[in] agent Agent associated with the image handle.
941 1.1 mrg *
942 1.1 mrg * @param[in] src_memory Source memory. Must not be NULL.
943 1.1 mrg *
944 1.1 mrg * @param[in] src_row_pitch The size in bytes of a single row of the image in the
945 1.1 mrg * source memory. If the value is smaller than the destination image region
946 1.1 mrg * width * image element byte size, then region width * image element byte
947 1.1 mrg * size is used.
948 1.1 mrg *
949 1.1 mrg * @param[in] src_slice_pitch The size in bytes of a single 2D slice of a 3D image,
950 1.1 mrg * or the size in bytes of each image layer in an image array in the source memory.
951 1.1 mrg * If the geometry is ::HSA_EXT_IMAGE_GEOMETRY_1DA and the value is smaller than the
952 1.1 mrg * value used for @p src_row_pitch, then the value used for @p src_row_pitch is used.
953 1.1 mrg * If the geometry is ::HSA_EXT_IMAGE_GEOMETRY_3D, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or
954 1.1 mrg * HSA_EXT_IMAGE_GEOMETRY_2DADEPTH and the value is smaller than the value used for
955 1.1 mrg * @p src_row_pitch * destination image region height, then the value used for
956 1.1 mrg * @p src_row_pitch * destination image region height is used.
957 1.1 mrg * Otherwise, the value is not used.
958 1.1 mrg *
959 1.1 mrg * @param[in] dst_image Image handle of destination image.
960 1.1 mrg *
961 1.1 mrg * @param[in] image_region Pointer to the image region to be updated. Must not
962 1.1 mrg * be NULL.
963 1.1 mrg *
964 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
965 1.1 mrg *
966 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
967 1.1 mrg * initialized.
968 1.1 mrg *
969 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
970 1.1 mrg *
971 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p src_memory is NULL, or @p
972 1.1 mrg * image_region is NULL.
973 1.1 mrg *
974 1.1 mrg */
975 1.1 mrg hsa_status_t HSA_API hsa_ext_image_import(
976 1.1 mrg hsa_agent_t agent,
977 1.1 mrg const void *src_memory,
978 1.1 mrg size_t src_row_pitch,
979 1.1 mrg size_t src_slice_pitch,
980 1.1 mrg hsa_ext_image_t dst_image,
981 1.1 mrg const hsa_ext_image_region_t *image_region);
982 1.1 mrg
983 1.1 mrg /**
984 1.1 mrg * @brief Export the image data to linearly organized memory.
985 1.1 mrg *
986 1.1 mrg * @details The operation updates the destination memory with the image data of
987 1.1 mrg * @p src_image. The size of the data exported to memory is implicitly derived
988 1.1 mrg * from the image region.
989 1.1 mrg *
990 1.1 mrg * It is the application's responsibility to avoid out of bounds memory access.
991 1.1 mrg *
992 1.1 mrg * None of the destination memory or source image data memory can
993 1.1 mrg * overlap. Overlapping of any of the source and destination image
994 1.1 mrg * data memory within the export operation produces undefined results.
995 1.1 mrg *
996 1.1 mrg * @param[in] agent Agent associated with the image handle.
997 1.1 mrg *
998 1.1 mrg * @param[in] src_image Image handle of source image.
999 1.1 mrg *
1000 1.1 mrg * @param[in] dst_memory Destination memory. Must not be NULL.
1001 1.1 mrg *
1002 1.1 mrg * @param[in] dst_row_pitch The size in bytes of a single row of the image in the
1003 1.1 mrg * destination memory. If the value is smaller than the source image region
1004 1.1 mrg * width * image element byte size, then region width * image element byte
1005 1.1 mrg * size is used.
1006 1.1 mrg *
1007 1.1 mrg * @param[in] dst_slice_pitch The size in bytes of a single 2D slice of a 3D image,
1008 1.1 mrg * or the size in bytes of each image in an image array in the destination memory.
1009 1.1 mrg * If the geometry is ::HSA_EXT_IMAGE_GEOMETRY_1DA and the value is smaller than the
1010 1.1 mrg * value used for @p dst_row_pitch, then the value used for @p dst_row_pitch is used.
1011 1.1 mrg * If the geometry is ::HSA_EXT_IMAGE_GEOMETRY_3D, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or
1012 1.1 mrg * HSA_EXT_IMAGE_GEOMETRY_2DADEPTH and the value is smaller than the value used for
1013 1.1 mrg * @p dst_row_pitch * source image region height, then the value used for
1014 1.1 mrg * @p dst_row_pitch * source image region height is used.
1015 1.1 mrg * Otherwise, the value is not used.
1016 1.1 mrg *
1017 1.1 mrg * @param[in] image_region Pointer to the image region to be exported. Must not
1018 1.1 mrg * be NULL.
1019 1.1 mrg *
1020 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
1021 1.1 mrg *
1022 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
1023 1.1 mrg * initialized.
1024 1.1 mrg *
1025 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
1026 1.1 mrg *
1027 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p dst_memory is NULL, or @p
1028 1.1 mrg * image_region is NULL.
1029 1.1 mrg */
1030 1.1 mrg hsa_status_t HSA_API hsa_ext_image_export(
1031 1.1 mrg hsa_agent_t agent,
1032 1.1 mrg hsa_ext_image_t src_image,
1033 1.1 mrg void *dst_memory,
1034 1.1 mrg size_t dst_row_pitch,
1035 1.1 mrg size_t dst_slice_pitch,
1036 1.1 mrg const hsa_ext_image_region_t *image_region);
1037 1.1 mrg
1038 1.1 mrg /**
1039 1.1 mrg * @brief Clear a region of an image so that every image element has
1040 1.1 mrg * the specified value.
1041 1.1 mrg *
1042 1.1 mrg * @param[in] agent Agent associated with the image handle.
1043 1.1 mrg *
1044 1.1 mrg * @param[in] image Image handle for image to be cleared.
1045 1.1 mrg *
1046 1.1 mrg * @param[in] data The value to which to set each image element being
1047 1.1 mrg * cleared. It is specified as an array of image component values. The
1048 1.1 mrg * number of array elements must match the number of access components
1049 1.1 mrg * for the image channel order. The type of each array element must
1050 1.1 mrg * match the image access type of the image channel type. When the
1051 1.1 mrg * value is used to set the value of an image element, the conversion
1052 1.1 mrg * method corresponding to the image channel type is used. See the
1053 1.1 mrg * <em>Channel Order</em> section and <em>Channel Type</em> section in
1054 1.1 mrg * the <em>HSA Programming Reference Manual</em> for more
1055 1.1 mrg * information. Must not be NULL.
1056 1.1 mrg *
1057 1.1 mrg * @param[in] image_region Pointer to the image region to clear. Must not be
1058 1.1 mrg * NULL. If the region references an out-out-bounds element, the behavior is
1059 1.1 mrg * undefined.
1060 1.1 mrg *
1061 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
1062 1.1 mrg *
1063 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
1064 1.1 mrg * initialized.
1065 1.1 mrg *
1066 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
1067 1.1 mrg *
1068 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p data is NULL, or @p
1069 1.1 mrg * image_region is NULL.
1070 1.1 mrg */
1071 1.1 mrg hsa_status_t HSA_API hsa_ext_image_clear(
1072 1.1 mrg hsa_agent_t agent,
1073 1.1 mrg hsa_ext_image_t image,
1074 1.1 mrg const void* data,
1075 1.1 mrg const hsa_ext_image_region_t *image_region);
1076 1.1 mrg
1077 1.1 mrg /**
1078 1.1 mrg * @brief Sampler handle. Samplers are populated by
1079 1.1 mrg * ::hsa_ext_sampler_create. Sampler handles are only unique within an
1080 1.1 mrg * agent, not across agents.
1081 1.1 mrg */
1082 1.1 mrg typedef struct hsa_ext_sampler_s {
1083 1.1 mrg /**
1084 1.1 mrg * Opaque handle. For a given agent, two handles reference the same object of
1085 1.1 mrg * the enclosing type if and only if they are equal.
1086 1.1 mrg */
1087 1.1 mrg uint64_t handle;
1088 1.1 mrg } hsa_ext_sampler_t;
1089 1.1 mrg
1090 1.1 mrg /**
1091 1.1 mrg * @brief Sampler address modes. The sampler address mode describes
1092 1.1 mrg * the processing of out-of-range image coordinates. See the
1093 1.1 mrg * <em>Addressing Mode</em> section in the <em>HSA Programming Reference
1094 1.1 mrg * Manual</em> for definitions on each address mode. The values
1095 1.1 mrg * match the BRIG type @p hsa_ext_brig_sampler_addressing_t.
1096 1.1 mrg */
1097 1.1 mrg typedef enum {
1098 1.1 mrg /**
1099 1.1 mrg * Out-of-range coordinates are not handled.
1100 1.1 mrg */
1101 1.1 mrg HSA_EXT_SAMPLER_ADDRESSING_MODE_UNDEFINED = 0,
1102 1.1 mrg
1103 1.1 mrg /**
1104 1.1 mrg * Clamp out-of-range coordinates to the image edge.
1105 1.1 mrg */
1106 1.1 mrg HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE = 1,
1107 1.1 mrg
1108 1.1 mrg /**
1109 1.1 mrg * Clamp out-of-range coordinates to the image border color.
1110 1.1 mrg */
1111 1.1 mrg HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER = 2,
1112 1.1 mrg
1113 1.1 mrg /**
1114 1.1 mrg * Wrap out-of-range coordinates back into the valid coordinate
1115 1.1 mrg * range so the image appears as repeated tiles.
1116 1.1 mrg */
1117 1.1 mrg HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT = 3,
1118 1.1 mrg
1119 1.1 mrg /**
1120 1.1 mrg * Mirror out-of-range coordinates back into the valid coordinate
1121 1.1 mrg * range so the image appears as repeated tiles with every other
1122 1.1 mrg * tile a reflection.
1123 1.1 mrg */
1124 1.1 mrg HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT = 4
1125 1.1 mrg
1126 1.1 mrg } hsa_ext_sampler_addressing_mode_t;
1127 1.1 mrg
1128 1.1 mrg /**
1129 1.1 mrg * @brief A fixed-size type used to represent ::hsa_ext_sampler_addressing_mode_t constants.
1130 1.1 mrg */
1131 1.1 mrg typedef uint32_t hsa_ext_sampler_addressing_mode32_t;
1132 1.1 mrg
1133 1.1 mrg /**
1134 1.1 mrg * @brief Sampler coordinate normalization modes. See the
1135 1.1 mrg * <em>Coordinate Normalization Mode</em> section in the <em>HSA
1136 1.1 mrg * Programming Reference Manual</em> for definitions on each
1137 1.1 mrg * coordinate normalization mode. The values match the BRIG type @p
1138 1.1 mrg * hsa_ext_brig_sampler_coord_normalization_t.
1139 1.1 mrg */
1140 1.1 mrg typedef enum {
1141 1.1 mrg
1142 1.1 mrg /**
1143 1.1 mrg * Coordinates are used to directly address an image element.
1144 1.1 mrg */
1145 1.1 mrg HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED = 0,
1146 1.1 mrg
1147 1.1 mrg /**
1148 1.1 mrg * Coordinates are scaled by the image dimension size before being
1149 1.1 mrg * used to address an image element.
1150 1.1 mrg */
1151 1.1 mrg HSA_EXT_SAMPLER_COORDINATE_MODE_NORMALIZED = 1
1152 1.1 mrg
1153 1.1 mrg } hsa_ext_sampler_coordinate_mode_t;
1154 1.1 mrg
1155 1.1 mrg /**
1156 1.1 mrg * @brief A fixed-size type used to represent ::hsa_ext_sampler_coordinate_mode_t constants.
1157 1.1 mrg */
1158 1.1 mrg typedef uint32_t hsa_ext_sampler_coordinate_mode32_t;
1159 1.1 mrg
1160 1.1 mrg
1161 1.1 mrg /**
1162 1.1 mrg * @brief Sampler filter modes. See the <em>Filter Mode</em> section
1163 1.1 mrg * in the <em>HSA Programming Reference Manual</em> for definitions
1164 1.1 mrg * on each address mode. The enumeration values match the BRIG type @p
1165 1.1 mrg * hsa_ext_brig_sampler_filter_t.
1166 1.1 mrg */
1167 1.1 mrg typedef enum {
1168 1.1 mrg /**
1169 1.1 mrg * Filter to the image element nearest (in Manhattan distance) to the
1170 1.1 mrg * specified coordinate.
1171 1.1 mrg */
1172 1.1 mrg HSA_EXT_SAMPLER_FILTER_MODE_NEAREST = 0,
1173 1.1 mrg
1174 1.1 mrg /**
1175 1.1 mrg * Filter to the image element calculated by combining the elements in a 2x2
1176 1.1 mrg * square block or 2x2x2 cube block around the specified coordinate. The
1177 1.1 mrg * elements are combined using linear interpolation.
1178 1.1 mrg */
1179 1.1 mrg HSA_EXT_SAMPLER_FILTER_MODE_LINEAR = 1
1180 1.1 mrg
1181 1.1 mrg } hsa_ext_sampler_filter_mode_t;
1182 1.1 mrg
1183 1.1 mrg /**
1184 1.1 mrg * @brief A fixed-size type used to represent ::hsa_ext_sampler_filter_mode_t constants.
1185 1.1 mrg */
1186 1.1 mrg typedef uint32_t hsa_ext_sampler_filter_mode32_t;
1187 1.1 mrg
1188 1.1 mrg /**
1189 1.1 mrg * @brief Implementation independent sampler descriptor.
1190 1.1 mrg */
1191 1.1 mrg typedef struct hsa_ext_sampler_descriptor_s {
1192 1.1 mrg /**
1193 1.1 mrg * Sampler coordinate mode describes the normalization of image coordinates.
1194 1.1 mrg */
1195 1.1 mrg hsa_ext_sampler_coordinate_mode32_t coordinate_mode;
1196 1.1 mrg
1197 1.1 mrg /**
1198 1.1 mrg * Sampler filter type describes the type of sampling performed.
1199 1.1 mrg */
1200 1.1 mrg hsa_ext_sampler_filter_mode32_t filter_mode;
1201 1.1 mrg
1202 1.1 mrg /**
1203 1.1 mrg * Sampler address mode describes the processing of out-of-range image
1204 1.1 mrg * coordinates.
1205 1.1 mrg */
1206 1.1 mrg hsa_ext_sampler_addressing_mode32_t address_mode;
1207 1.1 mrg
1208 1.1 mrg } hsa_ext_sampler_descriptor_t;
1209 1.1 mrg
1210 1.1 mrg /**
1211 1.1 mrg * @brief Create an agent specific sampler handle for a given agent
1212 1.1 mrg * independent sampler descriptor and agent.
1213 1.1 mrg *
1214 1.1 mrg * @param[in] agent Agent to be associated with the sampler handle created.
1215 1.1 mrg *
1216 1.1 mrg * @param[in] sampler_descriptor Pointer to a sampler descriptor. Must not be
1217 1.1 mrg * NULL.
1218 1.1 mrg *
1219 1.1 mrg * @param[out] sampler Memory location where the HSA runtime stores the newly
1220 1.1 mrg * created sampler handle. Must not be NULL.
1221 1.1 mrg *
1222 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
1223 1.1 mrg *
1224 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
1225 1.1 mrg * initialized.
1226 1.1 mrg *
1227 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
1228 1.1 mrg *
1229 1.1 mrg * @retval ::HSA_EXT_STATUS_ERROR_SAMPLER_DESCRIPTOR_UNSUPPORTED The
1230 1.1 mrg * @p agent does not have the capability to support the properties
1231 1.1 mrg * specified by @p sampler_descriptor or it is invalid.
1232 1.1 mrg *
1233 1.1 mrg * @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate
1234 1.1 mrg * the required resources.
1235 1.1 mrg *
1236 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p sampler_descriptor is NULL, or
1237 1.1 mrg * @p sampler is NULL.
1238 1.1 mrg */
1239 1.1 mrg hsa_status_t HSA_API hsa_ext_sampler_create(
1240 1.1 mrg hsa_agent_t agent,
1241 1.1 mrg const hsa_ext_sampler_descriptor_t *sampler_descriptor,
1242 1.1 mrg hsa_ext_sampler_t *sampler);
1243 1.1 mrg
1244 1.1 mrg /**
1245 1.1 mrg * @brief Destroy a sampler handle previously created using ::hsa_ext_sampler_create.
1246 1.1 mrg *
1247 1.1 mrg * @details The sampler handle should not be destroyed while there are
1248 1.1 mrg * references to it queued for execution or currently being used in a
1249 1.1 mrg * kernel dispatch.
1250 1.1 mrg *
1251 1.1 mrg * @param[in] agent Agent associated with the sampler handle.
1252 1.1 mrg *
1253 1.1 mrg * @param[in] sampler Sampler handle to destroy.
1254 1.1 mrg *
1255 1.1 mrg * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully.
1256 1.1 mrg *
1257 1.1 mrg * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
1258 1.1 mrg * initialized.
1259 1.1 mrg *
1260 1.1 mrg * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid.
1261 1.1 mrg */
1262 1.1 mrg hsa_status_t HSA_API hsa_ext_sampler_destroy(
1263 1.1 mrg hsa_agent_t agent,
1264 1.1 mrg hsa_ext_sampler_t sampler);
1265 1.1 mrg
1266 1.1 mrg
1267 1.1 mrg #define hsa_ext_images_1_00
1268 1.1 mrg
1269 1.1 mrg /**
1270 1.1 mrg * @brief The function pointer table for the images v1.00 extension. Can be returned by ::hsa_system_get_extension_table or ::hsa_system_get_major_extension_table.
1271 1.1 mrg */
1272 1.1 mrg typedef struct hsa_ext_images_1_00_pfn_s {
1273 1.1 mrg
1274 1.1 mrg hsa_status_t (*hsa_ext_image_get_capability)(
1275 1.1 mrg hsa_agent_t agent,
1276 1.1 mrg hsa_ext_image_geometry_t geometry,
1277 1.1 mrg const hsa_ext_image_format_t *image_format,
1278 1.1 mrg uint32_t *capability_mask);
1279 1.1 mrg
1280 1.1 mrg hsa_status_t (*hsa_ext_image_data_get_info)(
1281 1.1 mrg hsa_agent_t agent,
1282 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
1283 1.1 mrg hsa_access_permission_t access_permission,
1284 1.1 mrg hsa_ext_image_data_info_t *image_data_info);
1285 1.1 mrg
1286 1.1 mrg hsa_status_t (*hsa_ext_image_create)(
1287 1.1 mrg hsa_agent_t agent,
1288 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
1289 1.1 mrg const void *image_data,
1290 1.1 mrg hsa_access_permission_t access_permission,
1291 1.1 mrg hsa_ext_image_t *image);
1292 1.1 mrg
1293 1.1 mrg hsa_status_t (*hsa_ext_image_destroy)(
1294 1.1 mrg hsa_agent_t agent,
1295 1.1 mrg hsa_ext_image_t image);
1296 1.1 mrg
1297 1.1 mrg hsa_status_t (*hsa_ext_image_copy)(
1298 1.1 mrg hsa_agent_t agent,
1299 1.1 mrg hsa_ext_image_t src_image,
1300 1.1 mrg const hsa_dim3_t* src_offset,
1301 1.1 mrg hsa_ext_image_t dst_image,
1302 1.1 mrg const hsa_dim3_t* dst_offset,
1303 1.1 mrg const hsa_dim3_t* range);
1304 1.1 mrg
1305 1.1 mrg hsa_status_t (*hsa_ext_image_import)(
1306 1.1 mrg hsa_agent_t agent,
1307 1.1 mrg const void *src_memory,
1308 1.1 mrg size_t src_row_pitch,
1309 1.1 mrg size_t src_slice_pitch,
1310 1.1 mrg hsa_ext_image_t dst_image,
1311 1.1 mrg const hsa_ext_image_region_t *image_region);
1312 1.1 mrg
1313 1.1 mrg hsa_status_t (*hsa_ext_image_export)(
1314 1.1 mrg hsa_agent_t agent,
1315 1.1 mrg hsa_ext_image_t src_image,
1316 1.1 mrg void *dst_memory,
1317 1.1 mrg size_t dst_row_pitch,
1318 1.1 mrg size_t dst_slice_pitch,
1319 1.1 mrg const hsa_ext_image_region_t *image_region);
1320 1.1 mrg
1321 1.1 mrg hsa_status_t (*hsa_ext_image_clear)(
1322 1.1 mrg hsa_agent_t agent,
1323 1.1 mrg hsa_ext_image_t image,
1324 1.1 mrg const void* data,
1325 1.1 mrg const hsa_ext_image_region_t *image_region);
1326 1.1 mrg
1327 1.1 mrg hsa_status_t (*hsa_ext_sampler_create)(
1328 1.1 mrg hsa_agent_t agent,
1329 1.1 mrg const hsa_ext_sampler_descriptor_t *sampler_descriptor,
1330 1.1 mrg hsa_ext_sampler_t *sampler);
1331 1.1 mrg
1332 1.1 mrg hsa_status_t (*hsa_ext_sampler_destroy)(
1333 1.1 mrg hsa_agent_t agent,
1334 1.1 mrg hsa_ext_sampler_t sampler);
1335 1.1 mrg
1336 1.1 mrg } hsa_ext_images_1_00_pfn_t;
1337 1.1 mrg
1338 1.1 mrg #define hsa_ext_images_1
1339 1.1 mrg
1340 1.1 mrg /**
1341 1.1 mrg * @brief The function pointer table for the images v1 extension. Can be returned by ::hsa_system_get_extension_table or ::hsa_system_get_major_extension_table.
1342 1.1 mrg */
1343 1.1 mrg typedef struct hsa_ext_images_1_pfn_s {
1344 1.1 mrg
1345 1.1 mrg hsa_status_t (*hsa_ext_image_get_capability)(
1346 1.1 mrg hsa_agent_t agent,
1347 1.1 mrg hsa_ext_image_geometry_t geometry,
1348 1.1 mrg const hsa_ext_image_format_t *image_format,
1349 1.1 mrg uint32_t *capability_mask);
1350 1.1 mrg
1351 1.1 mrg hsa_status_t (*hsa_ext_image_data_get_info)(
1352 1.1 mrg hsa_agent_t agent,
1353 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
1354 1.1 mrg hsa_access_permission_t access_permission,
1355 1.1 mrg hsa_ext_image_data_info_t *image_data_info);
1356 1.1 mrg
1357 1.1 mrg hsa_status_t (*hsa_ext_image_create)(
1358 1.1 mrg hsa_agent_t agent,
1359 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
1360 1.1 mrg const void *image_data,
1361 1.1 mrg hsa_access_permission_t access_permission,
1362 1.1 mrg hsa_ext_image_t *image);
1363 1.1 mrg
1364 1.1 mrg hsa_status_t (*hsa_ext_image_destroy)(
1365 1.1 mrg hsa_agent_t agent,
1366 1.1 mrg hsa_ext_image_t image);
1367 1.1 mrg
1368 1.1 mrg hsa_status_t (*hsa_ext_image_copy)(
1369 1.1 mrg hsa_agent_t agent,
1370 1.1 mrg hsa_ext_image_t src_image,
1371 1.1 mrg const hsa_dim3_t* src_offset,
1372 1.1 mrg hsa_ext_image_t dst_image,
1373 1.1 mrg const hsa_dim3_t* dst_offset,
1374 1.1 mrg const hsa_dim3_t* range);
1375 1.1 mrg
1376 1.1 mrg hsa_status_t (*hsa_ext_image_import)(
1377 1.1 mrg hsa_agent_t agent,
1378 1.1 mrg const void *src_memory,
1379 1.1 mrg size_t src_row_pitch,
1380 1.1 mrg size_t src_slice_pitch,
1381 1.1 mrg hsa_ext_image_t dst_image,
1382 1.1 mrg const hsa_ext_image_region_t *image_region);
1383 1.1 mrg
1384 1.1 mrg hsa_status_t (*hsa_ext_image_export)(
1385 1.1 mrg hsa_agent_t agent,
1386 1.1 mrg hsa_ext_image_t src_image,
1387 1.1 mrg void *dst_memory,
1388 1.1 mrg size_t dst_row_pitch,
1389 1.1 mrg size_t dst_slice_pitch,
1390 1.1 mrg const hsa_ext_image_region_t *image_region);
1391 1.1 mrg
1392 1.1 mrg hsa_status_t (*hsa_ext_image_clear)(
1393 1.1 mrg hsa_agent_t agent,
1394 1.1 mrg hsa_ext_image_t image,
1395 1.1 mrg const void* data,
1396 1.1 mrg const hsa_ext_image_region_t *image_region);
1397 1.1 mrg
1398 1.1 mrg hsa_status_t (*hsa_ext_sampler_create)(
1399 1.1 mrg hsa_agent_t agent,
1400 1.1 mrg const hsa_ext_sampler_descriptor_t *sampler_descriptor,
1401 1.1 mrg hsa_ext_sampler_t *sampler);
1402 1.1 mrg
1403 1.1 mrg hsa_status_t (*hsa_ext_sampler_destroy)(
1404 1.1 mrg hsa_agent_t agent,
1405 1.1 mrg hsa_ext_sampler_t sampler);
1406 1.1 mrg
1407 1.1 mrg hsa_status_t (*hsa_ext_image_get_capability_with_layout)(
1408 1.1 mrg hsa_agent_t agent,
1409 1.1 mrg hsa_ext_image_geometry_t geometry,
1410 1.1 mrg const hsa_ext_image_format_t *image_format,
1411 1.1 mrg hsa_ext_image_data_layout_t image_data_layout,
1412 1.1 mrg uint32_t *capability_mask);
1413 1.1 mrg
1414 1.1 mrg hsa_status_t (*hsa_ext_image_data_get_info_with_layout)(
1415 1.1 mrg hsa_agent_t agent,
1416 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
1417 1.1 mrg hsa_access_permission_t access_permission,
1418 1.1 mrg hsa_ext_image_data_layout_t image_data_layout,
1419 1.1 mrg size_t image_data_row_pitch,
1420 1.1 mrg size_t image_data_slice_pitch,
1421 1.1 mrg hsa_ext_image_data_info_t *image_data_info);
1422 1.1 mrg
1423 1.1 mrg hsa_status_t (*hsa_ext_image_create_with_layout)(
1424 1.1 mrg hsa_agent_t agent,
1425 1.1 mrg const hsa_ext_image_descriptor_t *image_descriptor,
1426 1.1 mrg const void *image_data,
1427 1.1 mrg hsa_access_permission_t access_permission,
1428 1.1 mrg hsa_ext_image_data_layout_t image_data_layout,
1429 1.1 mrg size_t image_data_row_pitch,
1430 1.1 mrg size_t image_data_slice_pitch,
1431 1.1 mrg hsa_ext_image_t *image);
1432 1.1 mrg
1433 1.1 mrg } hsa_ext_images_1_pfn_t;
1434 1.1 mrg /** @} */
1435 1.1 mrg
1436 1.1 mrg #ifdef __cplusplus
1437 1.1 mrg } // end extern "C" block
1438 1.1 mrg #endif /*__cplusplus*/
1439 1.1 mrg
1440 1.1 mrg #endif
1441