SWDEV-541351 - fix use of uninitialized memory in Unit___hip_atomic_compare_exchange tests (#1976)
Bu işleme şunda yer alıyor:
işlemeyi yapan:
GitHub
ebeveyn
3466ec5458
işleme
8abfee9f26
@@ -217,6 +217,8 @@ template <BuiltinAtomicOperation operation, int memory_order, int memory_scope>
|
||||
SECTION("Global memory") {
|
||||
const auto alloc_type = LinearAllocs::hipMalloc;
|
||||
LinearAllocGuard<int> data(alloc_type, sizeof(int));
|
||||
|
||||
HIP_CHECK(hipMemset(data.ptr(), 0, sizeof(int)));
|
||||
TestKernel<operation, memory_order, memory_scope>
|
||||
<<<blocks, threads>>>(flag.ptr(), data.ptr(), ret.ptr());
|
||||
}
|
||||
@@ -245,10 +247,14 @@ template <BuiltinAtomicOperation operation, int memory_order> void SystemTest()
|
||||
LinearAllocGuard<int> flag(LinearAllocs::hipMallocManaged, sizeof(int));
|
||||
LinearAllocGuard<int> 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<int> 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 <BuiltinAtomicOperation operation, int memory_scope> void Test() {
|
||||
LinearAllocGuard<int> counter1(LinearAllocs::hipMallocManaged, sizeof(int));
|
||||
LinearAllocGuard<int> 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<int> flag1(alloc_type, sizeof(int));
|
||||
@@ -443,9 +452,11 @@ template <BuiltinAtomicOperation operation> void SystemTest() {
|
||||
|
||||
LinearAllocGuard<int> counter1(LinearAllocs::hipMallocManaged, sizeof(int));
|
||||
LinearAllocGuard<int> counter2(LinearAllocs::hipMallocManaged, sizeof(int));
|
||||
|
||||
std::vector<StreamGuard> 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);
|
||||
}
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle