diff --git a/runtime/hsa-runtime/core/inc/amd_hsa_loader.hpp b/runtime/hsa-runtime/core/inc/amd_hsa_loader.hpp index 8cd2acc1d5..8e2dc4ed14 100644 --- a/runtime/hsa-runtime/core/inc/amd_hsa_loader.hpp +++ b/runtime/hsa-runtime/core/inc/amd_hsa_loader.hpp @@ -126,7 +126,7 @@ public: hsa_agent_t agent, hsa_access_permission_t image_permission, const hsa_ext_image_descriptor_t *image_descriptor, - const void *image_data, + void *image_data, hsa_ext_image_t *image_handle) = 0; virtual hsa_status_t ImageDestroy( diff --git a/runtime/hsa-runtime/core/inc/amd_loader_context.hpp b/runtime/hsa-runtime/core/inc/amd_loader_context.hpp index 27830ff369..dc41926c5f 100644 --- a/runtime/hsa-runtime/core/inc/amd_loader_context.hpp +++ b/runtime/hsa-runtime/core/inc/amd_loader_context.hpp @@ -73,7 +73,7 @@ public: hsa_status_t ImageCreate(hsa_agent_t agent, hsa_access_permission_t image_permission, const hsa_ext_image_descriptor_t* image_descriptor, - const void* image_data, hsa_ext_image_t* image_handle) override; + void* image_data, hsa_ext_image_t* image_handle) override; hsa_status_t ImageDestroy(hsa_agent_t agent, hsa_ext_image_t image_handle) override; diff --git a/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp b/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp index b61f187f6c..12639530b7 100644 --- a/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp @@ -561,7 +561,7 @@ bool LoaderContext::ImageExtensionSupported() { hsa_status_t LoaderContext::ImageCreate( hsa_agent_t agent, hsa_access_permission_t image_permission, - const hsa_ext_image_descriptor_t *image_descriptor, const void *image_data, + const hsa_ext_image_descriptor_t *image_descriptor, void *image_data, hsa_ext_image_t *image_handle) { assert(agent.handle); assert(image_descriptor); diff --git a/runtime/hsa-runtime/core/runtime/hsa_ext_interface.cpp b/runtime/hsa-runtime/core/runtime/hsa_ext_interface.cpp index 75ecb0b8f4..978fcc8b70 100644 --- a/runtime/hsa-runtime/core/runtime/hsa_ext_interface.cpp +++ b/runtime/hsa-runtime/core/runtime/hsa_ext_interface.cpp @@ -528,7 +528,7 @@ hsa_status_t hsa_ext_image_data_get_info( hsa_status_t hsa_ext_image_create( hsa_agent_t agent, const hsa_ext_image_descriptor_t* image_descriptor, - const void* image_data, hsa_access_permission_t access_permission, + void* image_data, hsa_access_permission_t access_permission, hsa_ext_image_t* image) { return core::Runtime::runtime_singleton_->extensions_.image_api .hsa_ext_image_create_fn(agent, image_descriptor, image_data, diff --git a/runtime/hsa-runtime/inc/hsa_ext_image.h b/runtime/hsa-runtime/inc/hsa_ext_image.h index 999a32367b..78fcc29057 100644 --- a/runtime/hsa-runtime/inc/hsa_ext_image.h +++ b/runtime/hsa-runtime/inc/hsa_ext_image.h @@ -61,24 +61,135 @@ extern "C" { */ /** - * @brief Image handle, populated by ::hsa_ext_image_create. Images + * @brief Enumeration constants added to ::hsa_status_t by this extension. + * + * @remark Additions to hsa_status_t + */ +enum { + /** + * Image format is not supported. + */ + HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED = 0x3000, + /** + * Image size is not supported. + */ + HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED = 0x3001, + /** + * Image pitch is not supported or invalid. + */ + HSA_EXT_STATUS_ERROR_IMAGE_PITCH_UNSUPPORTED = 0x3002, + /** + * Sampler descriptor is not supported or invalid. + */ + HSA_EXT_STATUS_ERROR_SAMPLER_DESCRIPTOR_UNSUPPORTED = 0x3003 +}; + +/** + * @brief Enumeration constants added to ::hsa_agent_info_t by this + * extension. + * + * @remark Additions to hsa_agent_info_t + */ +enum { + /** + * Maximum number of elements in 1D images. Must be at least 16384. The type + * of this attribute is size_t. + */ + HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS = 0x3000, + /** + * Maximum number of elements in 1DA images. Must be at least 16384. The type + * of this attribute is size_t. + */ + HSA_EXT_AGENT_INFO_IMAGE_1DA_MAX_ELEMENTS = 0x3001, + /** + * Maximum number of elements in 1DB images. Must be at least 65536. The type + * of this attribute is size_t. + */ + HSA_EXT_AGENT_INFO_IMAGE_1DB_MAX_ELEMENTS = 0x3002, + /** + * Maximum dimensions (width, height) of 2D images, in image elements. The X + * and Y maximums must be at least 16384. The type of this attribute is + * size_t[2]. + */ + HSA_EXT_AGENT_INFO_IMAGE_2D_MAX_ELEMENTS = 0x3003, + /** + * Maximum dimensions (width, height) of 2DA images, in image elements. The X + * and Y maximums must be at least 16384. The type of this attribute is + * size_t[2]. + */ + HSA_EXT_AGENT_INFO_IMAGE_2DA_MAX_ELEMENTS = 0x3004, + /** + * Maximum dimensions (width, height) of 2DDEPTH images, in image + * elements. The X and Y maximums must be at least 16384. The type of this + * attribute is size_t[2]. + */ + HSA_EXT_AGENT_INFO_IMAGE_2DDEPTH_MAX_ELEMENTS = 0x3005, + /** + * Maximum dimensions (width, height) of 2DADEPTH images, in image + * elements. The X and Y maximums must be at least 16384. The type of this + * attribute is size_t[2]. + */ + HSA_EXT_AGENT_INFO_IMAGE_2DADEPTH_MAX_ELEMENTS = 0x3006, + /** + * Maximum dimensions (width, height, depth) of 3D images, in image + * elements. The maximum along any dimension must be at least 2048. The type + * of this attribute is size_t[3]. + */ + HSA_EXT_AGENT_INFO_IMAGE_3D_MAX_ELEMENTS = 0x3007, + /** + * Maximum number of image layers in a image array. Must be at least 2048. The + * type of this attribute is size_t. + */ + HSA_EXT_AGENT_INFO_IMAGE_ARRAY_MAX_LAYERS = 0x3008, + /** + * Maximum number of read-only image handles that can be created for an agent at any one + * time. Must be at least 128. The type of this attribute is size_t. + */ + HSA_EXT_AGENT_INFO_MAX_IMAGE_RD_HANDLES = 0x3009, + /** + * Maximum number of write-only and read-write image handles (combined) that + * can be created for an agent at any one time. Must be at least 64. The type of this + * attribute is size_t. + */ + HSA_EXT_AGENT_INFO_MAX_IMAGE_RORW_HANDLES = 0x300A, + /** + * Maximum number of sampler handlers that can be created for an agent at any one + * time. Must be at least 16. The type of this attribute is size_t. + */ + HSA_EXT_AGENT_INFO_MAX_SAMPLER_HANDLERS = 0x300B, + /** + * Image pitch alignment. The agent only supports linear image data + * layouts with a row pitch that is a multiple of this value. Must be + * a power of 2. The type of this attribute is size_t. + */ + HSA_EXT_AGENT_INFO_IMAGE_LINEAR_ROW_PITCH_ALIGNMENT = 0x300C +}; + +/** + * @brief Image handle, populated by ::hsa_ext_image_create or + * ::hsa_ext_image_create_with_layout. Image * handles are only unique within an agent, not across agents. * */ typedef struct hsa_ext_image_s { /** - * Opaque handle. + * Opaque handle. For a given agent, two handles reference the same object of + * the enclosing type if and only if they are equal. */ - uint64_t handle; + uint64_t handle; } hsa_ext_image_t; /** - * @brief Geometry associated with the HSA image (image dimensions allowed in - * HSA). The enumeration values match the BRIG type BrigImageGeometry. + * @brief Geometry associated with the image. This specifies the + * number of image dimensions and whether the image is an image + * array. See the Image Geometry section in the HSA + * Programming Reference Manual for definitions on each + * geometry. The enumeration values match the BRIG type @p + * hsa_ext_brig_image_geometry_t. */ typedef enum { - /** +/** * One-dimensional image addressed by width coordinate. */ HSA_EXT_IMAGE_GEOMETRY_1D = 0, @@ -95,18 +206,22 @@ typedef enum { /** * Array of one-dimensional images with the same size and format. 1D arrays - * are addressed by index and width coordinate. + * are addressed by width and index coordinate. */ HSA_EXT_IMAGE_GEOMETRY_1DA = 3, /** * Array of two-dimensional images with the same size and format. 2D arrays - * are addressed by index and width and height coordinates. + * are addressed by width, height, and index coordinates. */ HSA_EXT_IMAGE_GEOMETRY_2DA = 4, /** - * One-dimensional image interpreted as a buffer with specific restrictions. + * One-dimensional image addressed by width coordinate. It has + * specific restrictions compared to ::HSA_EXT_IMAGE_GEOMETRY_1D. An + * image with an opaque image data layout will always use a linear + * image data layout, and one with an explicit image data layout + * must specify ::HSA_EXT_IMAGE_DATA_LAYOUT_LINEAR. */ HSA_EXT_IMAGE_GEOMETRY_1DB = 5, @@ -116,157 +231,215 @@ typedef enum { HSA_EXT_IMAGE_GEOMETRY_2DDEPTH = 6, /** - * Array of two-dimensional depth images with the same size and format. 2D - * arrays are addressed by index and width and height coordinates. + * Array of two-dimensional depth images with the same size and format. 2D + * arrays are addressed by width, height, and index coordinates. */ HSA_EXT_IMAGE_GEOMETRY_2DADEPTH = 7 } hsa_ext_image_geometry_t; /** - * @brief Channel type associated with the elements of an image. See the Image - * section in the HSA Programming Reference Manual for definitions on each - * component type. The enumeration values match the BRIG type - * BrigImageChannelType. + * @brief Channel type associated with the elements of an image. See + * the Channel Type section in the HSA Programming Reference + * Manual for definitions on each channel type. The + * enumeration values and definition match the BRIG type @p + * hsa_ext_brig_image_channel_type_t. */ typedef enum { - HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT8 = 0, - HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT16 = 1, - HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT8 = 2, - HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT16 = 3, - HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT24 = 4, - HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555 = 5, - HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565 = 6, - HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_101010 = 7, - HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT8 = 8, - HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT16 = 9, - HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT32 = 10, - HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8 = 11, - HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16 = 12, - HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32 = 13, - HSA_EXT_IMAGE_CHANNEL_TYPE_HALF_FLOAT = 14, - HSA_EXT_IMAGE_CHANNEL_TYPE_FLOAT = 15 + HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT8 = 0, + HSA_EXT_IMAGE_CHANNEL_TYPE_SNORM_INT16 = 1, + HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT8 = 2, + HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT16 = 3, + HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_INT24 = 4, + HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555 = 5, + HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565 = 6, + HSA_EXT_IMAGE_CHANNEL_TYPE_UNORM_SHORT_101010 = 7, + HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT8 = 8, + HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT16 = 9, + HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT32 = 10, + HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8 = 11, + HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16 = 12, + HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32 = 13, + HSA_EXT_IMAGE_CHANNEL_TYPE_HALF_FLOAT = 14, + HSA_EXT_IMAGE_CHANNEL_TYPE_FLOAT = 15 } hsa_ext_image_channel_type_t; +/** + * @brief A fixed-size type used to represent ::hsa_ext_image_channel_type_t constants. + */ +typedef uint32_t hsa_ext_image_channel_type32_t; + /** * - * @brief Channel order associated with the elements of an image. See the - * Image section in the HSA Programming Reference Manual for definitions on each - * component order. The enumeration values match the BRIG type - * BrigImageChannelOrder. + * @brief Channel order associated with the elements of an image. See + * the Channel Order section in the HSA Programming Reference + * Manual for definitions on each channel order. The + * enumeration values match the BRIG type @p + * hsa_ext_brig_image_channel_order_t. */ typedef enum { - HSA_EXT_IMAGE_CHANNEL_ORDER_A = 0, - HSA_EXT_IMAGE_CHANNEL_ORDER_R = 1, - HSA_EXT_IMAGE_CHANNEL_ORDER_RX = 2, - HSA_EXT_IMAGE_CHANNEL_ORDER_RG = 3, - HSA_EXT_IMAGE_CHANNEL_ORDER_RGX = 4, - HSA_EXT_IMAGE_CHANNEL_ORDER_RA = 5, - HSA_EXT_IMAGE_CHANNEL_ORDER_RGB = 6, - HSA_EXT_IMAGE_CHANNEL_ORDER_RGBX = 7, - HSA_EXT_IMAGE_CHANNEL_ORDER_RGBA = 8, - HSA_EXT_IMAGE_CHANNEL_ORDER_BGRA = 9, - HSA_EXT_IMAGE_CHANNEL_ORDER_ARGB = 10, - HSA_EXT_IMAGE_CHANNEL_ORDER_ABGR = 11, - HSA_EXT_IMAGE_CHANNEL_ORDER_SRGB = 12, - HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBX = 13, - HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBA = 14, - HSA_EXT_IMAGE_CHANNEL_ORDER_SBGRA = 15, - HSA_EXT_IMAGE_CHANNEL_ORDER_INTENSITY = 16, - HSA_EXT_IMAGE_CHANNEL_ORDER_LUMINANCE = 17, - HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH = 18, - HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH_STENCIL = 19 + HSA_EXT_IMAGE_CHANNEL_ORDER_A = 0, + HSA_EXT_IMAGE_CHANNEL_ORDER_R = 1, + HSA_EXT_IMAGE_CHANNEL_ORDER_RX = 2, + HSA_EXT_IMAGE_CHANNEL_ORDER_RG = 3, + HSA_EXT_IMAGE_CHANNEL_ORDER_RGX = 4, + HSA_EXT_IMAGE_CHANNEL_ORDER_RA = 5, + HSA_EXT_IMAGE_CHANNEL_ORDER_RGB = 6, + HSA_EXT_IMAGE_CHANNEL_ORDER_RGBX = 7, + HSA_EXT_IMAGE_CHANNEL_ORDER_RGBA = 8, + HSA_EXT_IMAGE_CHANNEL_ORDER_BGRA = 9, + HSA_EXT_IMAGE_CHANNEL_ORDER_ARGB = 10, + HSA_EXT_IMAGE_CHANNEL_ORDER_ABGR = 11, + HSA_EXT_IMAGE_CHANNEL_ORDER_SRGB = 12, + HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBX = 13, + HSA_EXT_IMAGE_CHANNEL_ORDER_SRGBA = 14, + HSA_EXT_IMAGE_CHANNEL_ORDER_SBGRA = 15, + HSA_EXT_IMAGE_CHANNEL_ORDER_INTENSITY = 16, + HSA_EXT_IMAGE_CHANNEL_ORDER_LUMINANCE = 17, + HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH = 18, + HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH_STENCIL = 19 } hsa_ext_image_channel_order_t; +/** + * @brief A fixed-size type used to represent ::hsa_ext_image_channel_order_t constants. + */ +typedef uint32_t hsa_ext_image_channel_order32_t; + + /** * @brief Image format. */ typedef struct hsa_ext_image_format_s { /** - * Channel type. - */ - hsa_ext_image_channel_type_t channel_type; + * Channel type. + */ + hsa_ext_image_channel_type32_t channel_type; - /** - * Channel order. - */ - hsa_ext_image_channel_order_t channel_order; + /** + * Channel order. + */ + hsa_ext_image_channel_order32_t channel_order; } hsa_ext_image_format_t; /** - * @brief Implementation-independent image descriptor. + * @brief Implementation independent image descriptor. */ typedef struct hsa_ext_image_descriptor_s { - /** - * Image geometry. - */ - hsa_ext_image_geometry_t geometry; - /** - * Width of the image, in components. - */ - size_t width; - /** - * Height of the image, in components. Only defined if the geometry is 2D or - * higher. - */ - size_t height; - /** - * Depth of the image, in components. Only defined if @a geometry is - * ::HSA_EXT_IMAGE_GEOMETRY_3D. A depth of 0 is same as a depth of 1. - */ - size_t depth; - /** - * Number of images in the image array. Only defined if @a geometry is - * ::HSA_EXT_IMAGE_GEOMETRY_1DA, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or - * HSA_EXT_IMAGE_GEOMETRY_2DADEPTH. - */ - size_t array_size; - /** - * Image format. - */ - hsa_ext_image_format_t format; + /** + * Image geometry. + */ + hsa_ext_image_geometry_t geometry; + /** + * Width of the image, in components. + */ + size_t width; + /** + * Height of the image, in components. Only used if the geometry is + * ::HSA_EXT_IMAGE_GEOMETRY_2D, ::HSA_EXT_IMAGE_GEOMETRY_3D, + * HSA_EXT_IMAGE_GEOMETRY_2DA, HSA_EXT_IMAGE_GEOMETRY_2DDEPTH, or + * HSA_EXT_IMAGE_GEOMETRY_2DADEPTH, otherwise must be 0. + */ + size_t height; + /** + * Depth of the image, in components. Only used if the geometry is + * ::HSA_EXT_IMAGE_GEOMETRY_3D, otherwise must be 0. + */ + size_t depth; + /** + * Number of image layers in the image array. Only used if the geometry is + * ::HSA_EXT_IMAGE_GEOMETRY_1DA, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or + * HSA_EXT_IMAGE_GEOMETRY_2DADEPTH, otherwise must be 0. + */ + size_t array_size; + /** + * Image format. + */ + hsa_ext_image_format_t format; } hsa_ext_image_descriptor_t; /** * @brief Image capability. */ -typedef enum { - /** - * Images of this geometry and format are not supported in the agent. - */ - HSA_EXT_IMAGE_CAPABILITY_NOT_SUPPORTED = 0x0, - /** - * Read-only images of this geometry and format are supported by the - * agent. - */ - HSA_EXT_IMAGE_CAPABILITY_READ_ONLY = 0x1, - /** - * Write-only images of this geometry and format are supported by the - * agent. - */ - HSA_EXT_IMAGE_CAPABILITY_WRITE_ONLY = 0x2, - /** - * Read-write images of this geometry and format are supported by the - * agent. - */ - HSA_EXT_IMAGE_CAPABILITY_READ_WRITE = 0x4, - /** - * Images of this geometry and format can be accessed from read-modify-write - * operations in the agent. - */ - HSA_EXT_IMAGE_CAPABILITY_READ_MODIFY_WRITE = 0x8, - /** - * Images of this geometry and format are guaranteed to have a consistent - * data layout regardless of how they are accessed by the associated - * agent. - */ - HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT = 0x10 +typedef enum { + /** + * Images of this geometry, format, and layout are not supported by + * the agent. + */ + HSA_EXT_IMAGE_CAPABILITY_NOT_SUPPORTED = 0x0, + /** + * Read-only images of this geometry, format, and layout are + * supported by the agent. + */ + HSA_EXT_IMAGE_CAPABILITY_READ_ONLY = 0x1, + /** + * Write-only images of this geometry, format, and layout are + * supported by the agent. + */ + HSA_EXT_IMAGE_CAPABILITY_WRITE_ONLY = 0x2, + /** + * Read-write images of this geometry, format, and layout are + * supported by the agent. + */ + HSA_EXT_IMAGE_CAPABILITY_READ_WRITE = 0x4, + /** + * @deprecated Images of this geometry, format, and layout can be accessed from + * read-modify-write atomic operations in the agent. + */ + HSA_EXT_IMAGE_CAPABILITY_READ_MODIFY_WRITE = 0x8, + /** + * Images of this geometry, format, and layout are guaranteed to + * have a consistent data layout regardless of how they are + * accessed by the associated agent. + */ + HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT = 0x10 } hsa_ext_image_capability_t; /** - * @brief Retrieve the supported image capabilities for a given combination of - * agent, image format and geometry. + * @brief Image data layout. * - * @param[in] agent Agent to be associated with the image. + * @details An image data layout denotes such aspects of image data + * layout as tiling and organization of channels in memory. Some image + * data layouts may only apply to specific image geometries, formats, + * and access permissions. Different agents may support different + * image layout identifiers, including vendor specific layouts. Note + * that an agent may not support the same image data layout for + * different access permissions to images with the same image + * geometry, size, and format. If multiple agents support the same + * image data layout then it is possible to use separate image handles + * for each agent that references the same image data. + */ + +typedef enum { + /** + * An implementation specific opaque image data layout which can + * vary depending on the agent, geometry, image format, image size, + * and access permissions. + */ + HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE = 0x0, + /** + * The image data layout is specified by the following rules in + * ascending byte address order. For a 3D image, 2DA image array, + * or 1DA image array, the image data is stored as a linear sequence + * of adjacent 2D image slices, 2D images, or 1D images + * respectively, spaced according to the slice pitch. Each 2D image + * is stored as a linear sequence of adjacent image rows, spaced + * according to the row pitch. Each 1D or 1DB image is stored as a + * single image row. Each image row is stored as a linear sequence + * of image elements. Each image element is stored as a linear + * sequence of image components specified by the left to right + * channel order definition. Each image component is stored using + * the memory type specified by the channel type. + * + * The 1DB image geometry always uses the linear image data layout. + */ + HSA_EXT_IMAGE_DATA_LAYOUT_LINEAR = 0x1 +} hsa_ext_image_data_layout_t; + +/** + * @brief Retrieve the supported image capabilities for a given combination of + * agent, geometry, and image format for an image created with an opaque image + * data layout. + * + * @param[in] agent Agent to be associated with the image handle. * * @param[in] geometry Geometry. * @@ -283,18 +456,55 @@ typedef enum { * * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. * - * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p geometry is not a valid image - * geometry value, @p image_format is NULL, or @p capability_mask is NULL. + * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_format is + * NULL, or @p capability_mask is NULL. */ -hsa_status_t HSA_API - hsa_ext_image_get_capability(hsa_agent_t agent, - hsa_ext_image_geometry_t geometry, - const hsa_ext_image_format_t *image_format, - uint32_t *capability_mask); +hsa_status_t HSA_API hsa_ext_image_get_capability( + hsa_agent_t agent, + hsa_ext_image_geometry_t geometry, + const hsa_ext_image_format_t *image_format, + uint32_t *capability_mask); /** - * @brief Agent-specific image size and alignment requirements, populated by - * ::hsa_ext_image_data_get_info. + * @brief Retrieve the supported image capabilities for a given combination of + * agent, geometry, image format, and image layout for an image created with + * an explicit image data layout. + * + * @param[in] agent Agent to be associated with the image handle. + * + * @param[in] geometry Geometry. + * + * @param[in] image_format Pointer to an image format. Must not be NULL. + * + * @param[in] image_data_layout The image data layout. + * It is invalid to use ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE; use + * ::hsa_ext_image_get_capability instead. + * + * @param[out] capability_mask Pointer to a memory location where the HSA + * runtime stores a bit-mask of supported image capability + * (::hsa_ext_image_capability_t) values. Must not be NULL. + * + * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. + * + * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been + * initialized. + * + * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. + * + * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_format is + * NULL, @p image_data_layout is ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE, + * or @p capability_mask is NULL. + */ +hsa_status_t HSA_API hsa_ext_image_get_capability_with_layout( + hsa_agent_t agent, + hsa_ext_image_geometry_t geometry, + const hsa_ext_image_format_t *image_format, + hsa_ext_image_data_layout_t image_data_layout, + uint32_t *capability_mask); + +/** + * @brief Agent specific image size and alignment requirements, populated by + * ::hsa_ext_image_data_get_info and ::hsa_ext_image_data_get_info_with_layout. */ typedef struct hsa_ext_image_data_info_s { /** @@ -303,32 +513,41 @@ typedef struct hsa_ext_image_data_info_s { size_t size; /** - * Image data alignment, in bytes. + * Image data alignment, in bytes. Must always be a power of 2. */ size_t alignment; } hsa_ext_image_data_info_t; /** - * @brief Retrieve the image data requirements for a given combination of image - * descriptor, access permission, and agent. + * @brief Retrieve the image data requirements for a given combination of agent, image + * descriptor, and access permission for an image created with an opaque image + * data layout. * - * @details The optimal image data size and alignment requirements may vary - * depending on the image attributes specified in @p image_descriptor. Also, - * different implementation of the HSA runtime may return different requirements - * for the same input values. + * @details The optimal image data size and alignment requirements may + * vary depending on the image attributes specified in @p + * image_descriptor, the @p access_permission, and the @p agent. Also, + * different implementations of the HSA runtime may return different + * requirements for the same input values. * - * The implementation must return the same image data requirements for different - * access permissions with exactly the same image descriptor as long as - * ::hsa_ext_image_get_capability reports - * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT for the geometry - * and image format contained in the image descriptor. + * The implementation must return the same image data requirements for + * different access permissions with matching image descriptors as long + * as ::hsa_ext_image_get_capability reports + * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT. Image + * descriptors match if they have the same values, with the exception + * that s-form channel orders match the corresponding non-s-form + * channel order and vice versa. * - * @param[in] agent Agent to be associated with the image. + * @param[in] agent Agent to be associated with the image handle. * * @param[in] image_descriptor Pointer to an image descriptor. Must not be NULL. * - * @param[in] access_permission Image access mode for @a agent. + * @param[in] access_permission Access permission of the image when + * accessed by @p agent. The access permission defines how the agent + * is allowed to access the image and must match the corresponding + * HSAIL image handle type. The @p agent must support the image format + * specified in @p image_descriptor for the given @p + * access_permission. * * @param[out] image_data_info Memory location where the runtime stores the * size and alignment requirements. Must not be NULL. @@ -340,55 +559,242 @@ typedef struct hsa_ext_image_data_info_s { * * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. * - * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED The agent does - * not support the image format specified by the descriptor. + * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED The @p + * agent does not support the image format specified by @p + * image_descriptor with the specified @p access_permission. * - * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED The agent does - * not support the image dimensions specified by the format descriptor. + * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED The agent + * does not support the image dimensions specified by @p + * image_descriptor with the specified @p access_permission. * * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_descriptor is NULL, @p * access_permission is not a valid access permission value, or @p * image_data_info is NULL. */ hsa_status_t HSA_API hsa_ext_image_data_get_info( - hsa_agent_t agent, const hsa_ext_image_descriptor_t *image_descriptor, + hsa_agent_t agent, + const hsa_ext_image_descriptor_t *image_descriptor, hsa_access_permission_t access_permission, hsa_ext_image_data_info_t *image_data_info); /** - * @brief Creates a agent-defined image handle from an - * implementation-independent image descriptor and a agent-specific image - * data. + * @brief Retrieve the image data requirements for a given combination of + * image descriptor, access permission, image data layout, image data row pitch, + * and image data slice pitch for an image created with an explicit image + * data layout. * - * @details Image created with different access permissions but the same image - * descriptor can share the same image data if - * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT is reported by - * ::hsa_ext_image_get_capability for the image format specified in the image - * descriptor. Images with a s-form channel order can share the same image data - * with other images that have the corresponding non-s-form channel order, - * provided the rest of their image descriptors are identical. + * @details The image data size and alignment requirements may vary + * depending on the image attributes specified in @p image_descriptor, + * the @p access_permission, and the image layout. However, different + * implementations of the HSA runtime will return the same + * requirements for the same input values. * - * If necessary, an application can use image operations (import, export, copy, - * clear) to prepare the image for the intended use regardless of the access - * permissions. + * The implementation must return the same image data requirements for + * different access permissions with matching image descriptors and + * matching image layouts as long as ::hsa_ext_image_get_capability + * reports + * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT. Image + * descriptors match if they have the same values, with the exception + * that s-form channel orders match the corresponding non-s-form + * channel order and vice versa. Image layouts match if they are the + * same image data layout and use the same image row and slice pitch + * values. * - * @param[in] agent agent to be associated with the image. + * @param[in] image_descriptor Pointer to an image descriptor. Must not be NULL. + * + * @param[in] access_permission Access permission of the image when + * accessed by an agent. The access permission defines how the agent + * is allowed to access the image and must match the corresponding + * HSAIL image handle type. + * + * @param[in] image_data_layout The image data layout to use. + * It is invalid to use ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE; use + * ::hsa_ext_image_data_get_info instead. + * + * @param[in] image_data_row_pitch The size in bytes for a single row + * of the image in the image data. If 0 is specified then the default + * row pitch value is used: image width * image element byte size. + * The value used must be greater than or equal to the default row + * pitch, and be a multiple of the image element byte size. For the + * linear image layout it must also be a multiple of the image linear + * row pitch alignment for the agents that will access the image data + * using image instructions. + * + * @param[in] image_data_slice_pitch The size in bytes of a single + * slice of a 3D image, or the size in bytes of each image layer in an + * image array in the image data. If 0 is specified then the default + * slice pitch value is used: row pitch * height if geometry is + * ::HSA_EXT_IMAGE_GEOMETRY_3D, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or + * ::HSA_EXT_IMAGE_GEOMETRY_2DADEPTH; row pitch if geometry is + * ::HSA_EXT_IMAGE_GEOMETRY_1DA; and 0 otherwise. The value used must + * be 0 if the default slice pitch is 0, be greater than or equal to + * the default slice pitch, and be a multiple of the row pitch. + * + * @param[out] image_data_info Memory location where the runtime stores the + * size and alignment requirements. Must not be NULL. + * + * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. + * + * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been + * initialized. + * + * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED The image + * format specified by @p image_descriptor is not supported for the + * @p access_permission and @p image_data_layout specified. + * + * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED The image + * dimensions specified by @p image_descriptor are not supported for + * the @p access_permission and @p image_data_layout specified. + * + * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_PITCH_UNSUPPORTED The row and + * slice pitch specified by @p image_data_row_pitch and @p + * image_data_slice_pitch are invalid or not supported. + * + * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_descriptor is + * NULL, @p image_data_layout is ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE, + * or @p image_data_info is NULL. + */ +hsa_status_t HSA_API hsa_ext_image_data_get_info_with_layout( + const hsa_ext_image_descriptor_t *image_descriptor, + hsa_access_permission_t access_permission, + hsa_ext_image_data_layout_t image_data_layout, + size_t image_data_row_pitch, + size_t image_data_slice_pitch, + hsa_ext_image_data_info_t *image_data_info); + +/** + * @brief Creates an agent specific image handle to an image with an + * opaque image data layout. + * + * @details Images with an opaque image data layout created with + * different access permissions but matching image descriptors and + * same agent can share the same image data if + * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT is reported + * by ::hsa_ext_image_get_capability for the image format specified in + * the image descriptor. Image descriptors match if they have the same + * values, with the exception that s-form channel orders match the + * corresponding non-s-form channel order and vice versa. + * + * If necessary, an application can use image operations (import, + * export, copy, clear) to prepare the image for the intended use + * regardless of the access permissions. + * + * @param[in] agent agent to be associated with the image handle created. * * @param[in] image_descriptor Pointer to an image descriptor. Must not be NULL. * * @param[in] image_data Image data buffer that must have been allocated * according to the size and alignment requirements dictated by - * ::hsa_ext_image_data_get_info. Must not be NULL. + * ::hsa_ext_image_data_get_info. Must not be NULL. * * Any previous memory contents are preserved upon creation. The application is * responsible for ensuring that the lifetime of the image data exceeds that of * all the associated images. * - * @param[in] access_permission Access permission of the image by the - * agent. The access permission defines how the agent expects to use the - * image and must match the corresponding HSAIL image handle type. The agent - * must support the image format specified in @p image_descriptor for the given - * permission. + * @param[in] access_permission Access permission of the image when + * accessed by agent. The access permission defines how the agent + * is allowed to access the image using the image handle created and + * must match the corresponding HSAIL image handle type. The agent + * must support the image format specified in @p image_descriptor for + * the given @p access_permission. + * + * @param[out] image Pointer to a memory location where the HSA runtime stores + * the newly created image handle. Must not be NULL. + * + * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. + * + * @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been + * initialized. + * + * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. + * + * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED The agent + * does not have the capability to support the image format contained + * in @p image_descriptor using the specified @p access_permission. + * + * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED The agent + * does not support the image dimensions specified by @p + * image_descriptor using the specified @p access_permission. + * + * @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate + * the required resources. + * + * support the creation of more image handles with the given @p access_permission). + * + * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_descriptor is NULL, @p + * image_data is NULL, @p image_data does not have a valid alignment, + * @p access_permission is not a valid access permission + * value, or @p image is NULL. + */ +hsa_status_t HSA_API hsa_ext_image_create( + hsa_agent_t agent, + const hsa_ext_image_descriptor_t *image_descriptor, + void *image_data, + hsa_access_permission_t access_permission, + hsa_ext_image_t *image); + +/** + * @brief Creates an agent specific image handle to an image with an explicit + * image data layout. + * + * @details Images with an explicit image data layout created with + * different access permissions but matching image descriptors and + * matching image layout can share the same image data if + * ::HSA_EXT_IMAGE_CAPABILITY_ACCESS_INVARIANT_DATA_LAYOUT is reported + * by ::hsa_ext_image_get_capability_with_layout for the image format + * specified in the image descriptor and specified image data + * layout. Image descriptors match if they have the same values, with + * the exception that s-form channel orders match the corresponding + * non-s-form channel order and vice versa. Image layouts match if + * they are the same image data layout and use the same image row and + * slice values. + * + * If necessary, an application can use image operations (import, export, copy, + * clear) to prepare the image for the intended use regardless of the access + * permissions. + * + * @param[in] agent agent to be associated with the image handle created. + * + * @param[in] image_descriptor Pointer to an image descriptor. Must not be NULL. + * + * @param[in] image_data Image data buffer that must have been allocated + * according to the size and alignment requirements dictated by + * ::hsa_ext_image_data_get_info_with_layout. Must not be NULL. + * + * Any previous memory contents are preserved upon creation. The application is + * responsible for ensuring that the lifetime of the image data exceeds that of + * all the associated images. + * + * @param[in] access_permission Access permission of the image when + * accessed by the agent. The access permission defines how the agent + * is allowed to access the image and must match the corresponding + * HSAIL image handle type. The agent must support the image format + * specified in @p image_descriptor for the given @p access_permission + * and @p image_data_layout. + * + * @param[in] image_data_layout The image data layout to use for the + * @p image_data. It is invalid to use + * ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE; use ::hsa_ext_image_create + * instead. + * + * @param[in] image_data_row_pitch The size in bytes for a single row + * of the image in the image data. If 0 is specified then the default + * row pitch value is used: image width * image element byte size. + * The value used must be greater than or equal to the default row + * pitch, and be a multiple of the image element byte size. For the + * linear image layout it must also be a multiple of the image linear + * row pitch alignment for the agents that will access the image data + * using image instructions. + * + * @param[in] image_data_slice_pitch The size in bytes of a single + * slice of a 3D image, or the size in bytes of each image layer in an + * image array in the image data. If 0 is specified then the default + * slice pitch value is used: row pitch * height if geometry is + * ::HSA_EXT_IMAGE_GEOMETRY_3D, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or + * ::HSA_EXT_IMAGE_GEOMETRY_2DADEPTH; row pitch if geometry is + * ::HSA_EXT_IMAGE_GEOMETRY_1DA; and 0 otherwise. The value used must + * be 0 if the default slice pitch is 0, be greater than or equal to + * the default slice pitch, and be a multiple of the row pitch. * * @param[out] image Pointer to a memory location where the HSA runtime stores * the newly created image handle. Must not be NULL. @@ -402,34 +808,49 @@ hsa_status_t HSA_API hsa_ext_image_data_get_info( * * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED The agent does * not have the capability to support the image format contained in the image - * descriptor using the specified access permission. + * descriptor using the specified @p access_permission and @p image_data_layout. * - * @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime cannot create the - * image because it is out of resources (for example, the agent does not - * support the creation of more image handles with the given access permission). + * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED The agent + * does not support the image dimensions specified by @p + * image_descriptor using the specified @p access_permission and @p + * image_data_layout. + * + * @retval ::HSA_EXT_STATUS_ERROR_IMAGE_PITCH_UNSUPPORTED The agent does + * not support the row and slice pitch specified by @p image_data_row_pitch + * and @p image_data_slice_pitch, or the values are invalid. + * + * @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate + * the required resources. + * + * support the creation of more image handles with the given @p access_permission). * * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p image_descriptor is NULL, @p - * image_data is NULL, @p access_permission is not a valid access permission - * value, or @p image is NULL. + * image_data is NULL, @p image_data does not have a valid alignment, + * @p image_data_layout is ::HSA_EXT_IMAGE_DATA_LAYOUT_OPAQUE, + * or @p image is NULL. */ -hsa_status_t HSA_API - hsa_ext_image_create(hsa_agent_t agent, - const hsa_ext_image_descriptor_t *image_descriptor, - const void *image_data, - hsa_access_permission_t access_permission, - hsa_ext_image_t *image); +hsa_status_t HSA_API hsa_ext_image_create_with_layout( + hsa_agent_t agent, + const hsa_ext_image_descriptor_t *image_descriptor, + void *image_data, + hsa_access_permission_t access_permission, + hsa_ext_image_data_layout_t image_data_layout, + size_t image_data_row_pitch, + size_t image_data_slice_pitch, + hsa_ext_image_t *image); /** - * @brief Destroy an image previously created using ::hsa_ext_image_create. + * @brief Destroy an image handle previously created using ::hsa_ext_image_create or + * ::hsa_ext_image_create_with_layout. * * @details Destroying the image handle does not free the associated image data, - * or modify its contents. The application should not destroy an image while + * or modify its contents. The application should not destroy an image handle while * there are references to it queued for execution or currently being used in a - * kernel. + * kernel dispatch. * - * @param[in] agent Agent associated with the image. + * @param[in] agent Agent associated with the image handle. * - * @param[in] image Image. + * @param[in] image Image handle to destroy. * * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. * @@ -438,22 +859,24 @@ hsa_status_t HSA_API * * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. */ -hsa_status_t HSA_API - hsa_ext_image_destroy(hsa_agent_t agent, hsa_ext_image_t image); +hsa_status_t HSA_API hsa_ext_image_destroy( + hsa_agent_t agent, + hsa_ext_image_t image); /** * @brief Copies a portion of one image (the source) to another image (the * destination). * - * @details The source and destination image formats should match, except if the - * channel type of one of the images is the standard form of the channel type of - * the other image. For example, it is allowed to copy a source image with a - * channel type of HSA_EXT_IMAGE_CHANNEL_ORDER_SRGB to a destination image with - * a channel type of HSA_EXT_IMAGE_CHANNEL_ORDER_RGB. + * @details The source and destination image formats should be the + * same, with the exception that s-form channel orders match the + * corresponding non-s-form channel order and vice versa. For example, + * it is allowed to copy a source image with a channel order of + * HSA_EXT_IMAGE_CHANNEL_ORDER_SRGB to a destination image with a + * channel order of HSA_EXT_IMAGE_CHANNEL_ORDER_RGB. * * The source and destination images do not have to be of the same geometry and * appropriate scaling is performed by the HSA runtime. It is possible to copy - * subregions between any combinations of source and destination types, provided + * subregions between any combinations of source and destination geometries, provided * that the dimensions of the subregions are the same. For example, it is * allowed to copy a rectangular region from a 2D image to a slice of a 3D * image. @@ -462,15 +885,15 @@ hsa_status_t HSA_API * offset and range references an out-out-bounds element in any of the images, * the behavior is undefined. * - * @param[in] agent Agent associated with both images. + * @param[in] agent Agent associated with both the source and destination image handles. * - * @param[in] src_image Source image. The agent associated with the source - * image must be identical to that of the destination image. + * @param[in] src_image Image handle of source image. The agent associated with the source + * image handle must be identical to that of the destination image. * * @param[in] src_offset Pointer to the offset within the source image where to * copy the data from. Must not be NULL. * - * @param[in] dst_image Destination image. + * @param[in] dst_image Image handle of destination image. * * @param[in] dst_offset Pointer to the offset within the destination * image where to copy the data. Must not be NULL. @@ -489,25 +912,28 @@ hsa_status_t HSA_API * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p src_offset is * NULL, @p dst_offset is NULL, or @p range is NULL. */ -hsa_status_t HSA_API - hsa_ext_image_copy(hsa_agent_t agent, hsa_ext_image_t src_image, - const hsa_dim3_t *src_offset, hsa_ext_image_t dst_image, - const hsa_dim3_t *dst_offset, const hsa_dim3_t *range); +hsa_status_t HSA_API hsa_ext_image_copy( + hsa_agent_t agent, + hsa_ext_image_t src_image, + const hsa_dim3_t* src_offset, + hsa_ext_image_t dst_image, + const hsa_dim3_t* dst_offset, + const hsa_dim3_t* range); /** * @brief Image region. */ typedef struct hsa_ext_image_region_s { - /** - * Offset within an image (in coordinates). - */ - hsa_dim3_t offset; + /** + * Offset within an image (in coordinates). + */ + hsa_dim3_t offset; - /** - * Dimensions of the image range (in coordinates). The x, y, and z dimensions - * correspond to width, height, and depth respectively. - */ - hsa_dim3_t range; + /** + * Dimension size of the image range (in coordinates). The x, y, and z dimensions + * correspond to width, height, and depth or index respectively. + */ + hsa_dim3_t range; } hsa_ext_image_region_t; /** @@ -518,28 +944,32 @@ typedef struct hsa_ext_image_region_s { * from the source memory. The size of the data imported from memory is * implicitly derived from the image region. * - * If @p src_row_pitch is smaller than the destination region width (in bytes), - * then @p src_row_pitch = region width. - * - * If @p src_slice_pitch is smaller than the destination region width * region - * height (in bytes), then @p src_slice_pitch = region width * region height. - * * It is the application's responsibility to avoid out of bounds memory access. * - * None of the source memory or image data memory in the previously created - * ::hsa_ext_image_create image handle can overlap. Overlapping of any - * of the source and destination memory within the import operation produces - * undefined results. + * None of the source memory or destination image data memory can + * overlap. Overlapping of any of the source and destination image + * data memory within the import operation produces undefined results. * - * @param[in] agent Agent associated with the image. + * @param[in] agent Agent associated with the image handle. * * @param[in] src_memory Source memory. Must not be NULL. * - * @param[in] src_row_pitch Number of bytes in one row of the source memory. + * @param[in] src_row_pitch The size in bytes of a single row of the image in the + * source memory. If the value is smaller than the destination image region + * width * image element byte size, then region width * image element byte + * size is used. * - * @param[in] src_slice_pitch Number of bytes in one slice of the source memory. + * @param[in] src_slice_pitch The size in bytes of a single 2D slice of a 3D image, + * or the size in bytes of each image layer in an image array in the source memory. + * If the geometry is ::HSA_EXT_IMAGE_GEOMETRY_1DA and the value is smaller than the + * value used for @p src_row_pitch, then the value used for @p src_row_pitch is used. + * If the geometry is ::HSA_EXT_IMAGE_GEOMETRY_3D, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or + * HSA_EXT_IMAGE_GEOMETRY_2DADEPTH and the value is smaller than the value used for + * @p src_row_pitch * destination image region height, then the value used for + * @p src_row_pitch * destination image region height is used. + * Otherwise, the value is not used. * - * @param[in] dst_image Destination image. + * @param[in] dst_image Image handle of destination image. * * @param[in] image_region Pointer to the image region to be updated. Must not * be NULL. @@ -555,11 +985,13 @@ typedef struct hsa_ext_image_region_s { * image_region is NULL. * */ -hsa_status_t HSA_API - hsa_ext_image_import(hsa_agent_t agent, const void *src_memory, - size_t src_row_pitch, size_t src_slice_pitch, - hsa_ext_image_t dst_image, - const hsa_ext_image_region_t *image_region); +hsa_status_t HSA_API hsa_ext_image_import( + hsa_agent_t agent, + const void *src_memory, + size_t src_row_pitch, + size_t src_slice_pitch, + hsa_ext_image_t dst_image, + const hsa_ext_image_region_t *image_region); /** * @brief Export the image data to linearly organized memory. @@ -568,30 +1000,32 @@ hsa_status_t HSA_API * @p src_image. The size of the data exported to memory is implicitly derived * from the image region. * - * If @p dst_row_pitch is smaller than the source region width (in bytes), then - * @p dst_row_pitch = region width. - * - * If @p dst_slice_pitch is smaller than the source region width * region height - * (in bytes), then @p dst_slice_pitch = region width * region height. - * * It is the application's responsibility to avoid out of bounds memory access. * - * None of the destination memory or image data memory in the previously created - * ::hsa_ext_image_create image handle can overlap. Overlapping of any of - * the source and destination memory within the export operation produces - * undefined results. + * None of the destination memory or source image data memory can + * overlap. Overlapping of any of the source and destination image + * data memory within the export operation produces undefined results. * - * @param[in] agent Agent associated with the image. + * @param[in] agent Agent associated with the image handle. * - * @param[in] src_image Source image. + * @param[in] src_image Image handle of source image. * * @param[in] dst_memory Destination memory. Must not be NULL. * - * @param[in] dst_row_pitch Number of bytes in one row of the destination - * memory. + * @param[in] dst_row_pitch The size in bytes of a single row of the image in the + * destination memory. If the value is smaller than the source image region + * width * image element byte size, then region width * image element byte + * size is used. * - * @param[in] dst_slice_pitch Number of bytes in one slice of the destination - * memory. + * @param[in] dst_slice_pitch The size in bytes of a single 2D slice of a 3D image, + * or the size in bytes of each image in an image array in the destination memory. + * If the geometry is ::HSA_EXT_IMAGE_GEOMETRY_1DA and the value is smaller than the + * value used for @p dst_row_pitch, then the value used for @p dst_row_pitch is used. + * If the geometry is ::HSA_EXT_IMAGE_GEOMETRY_3D, ::HSA_EXT_IMAGE_GEOMETRY_2DA, or + * HSA_EXT_IMAGE_GEOMETRY_2DADEPTH and the value is smaller than the value used for + * @p dst_row_pitch * source image region height, then the value used for + * @p dst_row_pitch * source image region height is used. + * Otherwise, the value is not used. * * @param[in] image_region Pointer to the image region to be exported. Must not * be NULL. @@ -606,45 +1040,32 @@ hsa_status_t HSA_API * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p dst_memory is NULL, or @p * image_region is NULL. */ -hsa_status_t HSA_API - hsa_ext_image_export(hsa_agent_t agent, hsa_ext_image_t src_image, - void *dst_memory, size_t dst_row_pitch, - size_t dst_slice_pitch, - const hsa_ext_image_region_t *image_region); +hsa_status_t HSA_API hsa_ext_image_export( + hsa_agent_t agent, + hsa_ext_image_t src_image, + void *dst_memory, + size_t dst_row_pitch, + size_t dst_slice_pitch, + const hsa_ext_image_region_t *image_region); /** - * @brief Clear an image to the specified value. + * @brief Clear a region of an image so that every image element has + * the specified value. * - * @details Clearing an image does not perform any format conversion and the - * provided clear data is directly stored regardless of the image format. The - * lowest bits of the data (number of bits depending on the image component - * type) stored in the cleared image are based on the image component order. + * @param[in] agent Agent associated with the image handle. * - * The number of elements in @p data should match the number of access - * components for the channel order of @p image, as determined by the HSA - * Programmer's Reference Manual. A single element is required for - * HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH and - * HSA_EXT_IMAGE_CHANNEL_ORDER_DEPTH_STENCIL, while any other channel order - * requires 4 elements. + * @param[in] image Image handle for image to be cleared. * - * Each element in @p data is a 32-bit value. The type of each element - * should match the access type associated with the channel type of @p image, - * as determined by the HSA Programmer's Reference Manual: - * - HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT8, - * HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT16, and - * HSA_EXT_IMAGE_CHANNEL_TYPE_SIGNED_INT32 map to int32_t. - * - HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8, - * HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16, and - * HSA_EXT_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32 map to uint32_t. - * - Any other channel type maps to a 32-bit float. - * - * @param[in] agent Agent associated with the image. - * - * @param[in] image Image to be cleared. - * - * @param[in] data Clear value array. Specifying a clear value outside of the - * range that can be represented by an image format results in undefined - * behavior. Must not be NULL. + * @param[in] data The value to which to set each image element being + * cleared. It is specified as an array of image component values. The + * number of array elements must match the number of access components + * for the image channel order. The type of each array element must + * match the image access type of the image channel type. When the + * value is used to set the value of an image element, the conversion + * method corresponding to the image channel type is used. See the + * Channel Order section and Channel Type section in + * the HSA Programming Reference Manual for more + * information. Must not be NULL. * * @param[in] image_region Pointer to the image region to clear. Must not be * NULL. If the region references an out-out-bounds element, the behavior is @@ -660,10 +1081,11 @@ hsa_status_t HSA_API * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p data is NULL, or @p * image_region is NULL. */ -hsa_status_t HSA_API - hsa_ext_image_clear(hsa_agent_t agent, hsa_ext_image_t image, - const void *data, - const hsa_ext_image_region_t *image_region); +hsa_status_t HSA_API hsa_ext_image_clear( + hsa_agent_t agent, + hsa_ext_image_t image, + const void* data, + const hsa_ext_image_region_t *image_region); /** * @brief Sampler handle. Samplers are populated by @@ -672,15 +1094,18 @@ hsa_status_t HSA_API */ typedef struct hsa_ext_sampler_s { /** - * Opaque handle. + * Opaque handle. For a given agent, two handles reference the same object of + * the enclosing type if and only if they are equal. */ - uint64_t handle; + uint64_t handle; } hsa_ext_sampler_t; /** - * @brief Sampler address modes. The sampler address mode describes the - * processing of out-of-range image coordinates. The values match the BRIG - * type BrigSamplerAddressing. + * @brief Sampler address modes. The sampler address mode describes + * the processing of out-of-range image coordinates. See the + * Addressing Mode section in the HSA Programming Reference + * Manual for definitions on each address mode. The values + * match the BRIG type @p hsa_ext_brig_sampler_addressing_t. */ typedef enum { /** @@ -694,52 +1119,63 @@ typedef enum { HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE = 1, /** - * Clamp out-of-range coordinates to the image border. + * Clamp out-of-range coordinates to the image border color. */ HSA_EXT_SAMPLER_ADDRESSING_MODE_CLAMP_TO_BORDER = 2, /** - * Wrap out-of-range coordinates back into the valid coordinate range. + * Wrap out-of-range coordinates back into the valid coordinate + * range so the image appears as repeated tiles. */ HSA_EXT_SAMPLER_ADDRESSING_MODE_REPEAT = 3, /** - * Mirror out-of-range coordinates back into the valid coordinate range. + * Mirror out-of-range coordinates back into the valid coordinate + * range so the image appears as repeated tiles with every other + * tile a reflection. */ HSA_EXT_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT = 4 } hsa_ext_sampler_addressing_mode_t; /** - *@brief Fixed size container for address mode. + * @brief A fixed-size type used to represent ::hsa_ext_sampler_addressing_mode_t constants. */ typedef uint32_t hsa_ext_sampler_addressing_mode32_t; /** - * @brief Sampler coordinate modes. The enumeration values match the BRIG - * BRIG_SAMPLER_COORD bit in BrigSamplerModifier. + * @brief Sampler coordinate normalization modes. See the + * Coordinate Normalization Mode section in the HSA + * Programming Reference Manual for definitions on each + * coordinate normalization mode. The values match the BRIG type @p + * hsa_ext_brig_sampler_coord_normalization_t. */ typedef enum { + /** - * Coordinates are all in the range of 0 to (dimension-1). + * Coordinates are used to directly address an image element. */ HSA_EXT_SAMPLER_COORDINATE_MODE_UNNORMALIZED = 0, /** - * Coordinates are all in the range of 0.0 to 1.0. + * Coordinates are scaled by the image dimension size before being + * used to address an image element. */ HSA_EXT_SAMPLER_COORDINATE_MODE_NORMALIZED = 1 } hsa_ext_sampler_coordinate_mode_t; /** - *@brief Fixed size container for coordinate mode. + * @brief A fixed-size type used to represent ::hsa_ext_sampler_coordinate_mode_t constants. */ typedef uint32_t hsa_ext_sampler_coordinate_mode32_t; + /** - * @brief Sampler filter modes. The enumeration values match the BRIG type - * BrigSamplerFilter. + * @brief Sampler filter modes. See the Filter Mode section + * in the HSA Programming Reference Manual for definitions + * on each address mode. The enumeration values match the BRIG type @p + * hsa_ext_brig_sampler_filter_t. */ typedef enum { /** @@ -758,12 +1194,12 @@ typedef enum { } hsa_ext_sampler_filter_mode_t; /** - *@brief Fixed size container for filter mode. + * @brief A fixed-size type used to represent ::hsa_ext_sampler_filter_mode_t constants. */ typedef uint32_t hsa_ext_sampler_filter_mode32_t; /** - * @brief Implementation-independent sampler descriptor. + * @brief Implementation independent sampler descriptor. */ typedef struct hsa_ext_sampler_descriptor_s { /** @@ -785,10 +1221,10 @@ typedef struct hsa_ext_sampler_descriptor_s { } hsa_ext_sampler_descriptor_t; /** - * @brief Create a kernel agent defined sampler handle for a given combination - * of a (agent-independent) sampler descriptor and agent. + * @brief Create an agent specific sampler handle for a given agent + * independent sampler descriptor and agent. * - * @param[in] agent Agent to be associated with the sampler. + * @param[in] agent Agent to be associated with the sampler handle created. * * @param[in] sampler_descriptor Pointer to a sampler descriptor. Must not be * NULL. @@ -803,24 +1239,31 @@ typedef struct hsa_ext_sampler_descriptor_s { * * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. * - * @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The agent cannot create the - * specified handle because it is out of resources. + * @retval ::HSA_EXT_STATUS_ERROR_SAMPLER_DESCRIPTOR_UNSUPPORTED The + * @p agent does not have the capability to support the properties + * specified by @p sampler_descriptor or it is invalid. + * + * @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES The HSA runtime failed to allocate + * the required resources. * * @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT @p sampler_descriptor is NULL, or * @p sampler is NULL. */ hsa_status_t HSA_API hsa_ext_sampler_create( - hsa_agent_t agent, const hsa_ext_sampler_descriptor_t *sampler_descriptor, + hsa_agent_t agent, + const hsa_ext_sampler_descriptor_t *sampler_descriptor, hsa_ext_sampler_t *sampler); /** - * @brief Destroy a sampler previously created using ::hsa_ext_sampler_create. + * @brief Destroy a sampler handle previously created using ::hsa_ext_sampler_create. * - * @param[in] agent Agent associated with the sampler. + * @details The sampler handle should not be destroyed while there are + * references to it queued for execution or currently being used in a + * kernel dispatch. * - * @param[in] sampler Sampler. The sampler handle should not be destroyed while - * there are references to it queued for execution or currently being used in a - * dispatch. + * @param[in] agent Agent associated with the sampler handle. + * + * @param[in] sampler Sampler handle to destroy. * * @retval ::HSA_STATUS_SUCCESS The function has been executed successfully. * @@ -829,157 +1272,179 @@ hsa_status_t HSA_API hsa_ext_sampler_create( * * @retval ::HSA_STATUS_ERROR_INVALID_AGENT The agent is invalid. */ -hsa_status_t HSA_API - hsa_ext_sampler_destroy(hsa_agent_t agent, hsa_ext_sampler_t sampler); +hsa_status_t HSA_API hsa_ext_sampler_destroy( + hsa_agent_t agent, + hsa_ext_sampler_t sampler); -/** - * @brief Enumeration constants added to ::hsa_status_t by this extension. - */ -enum { - /** - * Image format is not supported. - */ - HSA_EXT_STATUS_ERROR_IMAGE_FORMAT_UNSUPPORTED = 0x3000, - /** - * Image size is not supported. - */ - HSA_EXT_STATUS_ERROR_IMAGE_SIZE_UNSUPPORTED = 0x3001, - /** - * Image pitch is not supported or invalid. - */ - HSA_EXT_STATUS_ERROR_IMAGE_PITCH_UNSUPPORTED = 0x3002, - /** - * Sampler descriptor is not supported or invalid. - */ - HSA_EXT_STATUS_ERROR_SAMPLER_DESCRIPTOR_UNSUPPORTED = 0x3003 -}; - -/** - * @brief Enumeration constants added to ::hsa_agent_info_t by this - * extension. The value of any of these attributes is undefined if the - * agent is not a kernel agent, or the implementation does not support images. - */ -enum { - /** - * Maximum number of elements in 1D images. Must be at most 16384. The type - * of this attribute is uint32_t. - */ - HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS = 0x3000, - /** - * Maximum number of elements in 1DA images. Must be at most 16384. The type - * of this attribute is uint32_t. - */ - HSA_EXT_AGENT_INFO_IMAGE_1DA_MAX_ELEMENTS = 0x3001, - /** - * Maximum number of elements in 1DB images. Must be at most 65536. The type - * of this attribute is uint32_t. - */ - HSA_EXT_AGENT_INFO_IMAGE_1DB_MAX_ELEMENTS = 0x3002, - /** - * Maximum dimensions (width, height) of 2D images, in image elements. The X - * and Y maximums must be at most 16384. The type of this attribute is - * uint32_t[2]. - */ - HSA_EXT_AGENT_INFO_IMAGE_2D_MAX_ELEMENTS = 0x3003, - /** - * Maximum dimensions (width, height) of 2DA images, in image elements. The X - * and Y maximums must be at most 16384. The type of this attribute is - * uint32_t[2]. - */ - HSA_EXT_AGENT_INFO_IMAGE_2DA_MAX_ELEMENTS = 0x3004, - /** - * Maximum dimensions (width, height) of 2DDEPTH images, in image - * elements. The X and Y maximums must be at most 16384. The type of this - * attribute is uint32_t[2]. - */ - HSA_EXT_AGENT_INFO_IMAGE_2DDEPTH_MAX_ELEMENTS = 0x3005, - /** - * Maximum dimensions (width, height) of 2DADEPTH images, in image - * elements. The X and Y maximums must be at most 16384. The type of this - * attribute is uint32_t[2]. - */ - HSA_EXT_AGENT_INFO_IMAGE_2DADEPTH_MAX_ELEMENTS = 0x3006, - /** - * Maximum dimensions (width, height, depth) of 3D images, in image - * elements. The maximum along any dimension cannot exceed 2048. The type of - * this attribute is uint32_t[3]. - */ - HSA_EXT_AGENT_INFO_IMAGE_3D_MAX_ELEMENTS = 0x3007, - /** - * Maximum number of image layers in a image array. Must not exceed 2048. The - * type of this attribute is uint32_t. - */ - HSA_EXT_AGENT_INFO_IMAGE_ARRAY_MAX_LAYERS = 0x3008, - /** - * Maximum number of read-only image handles that can be created at any one - * time. Must be at least 128. The type of this attribute is uint32_t. - */ - HSA_EXT_AGENT_INFO_MAX_IMAGE_RD_HANDLES = 0x3009, - /** - * Maximum number of write-only and read-write image handles (combined) that - * can be created at any one time. Must be at least 64. The type of this - * attribute is uint32_t. - */ - HSA_EXT_AGENT_INFO_MAX_IMAGE_RORW_HANDLES = 0x300A, - /** - * Maximum number of sampler handlers that can be created at any one - * time. Must be at least 16. The type of this attribute is uint32_t. - */ - HSA_EXT_AGENT_INFO_MAX_SAMPLER_HANDLERS = 0x300B -}; - -/** @} */ #define hsa_ext_images_1_00 +/** + * @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. + */ typedef struct hsa_ext_images_1_00_pfn_s { + hsa_status_t (*hsa_ext_image_get_capability)( - hsa_agent_t agent, hsa_ext_image_geometry_t geometry, - const hsa_ext_image_format_t *image_format, uint32_t *capability_mask); + hsa_agent_t agent, + hsa_ext_image_geometry_t geometry, + const hsa_ext_image_format_t *image_format, + uint32_t *capability_mask); hsa_status_t (*hsa_ext_image_data_get_info)( - hsa_agent_t agent, const hsa_ext_image_descriptor_t *image_descriptor, - hsa_access_permission_t access_permission, - hsa_ext_image_data_info_t *image_data_info); + hsa_agent_t agent, + const hsa_ext_image_descriptor_t *image_descriptor, + hsa_access_permission_t access_permission, + hsa_ext_image_data_info_t *image_data_info); hsa_status_t (*hsa_ext_image_create)( - hsa_agent_t agent, const hsa_ext_image_descriptor_t *image_descriptor, - const void *image_data, hsa_access_permission_t access_permission, - hsa_ext_image_t *image); + hsa_agent_t agent, + const hsa_ext_image_descriptor_t *image_descriptor, + void *image_data, + hsa_access_permission_t access_permission, + hsa_ext_image_t *image); - hsa_status_t (*hsa_ext_image_destroy)(hsa_agent_t agent, - hsa_ext_image_t image); + hsa_status_t (*hsa_ext_image_destroy)( + hsa_agent_t agent, + hsa_ext_image_t image); - hsa_status_t (*hsa_ext_image_copy)(hsa_agent_t agent, - hsa_ext_image_t src_image, - const hsa_dim3_t *src_offset, - hsa_ext_image_t dst_image, - const hsa_dim3_t *dst_offset, - const hsa_dim3_t *range); + hsa_status_t (*hsa_ext_image_copy)( + hsa_agent_t agent, + hsa_ext_image_t src_image, + const hsa_dim3_t* src_offset, + hsa_ext_image_t dst_image, + const hsa_dim3_t* dst_offset, + const hsa_dim3_t* range); hsa_status_t (*hsa_ext_image_import)( - hsa_agent_t agent, const void *src_memory, size_t src_row_pitch, - size_t src_slice_pitch, hsa_ext_image_t dst_image, - const hsa_ext_image_region_t *image_region); + hsa_agent_t agent, + const void *src_memory, + size_t src_row_pitch, + size_t src_slice_pitch, + hsa_ext_image_t dst_image, + const hsa_ext_image_region_t *image_region); hsa_status_t (*hsa_ext_image_export)( - hsa_agent_t agent, hsa_ext_image_t src_image, void *dst_memory, - size_t dst_row_pitch, size_t dst_slice_pitch, - const hsa_ext_image_region_t *image_region); + hsa_agent_t agent, + hsa_ext_image_t src_image, + void *dst_memory, + size_t dst_row_pitch, + size_t dst_slice_pitch, + const hsa_ext_image_region_t *image_region); hsa_status_t (*hsa_ext_image_clear)( - hsa_agent_t agent, hsa_ext_image_t image, const void *data, - const hsa_ext_image_region_t *image_region); + hsa_agent_t agent, + hsa_ext_image_t image, + const void* data, + const hsa_ext_image_region_t *image_region); hsa_status_t (*hsa_ext_sampler_create)( - hsa_agent_t agent, const hsa_ext_sampler_descriptor_t *sampler_descriptor, - hsa_ext_sampler_t *sampler); + hsa_agent_t agent, + const hsa_ext_sampler_descriptor_t *sampler_descriptor, + hsa_ext_sampler_t *sampler); - hsa_status_t (*hsa_ext_sampler_destroy)(hsa_agent_t agent, - hsa_ext_sampler_t sampler); + hsa_status_t (*hsa_ext_sampler_destroy)( + hsa_agent_t agent, + hsa_ext_sampler_t sampler); } hsa_ext_images_1_00_pfn_t; +#define hsa_ext_images_1 + +/** + * @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. + */ +typedef struct hsa_ext_images_1_pfn_s { + + hsa_status_t (*hsa_ext_image_get_capability)( + hsa_agent_t agent, + hsa_ext_image_geometry_t geometry, + const hsa_ext_image_format_t *image_format, + uint32_t *capability_mask); + + hsa_status_t (*hsa_ext_image_data_get_info)( + hsa_agent_t agent, + const hsa_ext_image_descriptor_t *image_descriptor, + hsa_access_permission_t access_permission, + hsa_ext_image_data_info_t *image_data_info); + + hsa_status_t (*hsa_ext_image_create)( + hsa_agent_t agent, + const hsa_ext_image_descriptor_t *image_descriptor, + void *image_data, + hsa_access_permission_t access_permission, + hsa_ext_image_t *image); + + hsa_status_t (*hsa_ext_image_destroy)( + hsa_agent_t agent, + hsa_ext_image_t image); + + hsa_status_t (*hsa_ext_image_copy)( + hsa_agent_t agent, + hsa_ext_image_t src_image, + const hsa_dim3_t* src_offset, + hsa_ext_image_t dst_image, + const hsa_dim3_t* dst_offset, + const hsa_dim3_t* range); + + hsa_status_t (*hsa_ext_image_import)( + hsa_agent_t agent, + const void *src_memory, + size_t src_row_pitch, + size_t src_slice_pitch, + hsa_ext_image_t dst_image, + const hsa_ext_image_region_t *image_region); + + hsa_status_t (*hsa_ext_image_export)( + hsa_agent_t agent, + hsa_ext_image_t src_image, + void *dst_memory, + size_t dst_row_pitch, + size_t dst_slice_pitch, + const hsa_ext_image_region_t *image_region); + + hsa_status_t (*hsa_ext_image_clear)( + hsa_agent_t agent, + hsa_ext_image_t image, + const void* data, + const hsa_ext_image_region_t *image_region); + + hsa_status_t (*hsa_ext_sampler_create)( + hsa_agent_t agent, + const hsa_ext_sampler_descriptor_t *sampler_descriptor, + hsa_ext_sampler_t *sampler); + + hsa_status_t (*hsa_ext_sampler_destroy)( + hsa_agent_t agent, + hsa_ext_sampler_t sampler); + + hsa_status_t (*hsa_ext_image_get_capability_with_layout)( + hsa_agent_t agent, + hsa_ext_image_geometry_t geometry, + const hsa_ext_image_format_t *image_format, + hsa_ext_image_data_layout_t image_data_layout, + uint32_t *capability_mask); + + hsa_status_t (*hsa_ext_image_data_get_info_with_layout)( + const hsa_ext_image_descriptor_t *image_descriptor, + hsa_access_permission_t access_permission, + hsa_ext_image_data_layout_t image_data_layout, + size_t image_data_row_pitch, + size_t image_data_slice_pitch, + hsa_ext_image_data_info_t *image_data_info); + + hsa_status_t (*hsa_ext_image_create_with_layout)( + hsa_agent_t agent, + const hsa_ext_image_descriptor_t *image_descriptor, + void *image_data, + hsa_access_permission_t access_permission, + hsa_ext_image_data_layout_t image_data_layout, + size_t image_data_row_pitch, + size_t image_data_slice_pitch, + hsa_ext_image_t *image); + +} hsa_ext_images_1_pfn_t; +/** @} */ + #ifdef __cplusplus } // end extern "C" block #endif /*__cplusplus*/ diff --git a/runtime/hsa-runtime/loader/loaders.cpp b/runtime/hsa-runtime/loader/loaders.cpp index f01d48d276..2b314e1a18 100644 --- a/runtime/hsa-runtime/loader/loaders.cpp +++ b/runtime/hsa-runtime/loader/loaders.cpp @@ -185,7 +185,7 @@ namespace loader { hsa_agent_t agent, hsa_access_permission_t image_permission, const hsa_ext_image_descriptor_t *image_descriptor, - const void *image_data, + void *image_data, hsa_ext_image_t *image_handle) { void* ptr = alignedMalloc(256, 8); diff --git a/runtime/hsa-runtime/loader/loaders.hpp b/runtime/hsa-runtime/loader/loaders.hpp index 81e13fbc64..b0708a66c8 100644 --- a/runtime/hsa-runtime/loader/loaders.hpp +++ b/runtime/hsa-runtime/loader/loaders.hpp @@ -89,7 +89,7 @@ namespace loader { hsa_agent_t agent, hsa_access_permission_t image_permission, const hsa_ext_image_descriptor_t *image_descriptor, - const void *image_data, + void *image_data, hsa_ext_image_t *image_handle) override; hsa_status_t ImageDestroy(