SWDEV-555889 - Support mipmap on rocr (#2082)

* SWDEV-555889 - Support mipmap on rocr

Support mipmap in hip-rt on rocr backend.
Enable all mipmap tests in Windows.
Some other minor improvement.

Add some SRD logs that will be removed finally.

* Add sampler.mipFilter to fix sampler issues on mipmap in rocr.
Fix format issues of view of leveled image and  mipmap image in blit kernel in rocr.
Enabled disabled mipmap tests.

* Rewrite view logic

* Set word4.f.PITCH = 0 for mipmap SRD on navi31 to fix unstable test issues.
Reset last error in nagative tests.

* Remove SRD dump log from hip-rt
Let Rocr mipmap log be in condition.

* minor format chang

* Exclude mipmap tests for mi200+ which don't support mipmap.
This commit is contained in:
Tao Sang
2026-01-21 12:10:29 -05:00
committed by GitHub
parent 5daeb14582
commit 163e44d0a8
29 changed files with 224 additions and 142 deletions
View File
@@ -82,6 +82,25 @@ set(NOT_FOR_gfx90a_AND_ABOVE_TEST
tex2DLayered.cc
tex3D.cc
tex3DGrad.cc
hipBindTextureToMipmappedArray.cc
hipMallocMipmappedArray.cc
hipFreeMipmappedArray.cc
hipGetMipmappedArrayLevel.cc
hipMipmappedArrayCreate.cc
hipMipmappedArrayDestroy.cc
hipMipmappedArrayGetLevel.cc
hipTextureMipmapObj1D.cc
hipTextureMipmapObj2D.cc
hipTextureMipmapObj3D.cc
tex1DLod.cc
tex1DLayeredLod.cc
tex2DLod.cc
tex2DLayeredLod.cc
tex3DLod.cc
hipTexRefSetGetMipmapFilterMode.cc
hipTexRefSetGetMipmapLevelBias.cc
hipTexRefSetGetMipmapLevelClamp.cc
hipTexRefSetGetMipmappedArray.cc
)
set(gfx90a_AND_ABOVE_TARGETS gfx90a gfx942 gfx950)
@@ -125,33 +144,6 @@ else()
set(TEST_SRC ${TEST_SRC} ${NOT_FOR_gfx90a_AND_ABOVE_TEST})
endif()
# Mipmap APIs are not supported on Linux
if(0)
set(TEST_SRC
${TEST_SRC}
hipBindTextureToMipmappedArray.cc
hipMallocMipmappedArray.cc
hipFreeMipmappedArray.cc
hipGetMipmappedArrayLevel.cc
hipMipmappedArrayCreate.cc
hipMipmappedArrayDestroy.cc
hipMipmappedArrayGetLevel.cc
hipTextureMipmapObj1D.cc
hipTextureMipmapObj2D.cc
hipTextureMipmapObj3D.cc
tex1DLod.cc
tex1DLayeredLod.cc
tex2DLod.cc
tex2DLayeredLod.cc
tex3DLod.cc
hipTexRefSetGetMipmapFilterMode.cc
hipTexRefSetGetMipmapLevelBias.cc
hipTexRefSetGetMipmapLevelClamp.cc
hipTexRefSetGetMipmappedArray.cc
)
endif()
hip_add_exe_to_target(NAME TextureTest
TEST_SRC ${TEST_SRC}
TEST_TARGET_NAME build_tests)
@@ -42,11 +42,6 @@ THE SOFTWARE.
TEST_CASE("Unit_hipFreeMipmappedArray_Negative_Parameters") {
CHECK_IMAGE_SUPPORT;
#ifdef __linux__
HipTest::HIP_SKIP_TEST("Mipmap APIs are not supported on Linux");
return;
#endif //__linux__
SECTION("array is nullptr") {
HIP_CHECK_ERROR(hipFreeMipmappedArray(nullptr), hipErrorInvalidValue);
}
@@ -42,11 +42,6 @@ THE SOFTWARE.
TEST_CASE("Unit_hipGetMipmappedArrayLevel_Negative_Parameters") {
CHECK_IMAGE_SUPPORT;
#ifdef __linux__
HipTest::HIP_SKIP_TEST("Mipmap APIs are not supported on Linux");
return;
#endif //__linux__
hipMipmappedArray_t array;
hipChannelFormatDesc desc = hipCreateChannelDesc<float>();
hipExtent extent = make_hipExtent(4, 4, 6);
@@ -42,11 +42,6 @@ THE SOFTWARE.
TEST_CASE("Unit_hipMallocMipmappedArray_Negative_Parameters") {
CHECK_IMAGE_SUPPORT;
#ifdef __linux__
HipTest::HIP_SKIP_TEST("Mipmap APIs are not supported on Linux");
return;
#endif //__linux__
hipMipmappedArray_t array;
hipChannelFormatDesc desc = hipCreateChannelDesc<float>();
hipExtent extent = make_hipExtent(4, 4, 6);
@@ -43,11 +43,6 @@ THE SOFTWARE.
TEST_CASE("Unit_hipMipmappedArrayCreate_Negative_Parameters") {
CHECK_IMAGE_SUPPORT;
#ifdef __linux__
HipTest::HIP_SKIP_TEST("Mipmap APIs are not supported on Linux");
return;
#endif //__linux__
hipmipmappedArray array;
HIP_ARRAY3D_DESCRIPTOR desc = {};
@@ -43,13 +43,6 @@ THE SOFTWARE.
TEST_CASE("Unit_hipMipmappedArrayDestroy_Negative_Parameters") {
CHECK_IMAGE_SUPPORT;
#ifdef __linux__
HipTest::HIP_SKIP_TEST("Mipmap APIs are not supported on Linux");
return;
#endif //__linux__
HIP_CHECK(hipFree(0));
SECTION("array is nullptr") {
HIP_CHECK_ERROR(hipMipmappedArrayDestroy(nullptr), hipErrorInvalidValue);
}
@@ -43,11 +43,6 @@ THE SOFTWARE.
TEST_CASE("Unit_hipMipmappedArrayGetLevel_Negative_Parameters") {
CHECK_IMAGE_SUPPORT;
#ifdef __linux__
HipTest::HIP_SKIP_TEST("Mipmap APIs are not supported on Linux");
return;
#endif //__linux__
hipmipmappedArray array;
HIP_ARRAY3D_DESCRIPTOR desc = {};
@@ -79,6 +74,7 @@ TEST_CASE("Unit_hipMipmappedArrayGetLevel_Negative_Parameters") {
}
HIP_CHECK(hipMipmappedArrayDestroy(array));
(void)hipGetLastError();
}
/**
@@ -246,10 +246,6 @@ TEST_CASE("Unit_TexObjectCreate_TypeArray_NullptrArray") {
#if 0
TEST_CASE("Unit_TexObjectCreate_TypeMipmapped") {
#if __linux__
HipTest::HIP_SKIP_TEST("Mipmap APIs are not supported on Linux");
return;
#endif // __linux__
CHECK_IMAGE_SUPPORT
hipMipmappedArray_t mipmapped_array;
@@ -277,10 +273,6 @@ TEST_CASE("Unit_TexObjectCreate_TypeMipmapped") {
}
TEST_CASE("Unit_TexObjectCreate_TypeMipmaped_IncompleteInit") {
#if __linux__
HipTest::HIP_SKIP_TEST("Mipmap APIs are not supported on Linux");
return;
#endif // __linux__
CHECK_IMAGE_SUPPORT
CTX_CREATE();
@@ -243,8 +243,6 @@ TEST_CASE("Unit_hipGetTextureObjectResourceViewDesc_Negative_Parameters") {
hipGetTextureObjectResourceViewDesc(&check_desc, static_cast<hipTextureObject_t>(0)),
hipErrorInvalidValue);
}
HipTest::HIP_SKIP_TEST("Skipping on NVIDIA platform");
}
#endif
@@ -161,7 +161,7 @@ TEMPLATE_TEST_CASE("Unit_tex2DLayeredLod_Positive_ReadModeNormalizedFloat", "",
y = GetCoordinate(y, params.NumItersY(), params.Height(), params.num_subdivisions,
params.tex_desc.normalizedCoords);
auto ref_val = fixture.tex_h.Tex2DLayered(x, y, layer, params.tex_desc);
if (!fixture.Verify(fixture.out_alloc_h[i], ref_val) {
if (!fixture.Verify(fixture.out_alloc_h[i], ref_val)) {
INFO("Layer: " << layer);
INFO("Filtering mode: " << FilteringModeToString(params.tex_desc.filterMode));
INFO("Normalized coordinates: " << std::boolalpha << params.tex_desc.normalizedCoords);