rocr: Add support for Mipmapped Array (#1847)

SWDEV-539526 - Add support for Mipmapped Array in Rocr

Add support for Mipmapped Array functionality in Rocr Runtimeenabling GPU applications to work with multi-level texture mipmaps. The implementation introduces new public APIs for creating, querying, and managing mipmapped arrays across different GPU architectures.

Signed-off-by: Apurv Mishra <Apurv.Mishra@amd.com>
Co-authored-by: Shweta Khatri <shweta.khatri@amd.com>
Co-authored-by: taosang2 <tao.sang@amd.com>
This commit is contained in:
Apurv Mishra
2026-01-08 18:14:39 -05:00
committed by GitHub
parent 8b529e7b29
commit be375c2dbf
21 changed files with 2918 additions and 101 deletions
@@ -103,6 +103,14 @@ class ImageRuntime {
const void* image_data, const hsa_access_permission_t access_permission,
hsa_ext_image_t& image);
/// @brief Create mipmapped array object with AMD-specific layout and return its handle.
hsa_status_t CreateMipmapArrayHandleWithLayout(
hsa_agent_t component, const hsa_ext_image_descriptor_t& mipmap_descriptor,
const hsa_amd_image_descriptor_t* image_layout,
const void* image_data, const hsa_access_permission_t access_permission,
uint32_t num_mipmap_levels,
hsa_ext_image_t& image_handle);
/// @brief Destroy the device image object referenced by the handle.
hsa_status_t DestroyImageHandle(const hsa_ext_image_t& image);
@@ -137,6 +145,34 @@ class ImageRuntime {
/// @brief Destroy the device sampler object referenced by the handle.
hsa_status_t DestroySamplerHandle(hsa_ext_sampler_t& sampler);
/// @brief Create device Mipmap array object and return its handle
hsa_status_t CreateMipmapArrayHandle(
hsa_agent_t component, const hsa_ext_image_descriptor_t& mipmap_descriptor,
const void* image_data, const hsa_access_permission_t access_permission,
uint32_t num_mipmap_levels,
const hsa_ext_image_data_layout_t mipmap_layout,
size_t image_data_row_pitch, size_t image_data_slice_pitch,
hsa_ext_image_t& image_handle);
/// @brief - Helper function to compute mipmapped surface size / alignment & max levels.
hsa_status_t GetMipmapArraySizeAndAlignment(
hsa_agent_t component,
const hsa_ext_image_descriptor_t& desc,
uint32_t num_mipmap_levels,
hsa_ext_image_data_layout_t layout,
size_t row_pitch,
size_t slice_pitch,
size_t& size_out,
size_t& alignment_out);
/// @brief Destroy the mipmapped array object referenced by the handle.
hsa_status_t DestroyMipmapArrayHandle(const hsa_ext_image_t& image_handle);
/// @brief Get the handle for a specific mipmap level in a mipmapped array.
hsa_status_t GetMipmapArrayLevelHandle(
hsa_agent_t agent, const hsa_ext_image_t& mipmapped_array,
uint32_t mip_level, hsa_ext_image_t& level_image_out);
ImageManager* image_manager(hsa_agent_t agent) {
std::map<uint64_t, ImageManager*>::iterator it = image_managers_.find(agent.handle);
return (it != image_managers_.end()) ? it->second : NULL;