Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/catch/unit/compiler/hipClassKernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ passByValueKernel(testPassByValue obj, bool* result_ecd) {
}

TEST_CASE("Unit_hipClassKernel_Value") {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, 0));
if (!prop.canMapHostMemory) {
HipTest::HIP_SKIP_TEST("Test requires canMapHostMemory support");
return;
}
bool *result_ecd,*result_ech;
result_ech = AllocateHostMemory();
result_ecd = AllocateDeviceMemory();
Expand Down
7 changes: 7 additions & 0 deletions tests/catch/unit/kernel/hipMemFaultStackAllocation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ static bool verify(const int* C_d, const int* A_d) {
}

TEST_CASE("Unit_hipMemFaultStackAllocation_Check") {
int managedSupport = 0;
HIP_CHECK(hipDeviceGetAttribute(&managedSupport,
hipDeviceAttributeManagedMemory, 0));
if (!managedSupport) {
HipTest::HIP_SKIP_TEST("Device does not support managed memory");
return;
}
hipError_t ret;
int *A_d, *C_d;
const size_t Nbytes = N * sizeof(int);
Expand Down
6 changes: 6 additions & 0 deletions tests/catch/unit/memory/hipHostGetDevicePointer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ TEST_CASE("Unit_hipHostGetDevicePointer_Negative") {
template <typename T> __global__ void set(T* ptr, T val) { *ptr = val; }

TEST_CASE("Unit_hipHostGetDevicePointer_UseCase") {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, 0));
if (!prop.canMapHostMemory) {
HipTest::HIP_SKIP_TEST("Test requires canMapHostMemory support");
return;
}
int* hPtr{nullptr};
HIP_CHECK(hipHostMalloc(&hPtr, sizeof(int)));

Expand Down
12 changes: 12 additions & 0 deletions tests/catch/unit/memory/hipHostMalloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ This testcase verifies the hipHostMalloc API by
3. validates the result.
*/
TEST_CASE("Unit_hipHostMalloc_NonCoherent") {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, 0));
if (!prop.canMapHostMemory) {
HipTest::HIP_SKIP_TEST("Test requires canMapHostMemory support");
return;
}
int* A = nullptr;
HIP_CHECK(hipHostMalloc(reinterpret_cast<void**>(&A),
sizeBytes, hipHostMallocNonCoherent));
Expand Down Expand Up @@ -224,6 +230,12 @@ This testcase verifies the hipHostMalloc API by
3. validates the result.
*/
TEST_CASE("Unit_hipHostMalloc_Default") {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, 0));
if (!prop.canMapHostMemory) {
HipTest::HIP_SKIP_TEST("Test requires canMapHostMemory support");
return;
}
int* A = nullptr;
HIP_CHECK(hipHostMalloc(reinterpret_cast<void**>(&A), sizeBytes));
const char* ptrType = "default";
Expand Down
5 changes: 2 additions & 3 deletions tests/catch/unit/memory/hipMallocManaged.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ static unsigned threadsPerBlock{256};
TEST_CASE("Unit_hipMallocManaged_Basic") {
auto managed = HmmAttrPrint();
if (managed != 1) {
WARN(
"GPU doesn't support hipDeviceAttributeManagedMemory attribute so defaulting to system "
"memory.");
HipTest::HIP_SKIP_TEST("GPU doesn't support managed memory");
return;
}

float *A, *B, *C;
Expand Down
7 changes: 7 additions & 0 deletions tests/catch/unit/memory/hipMemPrefetchAsyncExtTsts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@ TEST_CASE("Unit_hipMemPrefetchAsyncNegativeTst") {
which is not multiple of page Size, but still trying to launch kernel and
see if we are getting values as expected.*/
TEST_CASE("Unit_hipMemPrefetchAsync_NonPageSz") {
int managedSupport = 0;
HIP_CHECK(hipDeviceGetAttribute(&managedSupport,
hipDeviceAttributeManagedMemory, 0));
if (!managedSupport) {
HipTest::HIP_SKIP_TEST("Device does not support managed memory");
return;
}
int *Hmm = nullptr, NumElms = 4096*2, InitVal = 123;
hipStream_t strm;
bool IfTestPassed = true;
Expand Down
6 changes: 6 additions & 0 deletions tests/catch/unit/memory/hipMemcpy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,12 @@ This testcase verifies the following scenarios
*/
TEMPLATE_TEST_CASE("Unit_hipMemcpy_H2H-H2D-D2H-H2PinMem", "", int,
float, double) {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, 0));
if (!prop.canMapHostMemory) {
HipTest::HIP_SKIP_TEST("Test requires canMapHostMemory support");
return;
}
TestType *A_d{nullptr}, *B_d{nullptr};
TestType *A_h{nullptr}, *B_h{nullptr};
TestType *A_Ph{nullptr}, *B_Ph{nullptr};
Expand Down
6 changes: 6 additions & 0 deletions tests/catch/unit/memory/hipMemcpyAsync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ This testcase verifies the following scenarios
*/
TEMPLATE_TEST_CASE("Unit_hipMemcpyAsync_H2H-H2D-D2H-H2PinMem", "", char, int,
float, double) {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, 0));
if (!prop.canMapHostMemory) {
HipTest::HIP_SKIP_TEST("Test requires canMapHostMemory support");
return;
}
TestType *A_d{nullptr}, *B_d{nullptr};
TestType *A_h{nullptr}, *B_h{nullptr};
TestType *A_Ph{nullptr}, *B_Ph{nullptr};
Expand Down
6 changes: 6 additions & 0 deletions tests/catch/unit/memory/hipMemoryAllocateCoherent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ __global__ void Kernel(float* hostRes, int clkRate) {
}

TEST_CASE("Unit_hipHostMalloc_CoherentAccess") {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, 0));
if (!prop.canMapHostMemory) {
HipTest::HIP_SKIP_TEST("Test requires canMapHostMemory support");
return;
}
int blocks = 2;
float* hostRes;
HIP_CHECK(hipHostMalloc(&hostRes, blocks * sizeof(float),
Expand Down
6 changes: 6 additions & 0 deletions tests/catch/unit/memory/hipMemsetFunctional.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ void checkMemset(T value, size_t count, MemsetType memsetType, bool async = fals
if (mallocType == hipDeviceMalloc_t) {
HIP_CHECK(hipMalloc(&devPtr, count * sizeof(T)));
} else if (mallocType == hipHostMalloc_t) {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, 0));
if (!prop.canMapHostMemory) {
HipTest::HIP_SKIP_TEST("Test requires canMapHostMemory support");
return;
}
HIP_CHECK(hipHostMalloc(&devPtr, count * sizeof(T)));
}

Expand Down
6 changes: 6 additions & 0 deletions tests/catch/unit/memory/memset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ TEST_CASE("Unit_hipMemset_4bytes") {
}

TEST_CASE("Unit_hipMemset_4bytes_hostMem") {
hipDeviceProp_t prop;
HIP_CHECK(hipGetDeviceProperties(&prop, 0));
if (!prop.canMapHostMemory) {
HipTest::HIP_SKIP_TEST("Test requires canMapHostMemory support");
return;
}
int* d_a;
auto res = hipHostMalloc(&d_a, sizeof(int), 0);
REQUIRE(res == hipSuccess);
Expand Down