2
0

SWDEV-325709 - Testing hipDeviceAttributeFineGrainSupport property (#2637)

Added a test to check hipDeviceAttributeFineGrainSupport property.

Change-Id: I9750ef5494e22f4eb7305e1719be9712a3079c37

[ROCm/hip commit: 9169520aaa]
Este cometimento está contido em:
ROCm CI Service Account
2022-05-17 12:53:25 +05:30
cometido por GitHub
ascendente ed5f0b1d3e
cometimento 87f24c155a
@@ -231,6 +231,40 @@ TEST_CASE("Unit_hipGetDeviceAttribute_CheckAttrValues") {
props.texturePitchAlignment));
}
/**
* Validate the hipDeviceAttributeFineGrainSupport property in AMD.
*/
#if HT_AMD
// This is AMD specific property test
TEST_CASE("Unit_hipGetDeviceAttribute_CheckFineGrainSupport") {
int deviceId;
int deviceCount = 0;
HIP_CHECK(hipGetDeviceCount(&deviceCount));
REQUIRE(deviceCount > 0);
// Check hipDeviceAttributeFineGrainSupport for all available device
// in system.
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));
std::string gpu_arch_name(props.gcnArchName);
if (std::string::npos != gpu_arch_name.find("gfx90a")) {
// Current GPU is gfx90a architecture
REQUIRE(value == 1);
} else if (std::string::npos != gpu_arch_name.find("gfx906")) {
// Current GPU is gfx906 architecture
REQUIRE(value == 0);
} else if (std::string::npos != gpu_arch_name.find("gfx908")) {
// Current GPU is gfx908 architecture
REQUIRE(value == 0);
}
}
}
#endif
/**
* Validates negative scenarios for hipDeviceGetAttribute
* scenario1: pi = nullptr