[hip]Skip test when hipHostMallocCoherent is not supported by implementation (#1380)

Этот коммит содержится в:
AlexBinXie
2019-09-16 04:31:43 -04:00
коммит произвёл Maneesh Gupta
родитель e2a934f377
Коммит 313726a457
2 изменённых файлов: 23 добавлений и 10 удалений
+11 -2
Просмотреть файл
@@ -71,12 +71,21 @@ int main() {
}
volatile int* data;
HIP_ASSERT(hipHostMalloc(&data, sizeof(int), hipHostMallocCoherent));
if (hipHostMalloc(&data, sizeof(int), hipHostMallocCoherent) != hipSuccess) {
warn("Memory allocation failed. Skip test. Is SVM atomic supported?")
passed();
return 0;
}
constexpr int init_data = 1000;
*data = init_data;
volatile int* flag;
HIP_ASSERT(hipHostMalloc(&flag, sizeof(int), hipHostMallocCoherent));
if (hipHostMalloc(&flag, sizeof(int), hipHostMallocCoherent) != hipSuccess) {
warn("Memory allocation failed. Skip test. Is SVM atomic supported?")
passed();
return 0;
}
*flag = 0;
// number of rounds per device
+12 -8
Просмотреть файл
@@ -176,15 +176,19 @@ int main() {
if (1) {
int* A = nullptr;
HIPCHECK(hipHostMalloc((void**)&A, sizeBytes, hipHostMallocCoherent));
const char* ptrType = "coherent";
CheckHostPointer(numElements, A, hipEventReleaseToDevice, SYNC_DEVICE, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToDevice, SYNC_STREAM, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToDevice, SYNC_EVENT, ptrType);
if (hipHostMalloc((void**)&A, sizeBytes, hipHostMallocCoherent) == hipSuccess) {
const char* ptrType = "coherent";
CheckHostPointer(numElements, A, hipEventReleaseToDevice, SYNC_DEVICE, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToDevice, SYNC_STREAM, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToDevice, SYNC_EVENT, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToSystem, SYNC_DEVICE, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToSystem, SYNC_STREAM, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToSystem, SYNC_EVENT, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToSystem, SYNC_DEVICE, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToSystem, SYNC_STREAM, ptrType);
CheckHostPointer(numElements, A, hipEventReleaseToSystem, SYNC_EVENT, ptrType);
}
else {
warn("Coherence memory allocation failed. Is SVM atomic supported?")
}
}