SWDEV-420149 - Fixing unsafe atomics change for targets other than gfx90a.

Change-Id: Ifa26fd1c51505c5e86e121233c8352e3bde846ea


[ROCm/hip-tests commit: a363fa2833]
이 커밋은 다음에 포함됨:
kjayapra-amd
2023-09-06 05:14:57 -04:00
커밋한 사람 Karthik Jayaprakash
부모 d1028926ef
커밋 feaa0bbe43
6개의 변경된 파일63개의 추가작업 그리고 19개의 파일을 삭제
+7 -3
파일 보기
@@ -88,9 +88,13 @@ TEMPLATE_TEST_CASE("Unit_AtomicAdd_CoherentwithUnsafeflag", "",
"global_atomic_add_f64");
REQUIRE(testResult == true);
}
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(result[0] == 0);
if ((gfxName == "gfx90a" || gfxName.find("gfx90a:")) == 0) {
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(result[0] == 0);
} else {
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
REQUIRE(result[0] == INITIAL_VAL);
}
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipHostFree(result));
}
+14 -4
파일 보기
@@ -80,8 +80,13 @@ TEST_CASE("Unit_BuiltInAtomicAdd_CoherentGlobalMem") {
HIP_CHECK(hipGetLastError());
std::cout << "test 1" << std::endl;
HIP_CHECK(hipDeviceSynchronize());
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*result_h == 0);
if ((gfxName == "gfx90a" || gfxName.find("gfx90a:")) == 0) {
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*result_h == 0);
} else {
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
REQUIRE(*result_h == INITIAL_VAL);
}
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipFree(result));
}
@@ -202,8 +207,13 @@ TEST_CASE("Unit_BuiltInAtomicAdd_CoherentGlobalMemWithRtc") {
nullptr, nullptr, config_d));
HIP_CHECK(hipDeviceSynchronize());
HIP_CHECK(hipMemcpy(B_h, result, sizeof(double), hipMemcpyDeviceToHost));
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*B_h == 0);
if ((gfxName == "gfx90a" || gfxName.find("gfx90a:")) == 0) {
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*B_h == 0);
} else {
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
REQUIRE(*B_h == INITIAL_VAL);
}
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipFree(result));
free(B_h);
@@ -89,8 +89,13 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_CoherentwithnoUnsafeflag", "",
REQUIRE(testResult == true);
}
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(result[0] == 0);
if ((gfxName == "gfx90a" || gfxName.find("gfx90a:")) == 0) {
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(result[0] == 0);
} else {
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
REQUIRE(result[0] == INITIAL_VAL);
}
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipHostFree(result));
}
+7 -2
파일 보기
@@ -89,8 +89,13 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_Coherentwithoutflag", "",
REQUIRE(testResult == true);
}
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(result[0] == 0);
if ((gfxName == "gfx90a" || gfxName.find("gfx90a:")) == 0) {
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(result[0] == 0);
} else {
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
REQUIRE(result[0] == INITIAL_VAL);
}
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipHostFree(result));
}
@@ -90,8 +90,13 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_CoherentwithUnsafeflag", "",
REQUIRE(testResult == true);
}
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(result[0] == 0);
if ((gfxName == "gfx90a" || gfxName.find("gfx90a:")) == 0) {
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(result[0] == 0);
} else {
REQUIRE(A_h[0] == INITIAL_VAL + INC_VAL);
REQUIRE(result[0] == INITIAL_VAL);
}
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipHostFree(result));
}
+21 -6
파일 보기
@@ -129,8 +129,13 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_CoherentRTCnounsafeatomicflag", "",
HIP_CHECK(hipModuleLaunchKernel(f_kernel, 1, 1, 1, 1, 1, 1, 0,
nullptr, nullptr, config_d));
HIP_CHECK(hipDeviceSynchronize());
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*result == 0);
if ((gfxName == "gfx90a" || gfxName.find("gfx90a:")) == 0) {
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*result == 0);
} else {
REQUIRE(A_h[0] == INITIAL_VAL + INCREMENT_VAL);
REQUIRE(*result == INITIAL_VAL);
}
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipHostFree(result));
}
@@ -221,8 +226,13 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_CoherentRTCunsafeatomicflag", "",
HIP_CHECK(hipModuleLaunchKernel(f_kernel, 1, 1, 1, 1, 1, 1, 0,
nullptr, nullptr, config_d));
HIP_CHECK(hipDeviceSynchronize());
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*result == 0);
if ((gfxName == "gfx90a" || gfxName.find("gfx90a:")) == 0) {
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*result == 0);
} else {
REQUIRE(A_h[0] == INITIAL_VAL + INCREMENT_VAL);
REQUIRE(*result == INITIAL_VAL);
}
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipHostFree(result));
}
@@ -309,8 +319,13 @@ TEMPLATE_TEST_CASE("Unit_unsafeAtomicAdd_CoherentRTCwithoutflag", "",
HIP_CHECK(hipModuleLaunchKernel(f_kernel, 1, 1, 1, 1, 1,
1, 0, nullptr, nullptr, config_d));
HIP_CHECK(hipDeviceSynchronize());
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*result == 0);
if ((gfxName == "gfx90a" || gfxName.find("gfx90a:")) == 0) {
REQUIRE(A_h[0] == INITIAL_VAL);
REQUIRE(*result == 0);
} else {
REQUIRE(A_h[0] == INITIAL_VAL + INCREMENT_VAL);
REQUIRE(*result == INITIAL_VAL);
}
HIP_CHECK(hipHostFree(A_h));
HIP_CHECK(hipHostFree(result));
}