Skip to content

Commit 03cc91e

Browse files
committed
a few more fixes and one workaround for SVM pointers
1 parent eca4bf2 commit 03cc91e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

layers/99_svmplusplus/emulate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ static bool isUSMPtr(
422422
sizeof(type),
423423
&type,
424424
nullptr);
425-
return type != CL_MEM_TYPE_UNKNOWN_INTEL;
425+
// Workaround: some implementations return zero instead of UNKNOWN for
426+
// non-USM pointers, especially SVM pointers.
427+
return type != 0 && type != CL_MEM_TYPE_UNKNOWN_INTEL;
426428
}
427429

428430
static void parseSVMAllocProperties(
@@ -515,9 +517,7 @@ void* CL_API_CALL clSVMAllocWithPropertiesKHR_EMU(
515517
}
516518
else if ((caps & CL_SVM_TYPE_MACRO_FINE_GRAIN_BUFFER_KHR) == CL_SVM_TYPE_MACRO_FINE_GRAIN_BUFFER_KHR) {
517519
cl_svm_mem_flags svmFlags = CL_MEM_READ_WRITE | CL_MEM_SVM_FINE_GRAIN_BUFFER;
518-
519-
const auto& typeCapsDevice = layerContext.TypeCapsDevice[device];
520-
if (typeCapsDevice[svm_type_index] & CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_KHR) {
520+
if (caps & CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_KHR) {
521521
svmFlags |= CL_MEM_SVM_ATOMICS;
522522
}
523523
void* ret = g_pNextDispatch->clSVMAlloc(

0 commit comments

Comments
 (0)