Skip to content

Commit

Permalink
a few more fixes and one workaround for SVM pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbaug committed Jan 4, 2025
1 parent eca4bf2 commit 03cc91e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions layers/99_svmplusplus/emulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ static bool isUSMPtr(
sizeof(type),
&type,
nullptr);
return type != CL_MEM_TYPE_UNKNOWN_INTEL;
// Workaround: some implementations return zero instead of UNKNOWN for
// non-USM pointers, especially SVM pointers.
return type != 0 && type != CL_MEM_TYPE_UNKNOWN_INTEL;
}

static void parseSVMAllocProperties(
Expand Down Expand Up @@ -515,9 +517,7 @@ void* CL_API_CALL clSVMAllocWithPropertiesKHR_EMU(
}
else if ((caps & CL_SVM_TYPE_MACRO_FINE_GRAIN_BUFFER_KHR) == CL_SVM_TYPE_MACRO_FINE_GRAIN_BUFFER_KHR) {
cl_svm_mem_flags svmFlags = CL_MEM_READ_WRITE | CL_MEM_SVM_FINE_GRAIN_BUFFER;

const auto& typeCapsDevice = layerContext.TypeCapsDevice[device];
if (typeCapsDevice[svm_type_index] & CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_KHR) {
if (caps & CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_KHR) {
svmFlags |= CL_MEM_SVM_ATOMICS;
}
void* ret = g_pNextDispatch->clSVMAlloc(
Expand Down

0 comments on commit 03cc91e

Please sign in to comment.