From 61c817a2d3e5f1c8f2ce8f471b935a5c04423869 Mon Sep 17 00:00:00 2001 From: "Poag, Charis" Date: Tue, 19 Aug 2025 11:13:18 -0500 Subject: [PATCH] [SWDEV-546220] Fix mVF xcd check within tests (#628) Adding a check to see if we're in guest -> allowing equal XCD values. This is because in mVF configurations, we may not be able to read the gfx clock values. Change-Id: I8e5d9627e061e98ec854734a91624c8077644a2a Signed-off-by: Charis Poag [ROCm/amdsmi commit: e12d2706939a71920cfc6bc26072f7b967e0bf76] --- .../functional/computepartition_read_write.cc | 9 ++++++++- .../functional/memorypartition_read_write.cc | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/projects/amdsmi/tests/amd_smi_test/functional/computepartition_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/computepartition_read_write.cc index 6cb6b4d2ad..4edeeee709 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/computepartition_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/computepartition_read_write.cc @@ -595,7 +595,14 @@ void TestComputePartitionReadWrite::Run(void) { if (ret == AMDSMI_STATUS_SUCCESS) { max_xcps = static_cast(num_xcd); } - EXPECT_LT(partition_id[i], max_xcps); + if (!amd::smi::is_vm_guest()) { + // In BM, we can get the number of XCDs (calculated by getting # of gfx_clocks) + EXPECT_LT(partition_id[i], max_xcps); + } else { + // In guest, we may not be able to get the number of XCDs + // (calculated by getting # of gfx_clocks) + EXPECT_LE(partition_id[i], max_xcps); + } break; } case AMDSMI_ACCELERATOR_PARTITION_INVALID: diff --git a/projects/amdsmi/tests/amd_smi_test/functional/memorypartition_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/memorypartition_read_write.cc index 8c8ea6e354..2bb46b0bf6 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/memorypartition_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/memorypartition_read_write.cc @@ -34,6 +34,7 @@ #include "../test_common.h" #include "amd_smi/amdsmi.h" #include "amd_smi/impl/amd_smi_utils.h" +#include "rocm_smi/rocm_smi_utils.h" #include "memorypartition_read_write.h" const uint32_t MAX_UNSUPPORTED_PARTITIONS = 0; @@ -258,7 +259,14 @@ void TestMemoryPartitionReadWrite::Run(void) { if (ret == AMDSMI_STATUS_SUCCESS) { max_xcps = static_cast(num_xcd); } - EXPECT_LT(partition_id[i], max_xcps); + if (!amd::smi::is_vm_guest()) { + // In BM, we can get the number of XCDs (calculated by getting # of gfx_clocks) + EXPECT_LT(partition_id[i], max_xcps); + } else { + // In guest, we may not be able to get the number of XCDs + // (calculated by getting # of gfx_clocks) + EXPECT_LE(partition_id[i], max_xcps); + } break; } case AMDSMI_ACCELERATOR_PARTITION_INVALID: