diff --git a/projects/rocr-runtime/runtime/hsa-runtime/image/addrlib/src/core/addrlib2.cpp b/projects/rocr-runtime/runtime/hsa-runtime/image/addrlib/src/core/addrlib2.cpp index 700287abd4..2d215cb657 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/image/addrlib/src/core/addrlib2.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/image/addrlib/src/core/addrlib2.cpp @@ -314,8 +314,6 @@ ADDR_E_RETURNCODE Lib::ComputeSurfaceInfo( } } - ADDR_ASSERT(pOut->surfSize != 0); - ValidBaseAlignments(pOut->baseAlign); return returnCode; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/image/image_manager_nv.cpp b/projects/rocr-runtime/runtime/hsa-runtime/image/image_manager_nv.cpp index 755fa8f01a..7312f6d807 100755 --- a/projects/rocr-runtime/runtime/hsa-runtime/image/image_manager_nv.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/image/image_manager_nv.cpp @@ -484,7 +484,11 @@ hsa_status_t ImageManagerNv::PopulateImageSrd(Image& image) const { word4.f.DEPTH = (image_array) // Doesn't hurt but isn't array_size already >0? ? std::max(image.desc.array_size, static_cast(1)) - 1 - : (image_3d) ? image.desc.depth - 1 : out.pitch - 1; + : (image_3d) ? image.desc.depth - 1 : 0; + uint32_t minor_ver = MinorVerFromDevID(chip_id_); + // For 1d, 2d and 2d-msaa in gfx1030 and beyond this is pitch-1 + if ((minor_ver >= 3) && !image_array && !image_3d) + word4.f.PITCH = out.pitch - 1; word5.val = 0; word6.val = 0; @@ -630,6 +634,7 @@ uint32_t ImageManagerNv::GetAddrlibSurfaceInfoNv( const uint32_t num_slice = static_cast( std::max(kMinNumSlice, std::max(desc.array_size, desc.depth))); + uint32_t minor_ver = MinorVerFromDevID(chip_id_); ADDR2_COMPUTE_SURFACE_INFO_INPUT in = {0}; in.size = sizeof(ADDR2_COMPUTE_SURFACE_INFO_INPUT); in.format = addrlib_format; @@ -637,6 +642,9 @@ uint32_t ImageManagerNv::GetAddrlibSurfaceInfoNv( in.width = width; in.height = height; in.numSlices = num_slice; + // Custom Pitch is supported in gfx1030 and beyond + if (minor_ver >= 3) + in.pitchInElement = image_data_row_pitch / image_prop.element_size; switch (desc.geometry) { case HSA_EXT_IMAGE_GEOMETRY_1D: case HSA_EXT_IMAGE_GEOMETRY_1DB: diff --git a/projects/rocr-runtime/runtime/hsa-runtime/image/resource_nv.h b/projects/rocr-runtime/runtime/hsa-runtime/image/resource_nv.h index 986d08e73d..1e9f5d2507 100755 --- a/projects/rocr-runtime/runtime/hsa-runtime/image/resource_nv.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/image/resource_nv.h @@ -300,21 +300,34 @@ union SQ_IMG_RSRC_WORD3 { #define SQ_IMG_RSC_WRD4_REG_SZ 32 #define SQ_IMG_RSC_WRD4_DEPTH_SZ 13 #define SQ_IMG_RSC_WRD4_BASE_ARR_SZ 13 -struct sq_img_rsrc_word4_t { +#define SQ_IMG_RSC_WRD4_PITCH_SZ 14 +union sq_img_rsrc_word4_t { + struct { #if defined(LITTLEENDIAN_CPU) - // For arrays this is last slice in view, for 3D this is depth-1, For remaining this is pitch-1 - unsigned int DEPTH : SQ_IMG_RSC_WRD4_DEPTH_SZ; - unsigned int : 1; //Pitch[13] in gfx1030 - unsigned int : 2; - unsigned int BASE_ARRAY : SQ_IMG_RSC_WRD4_BASE_ARR_SZ; - unsigned int : 3; + // For arrays this is last slice in view, for 3D this is depth-1, For remaining this is pitch-1 + unsigned int DEPTH : SQ_IMG_RSC_WRD4_DEPTH_SZ; + unsigned int : 1; //Pitch[13] in gfx1030 + unsigned int : 2; + unsigned int BASE_ARRAY : SQ_IMG_RSC_WRD4_BASE_ARR_SZ; + unsigned int : 3; #elif defined(BIGENDIAN_CPU) - unsigned int : 3; - unsigned int BASE_ARRAY : SQ_IMG_RSC_WRD4_BASE_ARR_SZ; - unsigned int : 2; - unsigned int : 1; //Pitch[13] in gfx1030 - unsigned int DEPTH : SQ_IMG_RSC_WRD4_DEPTH_SZ; //Pitch[0:12] in gfx1030 + unsigned int : 3; + unsigned int BASE_ARRAY : SQ_IMG_RSC_WRD4_BASE_ARR_SZ; + unsigned int : 2; + unsigned int : 1; //Pitch[13] in gfx1030 + unsigned int DEPTH : SQ_IMG_RSC_WRD4_DEPTH_SZ; //Pitch[0:12] in gfx1030 #endif + }; + struct { +#if defined(LITTLEENDIAN_CPU) + // For 1d, 2d and 2d-msaa in gfx1030 this is pitch-1 + unsigned int PITCH : SQ_IMG_RSC_WRD4_PITCH_SZ; + unsigned int : SQ_IMG_RSC_WRD4_REG_SZ-SQ_IMG_RSC_WRD4_PITCH_SZ; +#elif defined(BIGENDIAN_CPU) + unsigned int : SQ_IMG_RSC_WRD4_REG_SZ-SQ_IMG_RSC_WRD4_PITCH_SZ; + unsigned int PITCH : SQ_IMG_RSC_WRD4_PITCH_SZ; +#endif + }; }; union SQ_IMG_RSRC_WORD4 { sq_img_rsrc_word4_t bitfields, bits, f;