SWDEV-388493 - Delete test Unit_hipGetDeviceAttribute_CheckFineGrainSupport

- This test causes build failure when custom HIP_PATH is used
- It doesn't add much value as it verifies hipDeviceAttributeFineGrainSupport against HSA APIs
- In rare case only it can fail, because internally HIP uses the same HSA APIs for hipDeviceAttributeFineGrainSupport.

Change-Id: If3b566d1c784a318e076b640cc2f063b84e25413
This commit is contained in:
Rakesh Roy
2024-01-25 18:37:12 +05:30
committed by Rakesh Roy
vanhempi c7aa062b66
commit 569b088eb8
2 muutettua tiedostoa jossa 0 lisäystä ja 125 poistoa
-8
Näytä tiedosto
@@ -45,13 +45,5 @@ hip_add_exe_to_target(NAME DeviceTest
TEST_SRC ${TEST_SRC}
TEST_TARGET_NAME build_tests
COMPILE_OPTIONS -std=c++17)
# Add hsa-runtime dependencies for Unit_hipGetDeviceAttribute_CheckFineGrainSupport
if(UNIX)
if(HIP_PLATFORM STREQUAL "amd")
target_include_directories(DeviceTest PRIVATE ${ROCM_PATH}/include)
target_link_libraries(DeviceTest hsa-runtime64)
target_link_directories(DeviceTest PRIVATE ${ROCM_PATH}/lib)
endif()
endif()
add_dependencies(build_tests getDeviceCount)
@@ -35,21 +35,6 @@ THE SOFTWARE.
* Query for a specific device attribute.
*/
#ifdef __linux__
#if HT_AMD
#include "hsa/hsa_ext_amd.h"
#define HSA_CHECK(exp) { \
hsa_status_t status = (exp); \
if (status != HSA_STATUS_SUCCESS) { \
INFO("HSA Error Code: " << status \
<< "\n Str: " << #exp << "\n In File: " << __FILE__ \
<< "\n At line: " << __LINE__); \
REQUIRE(false); \
} \
}
#endif // HT_AMD
#endif // __linux__
static hipError_t test_hipDeviceGetAttribute(int deviceId,
hipDeviceAttribute_t attr,
int expectedValue = -1) {
@@ -267,108 +252,6 @@ TEST_CASE("Unit_hipGetDeviceAttribute_CheckAttrValues") {
props.texturePitchAlignment));
}
/*
* Validate the hipDeviceAttributeFineGrainSupport property in AMD.
*/
#ifdef __linux__
#if HT_AMD
typedef struct {
int device_index;
int *fine_grained_val;
} MemoryPoolInfo;
hsa_status_t IterateMemoryPoolCallback(hsa_amd_memory_pool_t pool, void* data) {
MemoryPoolInfo* memory_pool_info = reinterpret_cast<MemoryPoolInfo*>(data);
hsa_region_segment_t segment_type = (hsa_region_segment_t)0;
// Get segment information for this memory pool
HSA_CHECK(hsa_amd_memory_pool_get_info(pool, HSA_AMD_MEMORY_POOL_INFO_SEGMENT, &segment_type));
// Check for global segment
if (segment_type == HSA_REGION_SEGMENT_GLOBAL) {
uint32_t global_flag = 0;
// Get global flags for this memory pool
HSA_CHECK(hsa_amd_memory_pool_get_info(pool, HSA_AMD_MEMORY_POOL_INFO_GLOBAL_FLAGS,
&global_flag));
// If it is fine grained, then store the information
if ((global_flag & HSA_REGION_GLOBAL_FLAG_FINE_GRAINED) != 0) {
memory_pool_info->fine_grained_val[memory_pool_info->device_index] = 1;
}
}
return HSA_STATUS_SUCCESS;
}
hsa_status_t IterateAgentCallback(hsa_agent_t agent, void* data) {
hsa_device_type_t dev_type = HSA_DEVICE_TYPE_CPU;
MemoryPoolInfo* memory_pool_info = reinterpret_cast<MemoryPoolInfo*>(data);
// Get device type for this agent
HSA_CHECK(hsa_agent_get_info(agent, HSA_AGENT_INFO_DEVICE, &dev_type));
// If it is GPU device, then collect memory pool information
if (dev_type == HSA_DEVICE_TYPE_GPU) {
memory_pool_info->device_index++;
HSA_CHECK(hsa_amd_agent_iterate_memory_pools(agent, IterateMemoryPoolCallback,
memory_pool_info));
}
return HSA_STATUS_SUCCESS;
}
// Get Fine-grained memory information from HSA
void HsaGetFineGrainInfo(MemoryPoolInfo* memory_pool_info)
{
HSA_CHECK(hsa_init());
HSA_CHECK(hsa_iterate_agents(IterateAgentCallback, memory_pool_info));
}
/**
* Test Description
* ------------------------
* - Validate fine grain support attribute against
* known values for different AMD architectures
* Test source
* ------------------------
* - unit/device/hipGetDeviceAttribute.cc
* Test requirements
* ------------------------
* - Platform specific (AMD)
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipGetDeviceAttribute_CheckFineGrainSupport") {
int deviceId;
int deviceCount = 0;
HIP_CHECK(hipGetDeviceCount(&deviceCount));
assert(deviceCount > 0);
MemoryPoolInfo memory_pool_info = {-1, nullptr};
memory_pool_info.fine_grained_val = new int[deviceCount];
assert(memory_pool_info.fine_grained_val != nullptr);
for (int i = 0; i < deviceCount; i++) {
memory_pool_info.fine_grained_val[i] = 0; // Initialize to 0
}
// Get Fine-grained memory information from HSA
HsaGetFineGrainInfo(&memory_pool_info);
// Validate hipDeviceAttributeFineGrainSupport
for (int dev = 0; dev < deviceCount; dev++) {
HIP_CHECK(hipSetDevice(dev));
HIP_CHECK(hipGetDevice(&deviceId));
hipDeviceProp_t props;
HIP_CHECK(hipGetDeviceProperties(&props, deviceId));
int value = 0;
HIP_CHECK(hipDeviceGetAttribute(&value,
hipDeviceAttributeFineGrainSupport, deviceId));
REQUIRE(value == memory_pool_info.fine_grained_val[dev]);
}
delete[] memory_pool_info.fine_grained_val;
}
#endif // HT_AMD
#endif // __linux__
/**
* Test Description
* ------------------------