@@ -56,7 +56,6 @@ template <class To, class From> To cast(From value) {
56
56
CONSTFIX char clHostMemAllocName[] = " clHostMemAllocINTEL" ;
57
57
CONSTFIX char clDeviceMemAllocName[] = " clDeviceMemAllocINTEL" ;
58
58
CONSTFIX char clSharedMemAllocName[] = " clSharedMemAllocINTEL" ;
59
- CONSTFIX char clMemFreeName[] = " clMemFreeINTEL" ;
60
59
CONSTFIX char clMemBlockingFreeName[] = " clMemBlockingFreeINTEL" ;
61
60
CONSTFIX char clCreateBufferWithPropertiesName[] =
62
61
" clCreateBufferWithPropertiesINTEL" ;
@@ -1017,7 +1016,7 @@ pi_result piextUSMSharedAlloc(void **result_ptr, pi_context context,
1017
1016
return RetVal;
1018
1017
}
1019
1018
1020
- // / Frees allocated USM memory
1019
+ // / Frees allocated USM memory in a blocking manner
1021
1020
// /
1022
1021
// / \param context is the pi_context of the allocation
1023
1022
// / \param ptr is the memory to be freed
@@ -1026,52 +1025,10 @@ pi_result piextUSMFree(pi_context context, void *ptr) {
1026
1025
// might be still running.
1027
1026
clMemBlockingFreeINTEL_fn FuncPtr = nullptr ;
1028
1027
1029
- // We need to use clMemBlockingFreeINTEL here, however, due to a bug in OpenCL
1030
- // CPU runtime this call fails with CL_INVALID_EVENT on CPU devices in certain
1031
- // cases. As a temporary workaround, this function replicates caching of
1032
- // extension function pointers in getExtFuncFromContext, while choosing
1033
- // clMemBlockingFreeINTEL for GPU and clMemFreeINTEL for other device types.
1034
- // TODO remove this workaround when the new OpenCL CPU runtime version is
1035
- // uplifted in CI.
1036
- static_assert (
1037
- std::is_same<clMemBlockingFreeINTEL_fn, clMemFreeINTEL_fn>::value);
1038
- cl_uint deviceCount;
1039
- cl_int ret_err =
1040
- clGetContextInfo (cast<cl_context>(context), CL_CONTEXT_NUM_DEVICES,
1041
- sizeof (cl_uint), &deviceCount, nullptr );
1042
-
1043
- if (ret_err != CL_SUCCESS || deviceCount < 1 ) {
1044
- return PI_ERROR_INVALID_CONTEXT;
1045
- }
1046
-
1047
- std::vector<cl_device_id> devicesInCtx (deviceCount);
1048
- ret_err = clGetContextInfo (cast<cl_context>(context), CL_CONTEXT_DEVICES,
1049
- deviceCount * sizeof (cl_device_id),
1050
- devicesInCtx.data (), nullptr );
1051
-
1052
- if (ret_err != CL_SUCCESS) {
1053
- return PI_ERROR_INVALID_CONTEXT;
1054
- }
1055
-
1056
- bool useBlockingFree = true ;
1057
- for (const cl_device_id &dev : devicesInCtx) {
1058
- cl_device_type devType = CL_DEVICE_TYPE_DEFAULT;
1059
- ret_err = clGetDeviceInfo (dev, CL_DEVICE_TYPE, sizeof (cl_device_type),
1060
- &devType, nullptr );
1061
- if (ret_err != CL_SUCCESS) {
1062
- return PI_ERROR_INVALID_DEVICE;
1063
- }
1064
- useBlockingFree &= devType == CL_DEVICE_TYPE_GPU;
1065
- }
1066
-
1067
1028
pi_result RetVal = PI_ERROR_INVALID_OPERATION;
1068
- if (useBlockingFree)
1069
- RetVal =
1070
- getExtFuncFromContext<clMemBlockingFreeName, clMemBlockingFreeINTEL_fn>(
1071
- context, &FuncPtr);
1072
- else
1073
- RetVal = getExtFuncFromContext<clMemFreeName, clMemFreeINTEL_fn>(context,
1074
- &FuncPtr);
1029
+ RetVal =
1030
+ getExtFuncFromContext<clMemBlockingFreeName, clMemBlockingFreeINTEL_fn>(
1031
+ context, &FuncPtr);
1075
1032
1076
1033
if (FuncPtr) {
1077
1034
RetVal = cast<pi_result>(FuncPtr (cast<cl_context>(context), ptr));
0 commit comments