diff --git a/projects/hip-tests/catch/unit/atomics/memory_order_common.hh b/projects/hip-tests/catch/unit/atomics/memory_order_common.hh index 5ecabd1925..cb98593a90 100644 --- a/projects/hip-tests/catch/unit/atomics/memory_order_common.hh +++ b/projects/hip-tests/catch/unit/atomics/memory_order_common.hh @@ -217,6 +217,8 @@ template SECTION("Global memory") { const auto alloc_type = LinearAllocs::hipMalloc; LinearAllocGuard data(alloc_type, sizeof(int)); + + HIP_CHECK(hipMemset(data.ptr(), 0, sizeof(int))); TestKernel <<>>(flag.ptr(), data.ptr(), ret.ptr()); } @@ -245,10 +247,14 @@ template void SystemTest() LinearAllocGuard flag(LinearAllocs::hipMallocManaged, sizeof(int)); LinearAllocGuard ret(LinearAllocs::hipMallocManaged, sizeof(int)); + HIP_CHECK(hipMemset(flag.ptr(), 0, sizeof(int))); + SECTION("Global memory") { const auto alloc_type = GENERATE(LinearAllocs::hipHostMalloc , LinearAllocs::hipMallocManaged); LinearAllocGuard data(alloc_type, sizeof(int)); + HIP_CHECK(hipMemset(data.ptr(), 0, sizeof(int))); + if constexpr(operation == BuiltinAtomicOperation::kAnd) { flag.ptr()[0] = 1; } @@ -405,6 +411,9 @@ template void Test() { LinearAllocGuard counter1(LinearAllocs::hipMallocManaged, sizeof(int)); LinearAllocGuard counter2(LinearAllocs::hipMallocManaged, sizeof(int)); + HIP_CHECK(hipMemset(counter1.ptr(), 0, sizeof(int))); + HIP_CHECK(hipMemset(counter2.ptr(), 0, sizeof(int))); + SECTION("Global memory") { const auto alloc_type = LinearAllocs::hipMalloc; LinearAllocGuard flag1(alloc_type, sizeof(int)); @@ -443,9 +452,11 @@ template void SystemTest() { LinearAllocGuard counter1(LinearAllocs::hipMallocManaged, sizeof(int)); LinearAllocGuard counter2(LinearAllocs::hipMallocManaged, sizeof(int)); - std::vector streams; + HIP_CHECK(hipMemset(counter1.ptr(), 0, sizeof(int))); + HIP_CHECK(hipMemset(counter2.ptr(), 0, sizeof(int))); + for (auto j = 0; j < 2; ++j) { streams.emplace_back(Streams::created); }