From 87f24c155a86a804154d1a0414b61ffd2e97415f Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 17 May 2022 12:53:25 +0530 Subject: [PATCH] SWDEV-325709 - Testing hipDeviceAttributeFineGrainSupport property (#2637) Added a test to check hipDeviceAttributeFineGrainSupport property. Change-Id: I9750ef5494e22f4eb7305e1719be9712a3079c37 [ROCm/hip commit: 9169520aaa46f3cf2de831dcbb0002189b47ad67] --- .../unit/device/hipGetDeviceAttribute.cc | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/projects/hip/tests/catch/unit/device/hipGetDeviceAttribute.cc b/projects/hip/tests/catch/unit/device/hipGetDeviceAttribute.cc index 136a029829..e21c4eac90 100644 --- a/projects/hip/tests/catch/unit/device/hipGetDeviceAttribute.cc +++ b/projects/hip/tests/catch/unit/device/hipGetDeviceAttribute.cc @@ -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