SWDEV-415965 - [catch2][dtest] Added test for newly added member hipDeviceAttributeHostRegisterSupported
Change-Id: I89f716f1be9c5a36d5ffdb24e056a13cc4a493ca
[ROCm/hip-tests commit: 6bc9d607ac]
Šī revīzija ir iekļauta:
revīziju iesūtīja
Rakesh Roy
vecāks
bf319a8e48
revīzija
bc93528aa2
@@ -418,7 +418,7 @@ using AttributeToStringMap = std::array<std::pair<hipDeviceAttribute_t, const ch
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr AttributeToStringMap<57> kCommonAttributes{{
|
||||
constexpr AttributeToStringMap<58> kCommonAttributes{{
|
||||
{hipDeviceAttributeEccEnabled, "hipDeviceAttributeEccEnabled"},
|
||||
{hipDeviceAttributeCanMapHostMemory, "hipDeviceAttributeCanMapHostMemory"},
|
||||
{hipDeviceAttributeClockRate, "hipDeviceAttributeClockRate"},
|
||||
@@ -479,9 +479,10 @@ constexpr AttributeToStringMap<57> kCommonAttributes{{
|
||||
{hipDeviceAttributeTotalGlobalMem, "hipDeviceAttributeTotalGlobalMem"},
|
||||
{hipDeviceAttributeWarpSize, "hipDeviceAttributeWarpSize"},
|
||||
{hipDeviceAttributeMemoryPoolsSupported, "hipDeviceAttributeMemoryPoolsSupported"},
|
||||
{hipDeviceAttributeUnifiedAddressing, "hipDeviceAttributeUnifiedAddressing"},
|
||||
{hipDeviceAttributeUnifiedAddressing, "hipDeviceAttributeUnifiedAddressing"},
|
||||
{hipDeviceAttributeVirtualMemoryManagementSupported,
|
||||
"hipDeviceAttributeVirtualMemoryManagementSupported"}
|
||||
"hipDeviceAttributeVirtualMemoryManagementSupported"},
|
||||
{hipDeviceAttributeHostRegisterSupported, "hipDeviceAttributeHostRegisterSupported"}
|
||||
}};
|
||||
|
||||
#if HT_NVIDIA
|
||||
@@ -610,3 +611,38 @@ TEST_CASE("Print_Out_Attributes") {
|
||||
|
||||
std::flush(std::cout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - verify hipDeviceAttributeHostRegisterSupported attribute.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/device/hipGetDeviceAttribute.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 6.0
|
||||
*/
|
||||
TEST_CASE("Unit_hipGetDeviceAttribute_hipDevAttrHostRegisterSupported") {
|
||||
hipError_t ret_val;
|
||||
int hipDevAttr = 0;
|
||||
ret_val = hipDeviceGetAttribute(&hipDevAttr,
|
||||
hipDeviceAttributeHostRegisterSupported, 0);
|
||||
INFO("hipDeviceAttributeHostRegisterSupported: " << hipDevAttr);
|
||||
|
||||
if (ret_val == hipSuccess) {
|
||||
auto x = std::unique_ptr<int>(new int);
|
||||
HIP_CHECK(hipHostRegister(x.get(), sizeof(int), hipHostRegisterDefault));
|
||||
|
||||
void* device_memory;
|
||||
HIP_CHECK(hipHostGetDevicePointer(&device_memory, x.get(), 0));
|
||||
|
||||
HIP_CHECK(hipHostUnregister(x.get()));
|
||||
HIP_CHECK_ERROR(hipHostGetDevicePointer(&device_memory, x.get(), 0),
|
||||
hipErrorInvalidValue);
|
||||
} else {
|
||||
HipTest::HIP_SKIP_TEST("Skipping the test as GPU 0 doesn't support "
|
||||
"hipDeviceAttributeHostRegisterSupported attribute.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Atsaukties uz šo jaunā problēmā
Block a user