SWDEV-272089 - Fix concurrent memory test failure on CUDA

Change-Id: Ibf35c789d6bd4279bdcedba1a6e057639c258489
Этот коммит содержится в:
Tao Sang
2021-02-12 17:03:09 -05:00
коммит произвёл Tao Sang
родитель 22164ebc3f
Коммит b889bbd960
2 изменённых файлов: 16 добавлений и 11 удалений
+12 -10
Просмотреть файл
@@ -94,7 +94,7 @@ Testcase Scenarios :
/**
* Validates data consitency on supplied gpu
*/
bool validateMemoryOnGPU(int gpu) {
bool validateMemoryOnGPU(int gpu, bool concurOnOneGPU = false) {
size_t Nbytes = N * sizeof(int);
int *A_d, *B_d, *C_d;
int *A_h, *B_h, *C_h;
@@ -127,9 +127,10 @@ bool validateMemoryOnGPU(int gpu) {
HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false);
HIPCHECK(hipMemGetInfo(&curAvl, &curTot));
if ((prevAvl != curAvl) || (prevTot != curTot)) {
if (!concurOnOneGPU && (prevAvl != curAvl || prevTot != curTot)) {
//In concurrent calls on one GPU, we cannot verify leaking in this way
printf("%s : Memory allocation mismatch observed."
"Possible memory leak.", __func__);
"Possible memory leak.\n", __func__);
TestPassed &= false;
}
@@ -206,10 +207,12 @@ bool regressAllocInLoop(int gpu) {
HIPCHECK(hipMalloc(&ptr, numBytes));
HIPCHECK(hipMemGetInfo(&avail, &tot));
if (pavail-avail != numBytes) {
printf("LoopAllocation : Memory allocation of %6.2fMB"
"not matching with hipMemGetInfo - FAIL\n",
numBytes/(1024.0*1024.0));
if (pavail-avail < numBytes) // We expect pavail-avail >= numBytes
{
printf("LoopAllocation %d : Memory allocation of %6.2fMB "
"not matching with hipMemGetInfo - FAIL\n"
"pavail=%zu, ptot=%zu, avail=%zu, tot=%zu, pavail-avail=%zu \n",
i, numBytes/(1024.0*1024.0), pavail, ptot, avail, tot, pavail-avail);
TestPassed &= false;
HIPCHECK(hipFree(ptr));
break;
@@ -369,8 +372,7 @@ int main(int argc, char* argv[]) {
} else if (!pid) { // Child process
bool TestPassedChild = true;
TestPassedChild = validateMemoryOnGPU(0);
TestPassedChild = validateMemoryOnGPU(0, true);
if (TestPassedChild) {
exit(0); // child exit with success status
@@ -381,7 +383,7 @@ int main(int argc, char* argv[]) {
} else { // Parent process
int exitStatus;
TestPassed = validateMemoryOnGPU(0);
TestPassed = validateMemoryOnGPU(0, true);
pid = wait(&exitStatus);
if ( WEXITSTATUS(exitStatus) || ( pid < 0 ) )
+4 -1
Просмотреть файл
@@ -160,7 +160,7 @@ int main(int argc, char *argv[]) {
hipGetErrorString(ret), ret);
TestPassed &= false;
}
#ifdef __HIP_PLATFORM_AMD__
if ((ret = hipMemset3D(devPitchedPtr, memsetval, extMD))
!= hipErrorInvalidValue) {
printf("ArgValidation : Inappropriate error value returned for "
@@ -176,6 +176,9 @@ int main(int argc, char *argv[]) {
hipGetErrorString(ret), ret);
TestPassed &= false;
}
#else
printf("Cuda doesn't check the maximum depth of extent field\n");
#endif
} else if (p_tests == 4) {
// Device Ptr out bound and extent(0) passed for memset