diff --git a/include/CL/opencl.hpp b/include/CL/opencl.hpp index afb2bce..2f5949c 100644 --- a/include/CL/opencl.hpp +++ b/include/CL/opencl.hpp @@ -1554,12 +1554,14 @@ inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_ F(cl_device_info, CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL, cl_device_unified_shared_memory_capabilities_intel ) #define CL_HPP_PARAM_NAME_CL_EXP_UNIFIED_SVM_(F) \ - F(cl_device_info, CL_DEVICE_UNIFIED_SVM_TYPES_EXP, cl::vector) \ + F(cl_device_info, CL_DEVICE_SVM_TYPE_CAPABILITIES_EXP, cl::vector) \ \ - F(cl_svm_mem_info_exp, CL_SVM_MEM_INFO_TYPE_EXP, cl_svm_mem_type_exp) \ - F(cl_svm_mem_info_exp, CL_SVM_MEM_INFO_BASE_PTR_EXP, void*) \ - F(cl_svm_mem_info_exp, CL_SVM_MEM_INFO_SIZE_EXP, size_type) \ - F(cl_svm_mem_info_exp, CL_SVM_MEM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP, cl::Device) + F(cl_svm_mem_info_exp, CL_SVM_INFO_TYPE_EXP, cl_svm_type_exp) \ + F(cl_svm_mem_info_exp, CL_SVM_INFO_PROPERTIES_EXP, cl::vector) \ + F(cl_svm_mem_info_exp, CL_SVM_INFO_FLAGS_EXP, cl_mem_flags) \ + F(cl_svm_mem_info_exp, CL_SVM_INFO_BASE_PTR_EXP, void*) \ + F(cl_svm_mem_info_exp, CL_SVM_INFO_SIZE_EXP, size_type) \ + F(cl_svm_mem_info_exp, CL_SVM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP, cl::Device) template struct param_traits {}; @@ -1831,6 +1833,7 @@ CL_HPP_PARAM_NAME_CL_INTEL_UNIFIED_SHARED_MEMORY_(CL_HPP_DECLARE_PARAM_TRAITS_) #if defined(cl_exp_unified_svm) CL_HPP_PARAM_NAME_CL_EXP_UNIFIED_SVM_(CL_HPP_DECLARE_PARAM_TRAITS_) #endif + // Convenience functions template diff --git a/layers/99_svmplusplus/emulate.cpp b/layers/99_svmplusplus/emulate.cpp index 3ab3dfd..8f0f9b0 100644 --- a/layers/99_svmplusplus/emulate.cpp +++ b/layers/99_svmplusplus/emulate.cpp @@ -57,11 +57,11 @@ static cl_context getContext( return context; } -static cl_svm_mem_type_exp getSVMMemType( +static cl_svm_type_exp getSVMMemType( cl_context context, const void* ptr) { - cl_svm_mem_type_exp type = CL_SVM_MEM_TYPE_UNKNOWN_EXP; + cl_unified_shared_memory_type_intel type = CL_MEM_TYPE_UNKNOWN_INTEL; clGetMemAllocInfoINTEL( context, ptr, @@ -69,17 +69,23 @@ static cl_svm_mem_type_exp getSVMMemType( sizeof(type), &type, nullptr); - return type; + switch (type) { + case CL_MEM_TYPE_DEVICE_INTEL: return CL_SVM_TYPE_DEVICE_ALLOC_EXP; + case CL_MEM_TYPE_HOST_INTEL: return CL_SVM_TYPE_HOST_ALLOC_EXP; + case CL_MEM_TYPE_SHARED_INTEL: return CL_SVM_TYPE_SHARED_ALLOC_EXP; + default: break; + } + return 0; } static bool isUSMPtr( cl_context context, const void* ptr) { - cl_svm_mem_type_exp type = getSVMMemType(context, ptr); - return type == CL_SVM_MEM_TYPE_HOST_EXP || - type == CL_SVM_MEM_TYPE_DEVICE_EXP || - type == CL_SVM_MEM_TYPE_SHARED_EXP; + cl_svm_type_exp type = getSVMMemType(context, ptr); + return type == CL_SVM_TYPE_DEVICE_ALLOC_EXP || + type == CL_SVM_TYPE_HOST_ALLOC_EXP || + type == CL_SVM_TYPE_SHARED_ALLOC_EXP; } static cl_device_id getAssociatedDeviceFromProperties( @@ -104,9 +110,9 @@ static cl_device_id getAssociatedDeviceFromProperties( return nullptr; } -static std::vector getUSVMTypes(cl_device_id device) +static std::vector getSVMTypeCaps(cl_device_id device) { - std::vector types; + std::vector types; // USM Types @@ -119,22 +125,22 @@ static std::vector getUSVMTypes(cl_device_id dev nullptr); if (usmCaps != 0) { types.emplace_back(); - cl_device_unified_svm_type_exp& type = types.back(); + cl_device_svm_type_capabilities_exp& type = types.back(); - type.mem_flags = CL_MEM_SVM_DEVICE_EXP; + type.type = CL_SVM_TYPE_DEVICE_ALLOC_EXP; type.capabilities = - CL_UNIFIED_SVM_SINGLE_ADDRESS_SPACE_EXP | - CL_UNIFIED_SVM_DEVICE_OWNED_EXP | - CL_UNIFIED_SVM_DEVICE_ACCESS_EXP | - CL_UNIFIED_SVM_INDIRECT_ACCESS_EXP; + CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_EXP | + CL_SVM_CAPABILITY_DEVICE_OWNED_EXP | + CL_SVM_CAPABILITY_DEVICE_ACCESS_EXP | + CL_SVM_CAPABILITY_INDIRECT_ACCESS_EXP; if (usmCaps & CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL) { - type.capabilities |= CL_UNIFIED_SVM_DEVICE_ATOMIC_ACCESS_EXP; + type.capabilities |= CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_EXP; } if (usmCaps & CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL) { - type.capabilities |= CL_UNIFIED_SVM_CONCURRENT_ACCESS_EXP; + type.capabilities |= CL_SVM_CAPABILITY_CONCURRENT_ACCESS_EXP; } if (usmCaps & CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL) { - type.capabilities |= CL_UNIFIED_SVM_CONCURRENT_ATOMIC_ACCESS_EXP; + type.capabilities |= CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_EXP; } } @@ -147,23 +153,23 @@ static std::vector getUSVMTypes(cl_device_id dev nullptr); if (usmCaps != 0) { types.emplace_back(); - cl_device_unified_svm_type_exp& type = types.back(); + cl_device_svm_type_capabilities_exp& type = types.back(); - type.mem_flags = CL_MEM_SVM_HOST_EXP; + type.type = CL_SVM_TYPE_HOST_ALLOC_EXP; type.capabilities = - CL_UNIFIED_SVM_SINGLE_ADDRESS_SPACE_EXP | - CL_UNIFIED_SVM_HOST_OWNED_EXP | - CL_UNIFIED_SVM_HOST_ACCESSIBLE_EXP | - CL_UNIFIED_SVM_DEVICE_ACCESS_EXP | - CL_UNIFIED_SVM_INDIRECT_ACCESS_EXP; + CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_EXP | + CL_SVM_CAPABILITY_HOST_OWNED_EXP | + CL_SVM_CAPABILITY_HOST_ACCESSIBLE_EXP | + CL_SVM_CAPABILITY_DEVICE_ACCESS_EXP | + CL_SVM_CAPABILITY_INDIRECT_ACCESS_EXP; if (usmCaps & CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL) { - type.capabilities |= CL_UNIFIED_SVM_DEVICE_ATOMIC_ACCESS_EXP; + type.capabilities |= CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_EXP; } if (usmCaps & CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL) { - type.capabilities |= CL_UNIFIED_SVM_CONCURRENT_ACCESS_EXP; + type.capabilities |= CL_SVM_CAPABILITY_CONCURRENT_ACCESS_EXP; } if (usmCaps & CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL) { - type.capabilities |= CL_UNIFIED_SVM_CONCURRENT_ATOMIC_ACCESS_EXP; + type.capabilities |= CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_EXP; } } @@ -176,22 +182,22 @@ static std::vector getUSVMTypes(cl_device_id dev nullptr); if (usmCaps != 0) { types.emplace_back(); - cl_device_unified_svm_type_exp& type = types.back(); + cl_device_svm_type_capabilities_exp& type = types.back(); - type.mem_flags = CL_MEM_SVM_SHARED_EXP; + type.type = CL_SVM_TYPE_SHARED_ALLOC_EXP; type.capabilities = - CL_UNIFIED_SVM_SINGLE_ADDRESS_SPACE_EXP | - CL_UNIFIED_SVM_HOST_ACCESSIBLE_EXP | - CL_UNIFIED_SVM_DEVICE_ACCESS_EXP | - CL_UNIFIED_SVM_INDIRECT_ACCESS_EXP; + CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_EXP | + CL_SVM_CAPABILITY_HOST_ACCESSIBLE_EXP | + CL_SVM_CAPABILITY_DEVICE_ACCESS_EXP | + CL_SVM_CAPABILITY_INDIRECT_ACCESS_EXP; if (usmCaps & CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL) { - type.capabilities |= CL_UNIFIED_SVM_DEVICE_ATOMIC_ACCESS_EXP; + type.capabilities |= CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_EXP; } if (usmCaps & CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL) { - type.capabilities |= CL_UNIFIED_SVM_CONCURRENT_ACCESS_EXP; + type.capabilities |= CL_SVM_CAPABILITY_CONCURRENT_ACCESS_EXP; } if (usmCaps & CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL) { - type.capabilities |= CL_UNIFIED_SVM_CONCURRENT_ATOMIC_ACCESS_EXP; + type.capabilities |= CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_EXP; } } @@ -214,60 +220,59 @@ static std::vector getUSVMTypes(cl_device_id dev nullptr); if (svmCaps & CL_DEVICE_SVM_COARSE_GRAIN_BUFFER) { types.emplace_back(); - cl_device_unified_svm_type_exp& type = types.back(); + cl_device_svm_type_capabilities_exp& type = types.back(); - // Note: no flags are needed to allocate coarse-grain SVM! - type.mem_flags = 0; + type.type = CL_SVM_TYPE_COARSE_GRAIN_BUFFER_EXP; type.capabilities = - CL_UNIFIED_SVM_SINGLE_ADDRESS_SPACE_EXP | - CL_UNIFIED_SVM_HOST_ACCESSIBLE_WITH_MAP_EXP | - CL_UNIFIED_SVM_DEVICE_ACCESS_EXP | - CL_UNIFIED_SVM_DEVICE_ATOMIC_ACCESS_EXP; + CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_EXP | + CL_SVM_CAPABILITY_HOST_ACCESSIBLE_WITH_MAP_EXP | + CL_SVM_CAPABILITY_DEVICE_ACCESS_EXP | + CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_EXP; } if (svmCaps & CL_DEVICE_SVM_FINE_GRAIN_BUFFER) { types.emplace_back(); - cl_device_unified_svm_type_exp& type = types.back(); + cl_device_svm_type_capabilities_exp& type = types.back(); - type.mem_flags = CL_MEM_SVM_FINE_GRAIN_BUFFER; + type.type = CL_SVM_TYPE_FINE_GRAIN_BUFFER_EXP; type.capabilities = - CL_UNIFIED_SVM_SINGLE_ADDRESS_SPACE_EXP | - CL_UNIFIED_SVM_HOST_ACCESSIBLE_EXP | - CL_UNIFIED_SVM_HOST_ACCESSIBLE_WITH_MAP_EXP | - CL_UNIFIED_SVM_DEVICE_ACCESS_EXP | - CL_UNIFIED_SVM_DEVICE_ATOMIC_ACCESS_EXP | - CL_UNIFIED_SVM_CONCURRENT_ACCESS_EXP; + CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_EXP | + CL_SVM_CAPABILITY_HOST_ACCESSIBLE_EXP | + CL_SVM_CAPABILITY_HOST_ACCESSIBLE_WITH_MAP_EXP | + CL_SVM_CAPABILITY_DEVICE_ACCESS_EXP | + CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_EXP | + CL_SVM_CAPABILITY_CONCURRENT_ACCESS_EXP; } if (svmCaps & (CL_DEVICE_SVM_FINE_GRAIN_BUFFER | CL_DEVICE_SVM_ATOMICS)) { types.emplace_back(); - cl_device_unified_svm_type_exp& type = types.back(); + cl_device_svm_type_capabilities_exp& type = types.back(); - type.mem_flags = CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_SVM_ATOMICS; + type.type = CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_SVM_ATOMICS; type.capabilities = - CL_UNIFIED_SVM_SINGLE_ADDRESS_SPACE_EXP | - CL_UNIFIED_SVM_HOST_ACCESSIBLE_EXP | - CL_UNIFIED_SVM_HOST_ACCESSIBLE_WITH_MAP_EXP | - CL_UNIFIED_SVM_DEVICE_ACCESS_EXP | - CL_UNIFIED_SVM_DEVICE_ATOMIC_ACCESS_EXP | - CL_UNIFIED_SVM_CONCURRENT_ACCESS_EXP | - CL_UNIFIED_SVM_CONCURRENT_ATOMIC_ACCESS_EXP; + CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_EXP | + CL_SVM_CAPABILITY_HOST_ACCESSIBLE_EXP | + CL_SVM_CAPABILITY_HOST_ACCESSIBLE_WITH_MAP_EXP | + CL_SVM_CAPABILITY_DEVICE_ACCESS_EXP | + CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_EXP | + CL_SVM_CAPABILITY_CONCURRENT_ACCESS_EXP | + CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_EXP; } if (svmCaps & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM || usmCaps != 0) { types.emplace_back(); - cl_device_unified_svm_type_exp& type = types.back(); + cl_device_svm_type_capabilities_exp& type = types.back(); // Note: no flags are needed for the system allocator. - type.mem_flags = 0; + type.type = CL_SVM_TYPE_FINE_GRAIN_SYSTEM_EXP; type.capabilities = - CL_UNIFIED_SVM_SINGLE_ADDRESS_SPACE_EXP | - CL_UNIFIED_SVM_SYSTEM_ALLOCATOR_EXP | - CL_UNIFIED_SVM_HOST_ACCESSIBLE_EXP | - CL_UNIFIED_SVM_HOST_ACCESSIBLE_WITH_MAP_EXP | - CL_UNIFIED_SVM_DEVICE_ACCESS_EXP | - CL_UNIFIED_SVM_DEVICE_ATOMIC_ACCESS_EXP | - CL_UNIFIED_SVM_CONCURRENT_ACCESS_EXP | - CL_UNIFIED_SVM_CONCURRENT_ATOMIC_ACCESS_EXP | - CL_UNIFIED_SVM_INDIRECT_ACCESS_EXP; + CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_EXP | + CL_SVM_CAPABILITY_SYSTEM_ALLOCATOR_EXP | + CL_SVM_CAPABILITY_HOST_ACCESSIBLE_EXP | + CL_SVM_CAPABILITY_HOST_ACCESSIBLE_WITH_MAP_EXP | + CL_SVM_CAPABILITY_DEVICE_ACCESS_EXP | + CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_EXP | + CL_SVM_CAPABILITY_CONCURRENT_ACCESS_EXP | + CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_EXP | + CL_SVM_CAPABILITY_INDIRECT_ACCESS_EXP; } return types; @@ -276,14 +281,16 @@ static std::vector getUSVMTypes(cl_device_id dev void* CL_API_CALL clSVMAllocWithPropertiesEXP_EMU( cl_context context, const cl_svm_alloc_properties_exp* properties, - cl_svm_mem_flags flags, + cl_svm_type_exp type, + cl_mem_flags flags, size_t size, cl_uint alignment, cl_int* errcode_ret) { cl_device_id device = getAssociatedDeviceFromProperties(properties); - if (flags & CL_MEM_SVM_DEVICE_EXP) { + if (type & CL_SVM_TYPE_DEVICE_ALLOC_EXP) { + // note: currently ignores flags! return clDeviceMemAllocINTEL( context, device, @@ -292,7 +299,8 @@ void* CL_API_CALL clSVMAllocWithPropertiesEXP_EMU( alignment, errcode_ret); } - if (flags & CL_MEM_SVM_HOST_EXP) { + if (type & CL_SVM_TYPE_HOST_ALLOC_EXP) { + // note: currently ignores flags! return clHostMemAllocINTEL( context, nullptr, @@ -300,7 +308,8 @@ void* CL_API_CALL clSVMAllocWithPropertiesEXP_EMU( alignment, errcode_ret); } - if (flags & CL_MEM_SVM_SHARED_EXP) { + if (type & CL_SVM_TYPE_SHARED_ALLOC_EXP) { + // note: currently ignores flags! return clSharedMemAllocINTEL( context, device, @@ -309,12 +318,29 @@ void* CL_API_CALL clSVMAllocWithPropertiesEXP_EMU( alignment, errcode_ret); } + if (type & CL_SVM_TYPE_COARSE_GRAIN_BUFFER_EXP) { + return g_pNextDispatch->clSVMAlloc( + context, + flags, + size, + alignment); + } + if (type & CL_SVM_TYPE_FINE_GRAIN_BUFFER_EXP) { + cl_svm_mem_flags svmFlags = flags | CL_MEM_SVM_FINE_GRAIN_BUFFER; + if (type & CL_SVM_TYPE_ATOMICS_EXP) { + svmFlags |= CL_MEM_SVM_ATOMICS; + } + return g_pNextDispatch->clSVMAlloc( + context, + svmFlags, + size, + alignment); + } - return g_pNextDispatch->clSVMAlloc( - context, - flags, - size, - alignment); + if (errcode_ret) { + errcode_ret[0] = CL_INVALID_VALUE; + } + return nullptr; } cl_int CL_API_CALL clSVMFreeWithPropertiesEXP_EMU( @@ -341,14 +367,23 @@ cl_int CL_API_CALL clSVMFreeWithPropertiesEXP_EMU( return CL_SUCCESS; } -cl_int CL_API_CALL clGetSVMMemInfoEXP_EMU( +cl_int CL_API_CALL clGetSVMInfoEXP_EMU( cl_context context, const void* ptr, - cl_svm_mem_info_exp param_name, + cl_svm_info_exp param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { + if (param_name == CL_SVM_INFO_TYPE_EXP) { + cl_svm_type_exp type = getSVMMemType(context, ptr); + auto tp = (cl_svm_type_exp*)param_value; + return writeParamToMemory( + param_value_size, + type, + param_value_size_ret, + tp); + } if (isUSMPtr(context, ptr)) { return clGetMemAllocInfoINTEL( context, @@ -441,6 +476,7 @@ cl_int CL_API_CALL clGetDeviceInfo_override( CL_EXP_UNIFIED_SVM_EXTENSION_NAME ) == false ) { std::string newExtensions; + newExtensions += CL_EXP_UNIFIED_SVM_EXTENSION_NAME; std::string oldExtensions(deviceExtensions.data()); @@ -516,13 +552,13 @@ cl_int CL_API_CALL clGetDeviceInfo_override( } } break; - case CL_DEVICE_UNIFIED_SVM_TYPES_EXP: + case CL_DEVICE_SVM_TYPE_CAPABILITIES_EXP: { - auto svmTypes = getUSVMTypes(device); - auto ptr = (cl_device_unified_svm_type_exp*)param_value; + auto svmTypeCaps = getSVMTypeCaps(device); + auto ptr = (cl_device_svm_type_capabilities_exp*)param_value; return writeVectorToMemory( param_value_size, - svmTypes, + svmTypeCaps, param_value_size_ret, ptr); } @@ -676,6 +712,62 @@ cl_int CL_API_CALL clSetKernelArgSVMPointer_override( arg_value); } +cl_int CL_API_CALL clSetKernelExecInfo_override( + cl_kernel kernel, + cl_kernel_exec_info param_name, + size_t param_value_size, + const void* param_value) +{ + switch (param_name) { + case CL_KERNEL_EXEC_INFO_SVM_INDIRECT_ACCESS_ENABLE_EXP: + case CL_KERNEL_EXEC_INFO_SVM_INDIRECT_ACCESS_DISABLE_EXP: + if (param_value_size == sizeof(cl_svm_type_exp)) { + cl_bool enable = + param_name == CL_KERNEL_EXEC_INFO_SVM_INDIRECT_ACCESS_ENABLE_EXP ? + CL_TRUE : + CL_FALSE; + cl_int error = CL_SUCCESS; + auto types = *(cl_svm_type_exp*)param_value; + if (types & (CL_SVM_TYPE_COARSE_GRAIN_BUFFER_EXP | CL_SVM_TYPE_FINE_GRAIN_BUFFER_EXP)) { + assert(0 && "indirect access for coarse-grain and fine-grain SVM is currently unsupported"); + } + if (types & CL_SVM_TYPE_DEVICE_ALLOC_EXP) { + error |= g_pNextDispatch->clSetKernelExecInfo( + kernel, + CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL, + sizeof(enable), + &enable); + } + if (types & CL_SVM_TYPE_HOST_ALLOC_EXP) { + error |= g_pNextDispatch->clSetKernelExecInfo( + kernel, + CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL, + sizeof(enable), + &enable); + } + if (types & CL_SVM_TYPE_SHARED_ALLOC_EXP) { + error |= g_pNextDispatch->clSetKernelExecInfo( + kernel, + CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL, + sizeof(enable), + &enable); + } + return error; + } + else { + return CL_INVALID_VALUE; + } + break; + default: break; + } + + return g_pNextDispatch->clSetKernelExecInfo( + kernel, + param_name, + param_value_size, + param_value); +} + void CL_API_CALL clSVMFree_override( cl_context context, void* ptr) @@ -691,7 +783,7 @@ cl_int CL_API_CALL clEnqueueSVMMemAdviseEXP_EMU( cl_command_queue command_queue, const void* ptr, size_t size, - cl_svm_mem_advice_exp advice, + cl_svm_advice_exp advice, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) diff --git a/layers/99_svmplusplus/emulate.h b/layers/99_svmplusplus/emulate.h index c55cccf..4a1759f 100644 --- a/layers/99_svmplusplus/emulate.h +++ b/layers/99_svmplusplus/emulate.h @@ -12,7 +12,8 @@ extern const struct _cl_icd_dispatch* g_pNextDispatch; void* CL_API_CALL clSVMAllocWithPropertiesEXP_EMU( cl_context context, const cl_svm_alloc_properties_exp* properties, - cl_svm_mem_flags flags, + cl_svm_type_exp type, + cl_mem_flags flags, size_t size, cl_uint alignment, cl_int* errcode_ret); @@ -23,10 +24,10 @@ cl_int CL_API_CALL clSVMFreeWithPropertiesEXP_EMU( cl_svm_free_flags_exp flags, void* ptr); -cl_int CL_API_CALL clGetSVMMemInfoEXP_EMU( +cl_int CL_API_CALL clGetSVMInfoEXP_EMU( cl_context context, const void* ptr, - cl_svm_mem_info_exp param_name, + cl_svm_info_exp param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret); @@ -50,6 +51,12 @@ cl_int CL_API_CALL clSetKernelArgSVMPointer_override( cl_uint arg_index, const void* arg_value); +cl_int CL_API_CALL clSetKernelExecInfo_override( + cl_kernel kernel, + cl_kernel_exec_info param_name, + size_t param_value_size, + const void* param_value); + void CL_API_CALL clSVMFree_override( cl_context context, void* ptr); @@ -58,7 +65,7 @@ cl_int CL_API_CALL clEnqueueSVMMemAdviseEXP_EMU( cl_command_queue command_queue, const void* ptr, size_t size, - cl_svm_mem_advice_exp advice, + cl_svm_advice_exp advice, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); diff --git a/layers/99_svmplusplus/main.cpp b/layers/99_svmplusplus/main.cpp index 20e2673..6814995 100644 --- a/layers/99_svmplusplus/main.cpp +++ b/layers/99_svmplusplus/main.cpp @@ -41,7 +41,7 @@ clGetExtensionFunctionAddressForPlatform_override( { CHECK_RETURN_EXTENSION_FUNCTION( clSVMAllocWithPropertiesEXP ); CHECK_RETURN_EXTENSION_FUNCTION( clSVMFreeWithPropertiesEXP ); - CHECK_RETURN_EXTENSION_FUNCTION( clGetSVMMemInfoEXP ); + CHECK_RETURN_EXTENSION_FUNCTION( clGetSVMInfoEXP ); CHECK_RETURN_EXTENSION_FUNCTION( clEnqueueSVMMemAdviseEXP ); return g_pNextDispatch->clGetExtensionFunctionAddressForPlatform( @@ -56,6 +56,7 @@ static void _init_dispatch() dispatch.clGetExtensionFunctionAddressForPlatform = clGetExtensionFunctionAddressForPlatform_override; dispatch.clGetPlatformInfo = clGetPlatformInfo_override; dispatch.clSetKernelArgSVMPointer = clSetKernelArgSVMPointer_override; + dispatch.clSetKernelExecInfo = clSetKernelExecInfo_override; dispatch.clSVMFree = clSVMFree_override; dispatch.clEnqueueSVMMemcpy = clEnqueueSVMMemcpy_override; dispatch.clEnqueueSVMMemFill = clEnqueueSVMMemFill_override; diff --git a/samples/usvm/00_usvmqueries/main.cpp b/samples/usvm/00_usvmqueries/main.cpp index 3d58703..38f13cc 100644 --- a/samples/usvm/00_usvmqueries/main.cpp +++ b/samples/usvm/00_usvmqueries/main.cpp @@ -25,38 +25,40 @@ void PrintDeviceSVMCaps( void PrintSVMMemFlags( const char* label, - cl_svm_mem_flags flags) + cl_svm_type_exp type) { - if (flags == 0) { + if (type == 0) { printf("\t\t%s: (none)\n", label); } else { - printf("\t\t%s: %s%s%s%s%s\n", + printf("\t\t%s: %s%s%s%s%s%s%s\n", label, - (flags & CL_MEM_SVM_FINE_GRAIN_BUFFER) ? "\n\t\t\tCL_MEM_SVM_FINE_GRAIN_BUFFER" : "", - (flags & CL_MEM_SVM_ATOMICS ) ? "\n\t\t\tCL_MEM_SVM_ATOMICS" : "", - (flags & CL_MEM_SVM_DEVICE_EXP ) ? "\n\t\t\tCL_MEM_SVM_DEVICE_EXP" : "", - (flags & CL_MEM_SVM_HOST_EXP ) ? "\n\t\t\tCL_MEM_SVM_HOST_EXP" : "", - (flags & CL_MEM_SVM_SHARED_EXP ) ? "\n\t\t\tCL_MEM_SVM_SHARED_EXP" : ""); + (type & CL_SVM_TYPE_COARSE_GRAIN_BUFFER_EXP ) ? "\n\t\t\tCL_SVM_TYPE_COARSE_GRAIN_BUFFER_EXP" : "", + (type & CL_SVM_TYPE_FINE_GRAIN_BUFFER_EXP ) ? "\n\t\t\tCL_SVM_TYPE_FINE_GRAIN_BUFFER_EXP" : "", + (type & CL_SVM_TYPE_FINE_GRAIN_SYSTEM_EXP ) ? "\n\t\t\tCL_SVM_TYPE_FINE_GRAIN_SYSTEM_EXP" : "", + (type & CL_SVM_TYPE_ATOMICS_EXP ) ? "\n\t\t\tCL_SVM_TYPE_ATOMICS_EXP" : "", + (type & CL_SVM_TYPE_DEVICE_ALLOC_EXP ) ? "\n\t\t\tCL_SVM_TYPE_DEVICE_ALLOC_EXP" : "", + (type & CL_SVM_TYPE_HOST_ALLOC_EXP ) ? "\n\t\t\tCL_SVM_TYPE_HOST_ALLOC_EXP" : "", + (type & CL_SVM_TYPE_SHARED_ALLOC_EXP ) ? "\n\t\t\tCL_SVM_TYPE_SHARED_ALLOC_EXP" : ""); } } void PrintUSVMCaps( const char* label, - cl_device_unified_svm_capabilities_exp usvmcaps ) + cl_svm_type_capabilities_exp svmcaps ) { printf("\t\t%s: %s%s%s%s%s%s%s%s%s%s%s\n", label, - ( usvmcaps & CL_UNIFIED_SVM_SINGLE_ADDRESS_SPACE_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_SINGLE_ADDRESS_SPACE_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_SYSTEM_ALLOCATOR_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_SYSTEM_ALLOCATOR_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_DEVICE_OWNED_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_DEVICE_OWNED_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_HOST_OWNED_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_HOST_OWNED_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_HOST_ACCESSIBLE_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_HOST_ACCESSIBLE_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_HOST_ACCESSIBLE_WITH_MAP_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_HOST_ACCESSIBLE_WITH_MAP_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_DEVICE_ACCESS_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_DEVICE_ACCESS_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_DEVICE_ATOMIC_ACCESS_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_DEVICE_ATOMIC_ACCESS_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_CONCURRENT_ACCESS_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_CONCURRENT_ACCESS_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_CONCURRENT_ATOMIC_ACCESS_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_CONCURRENT_ATOMIC_ACCESS_EXP" : "", - ( usvmcaps & CL_UNIFIED_SVM_INDIRECT_ACCESS_EXP ) ? "\n\t\t\tCL_UNIFIED_SVM_INDIRECT_ACCESS_EXP" : "" ); + ( svmcaps & CL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_SINGLE_ADDRESS_SPACE_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_SYSTEM_ALLOCATOR_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_SYSTEM_ALLOCATOR_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_DEVICE_OWNED_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_DEVICE_OWNED_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_HOST_OWNED_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_HOST_OWNED_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_HOST_ACCESSIBLE_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_HOST_ACCESSIBLE_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_HOST_ACCESSIBLE_WITH_MAP_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_HOST_ACCESSIBLE_WITH_MAP_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_DEVICE_ACCESS_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_DEVICE_ACCESS_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_DEVICE_ATOMIC_ACCESS_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_CONCURRENT_ACCESS_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_CONCURRENT_ACCESS_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_CONCURRENT_ATOMIC_ACCESS_EXP" : "", + ( svmcaps & CL_SVM_CAPABILITY_INDIRECT_ACCESS_EXP ) ? "\n\t\t\tCL_SVM_CAPABILITY_INDIRECT_ACCESS_EXP" : "" ); } @@ -110,13 +112,13 @@ int main( nullptr ); PrintDeviceSVMCaps( "CL_DEVICE_SVM_CAPABILITIES", svmcaps ); - std::vector usmTypes = - devices[d].getInfo(); + std::vector usmTypes = + devices[d].getInfo(); for (size_t t = 0; t < usmTypes.size(); t++) { printf("\tUSM Type[%zu]:\n", t); - PrintSVMMemFlags( "mem_flags", usmTypes[t].mem_flags ); + PrintSVMMemFlags( "type", usmTypes[t].type ); PrintUSVMCaps("capabilities", usmTypes[t].capabilities); } diff --git a/samples/usvm/01_usvmmeminfo/main.cpp b/samples/usvm/01_usvmmeminfo/main.cpp index 1fc1560..e91d0a0 100644 --- a/samples/usvm/01_usvmmeminfo/main.cpp +++ b/samples/usvm/01_usvmmeminfo/main.cpp @@ -10,14 +10,14 @@ // Each of these functions should eventually move into opencl.hpp: -static cl_svm_mem_type_exp -getSVM_MEM_INFO_TYPE_EXP( cl::Context& context, const void* ptr ) +static cl_svm_type_exp +getSVM_INFO_TYPE_EXP( cl::Context& context, const void* ptr ) { - cl_svm_mem_type_exp type = 0; - clGetSVMMemInfoEXP( + cl_svm_type_exp type = 0; + clGetSVMInfoEXP( context(), ptr, - CL_SVM_MEM_INFO_TYPE_EXP, + CL_SVM_INFO_TYPE_EXP, sizeof(type), &type, nullptr ); @@ -25,13 +25,13 @@ getSVM_MEM_INFO_TYPE_EXP( cl::Context& context, const void* ptr ) } static const void* -getSVM_MEM_INFO_BASE_PTR_EXP( cl::Context& context, const void* ptr ) +getSVM_INFO_BASE_PTR_EXP( cl::Context& context, const void* ptr ) { const void* base = nullptr; - clGetSVMMemInfoEXP( + clGetSVMInfoEXP( context(), ptr, - CL_SVM_MEM_INFO_BASE_PTR_EXP, + CL_SVM_INFO_BASE_PTR_EXP, sizeof(base), &base, nullptr ); @@ -39,13 +39,13 @@ getSVM_MEM_INFO_BASE_PTR_EXP( cl::Context& context, const void* ptr ) } static size_t -getSVM_MEM_INFO_SIZE_EXP( cl::Context& context, const void* ptr ) +getSVM_INFO_SIZE_EXP( cl::Context& context, const void* ptr ) { size_t size = 0; - clGetSVMMemInfoEXP( + clGetSVMInfoEXP( context(), ptr, - CL_SVM_MEM_INFO_SIZE_EXP, + CL_SVM_INFO_SIZE_EXP, sizeof(size), &size, nullptr ); @@ -53,13 +53,13 @@ getSVM_MEM_INFO_SIZE_EXP( cl::Context& context, const void* ptr ) } static cl_device_id -getSVM_MEM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP( cl::Context& context, const void* ptr ) +getSVM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP( cl::Context& context, const void* ptr ) { cl_device_id device = 0; - clGetSVMMemInfoEXP( + clGetSVMInfoEXP( context(), ptr, - CL_SVM_MEM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP, + CL_SVM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP, sizeof(device), &device, nullptr ); @@ -67,16 +67,14 @@ getSVM_MEM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP( cl::Context& context, const void* } static const char* -usvm_type_to_string( cl_svm_mem_type_exp type ) +svm_type_to_string( cl_svm_type_exp type ) { - switch( type ) - { - case CL_SVM_MEM_TYPE_UNKNOWN_EXP: return "CL_SVM_MEM_TYPE_UNKNOWN_EXP"; - case CL_SVM_MEM_TYPE_HOST_EXP: return "CL_SVM_MEM_TYPE_HOST_EXP"; - case CL_SVM_MEM_TYPE_DEVICE_EXP: return "CL_SVM_MEM_TYPE_DEVICE_EXP"; - case CL_SVM_MEM_TYPE_SHARED_EXP: return "CL_SVM_MEM_TYPE_SHARED_EXP"; - default: break; - } + if (type & CL_SVM_TYPE_COARSE_GRAIN_BUFFER_EXP )return "CL_SVM_TYPE_COARSE_GRAIN_BUFFER_EXP"; + if (type & CL_SVM_TYPE_FINE_GRAIN_BUFFER_EXP ) return "CL_SVM_TYPE_FINE_GRAIN_BUFFER_EXP"; + if (type & CL_SVM_TYPE_FINE_GRAIN_SYSTEM_EXP ) return "CL_SVM_TYPE_FINE_GRAIN_SYSTEM_EXP"; + if (type & CL_SVM_TYPE_DEVICE_ALLOC_EXP ) return "CL_SVM_TYPE_DEVICE_ALLOC_EXP"; + if (type & CL_SVM_TYPE_HOST_ALLOC_EXP ) return "CL_SVM_TYPE_HOST_ALLOC_EXP"; + if (type & CL_SVM_TYPE_SHARED_ALLOC_EXP ) return "CL_SVM_TYPE_SHARED_ALLOC_EXP"; return "***Unknown SVM Type***"; } @@ -123,13 +121,14 @@ int main( cl_device_svm_capabilities svmCaps = devices[deviceIndex].getInfo(); - if( svmCaps & CL_SVM_MEM_TYPE_HOST_EXP ) + if( svmCaps & CL_DEVICE_SVM_HOST_ALLOC_EXP ) { printf("\nTesting Host Allocations:\n"); char* ptr0 = (char*)clSVMAllocWithPropertiesEXP( context(), nullptr, - CL_MEM_SVM_HOST_EXP, + CL_SVM_TYPE_HOST_ALLOC_EXP, + CL_MEM_READ_WRITE, 16, 0, nullptr ); @@ -137,39 +136,40 @@ int main( char* ptr1 = (char*)clSVMAllocWithPropertiesEXP( context(), nullptr, - CL_MEM_SVM_HOST_EXP, + CL_SVM_TYPE_HOST_ALLOC_EXP, + CL_MEM_READ_WRITE, 16, 0, nullptr ); printf("Allocated Host pointer 1: ptr = %p\n", ptr1); - cl_svm_mem_type_exp type = 0; + cl_svm_type_exp type = 0; - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr1); - printf("Queried base pointer 1: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr1); + printf("Queried base pointer 1: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr1 + 4); - printf("Queried offset pointer 1: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr1 + 4); + printf("Queried offset pointer 1: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr1 + 64); - printf("Queried out of range pointer 1: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr1 + 64); + printf("Queried out of range pointer 1: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr0); - printf("Queried base pointer 0: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr0); + printf("Queried base pointer 0: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr0 + 4); - printf("Queried offset pointer 0: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr0 + 4); + printf("Queried offset pointer 0: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr0 + 64); - printf("Queried out of range pointer 0: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr0 + 64); + printf("Queried out of range pointer 0: type = %s (%X)\n", svm_type_to_string(type), type); - const void* base = getSVM_MEM_INFO_BASE_PTR_EXP(context, ptr0 + 4); + const void* base = getSVM_INFO_BASE_PTR_EXP(context, ptr0 + 4); printf("Queried offset pointer 0: base = %p\n", base); - size_t size = getSVM_MEM_INFO_SIZE_EXP(context, ptr0 + 4); + size_t size = getSVM_INFO_SIZE_EXP(context, ptr0 + 4); printf("Queried offset pointer 0: size = %u\n", (unsigned)size); - cl_device_id device = getSVM_MEM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP(context, ptr0 + 4); + cl_device_id device = getSVM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP(context, ptr0 + 4); printf("Queried offset pointer 0: device = %p\n", device); clSVMFree( @@ -185,7 +185,7 @@ int main( printf("\nThis device does not support HOST allocations.\n"); } - if( svmCaps & CL_SVM_MEM_TYPE_DEVICE_EXP ) + if( svmCaps & CL_DEVICE_SVM_DEVICE_ALLOC_EXP ) { printf("\nTesting Device Allocations:\n"); printf("Associated Device is: %p (%s)\n", @@ -198,7 +198,8 @@ int main( char* ptr0 = (char*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_DEVICE_EXP, + CL_SVM_TYPE_DEVICE_ALLOC_EXP, + CL_MEM_READ_WRITE, 16, 0, nullptr ); @@ -206,39 +207,40 @@ int main( char* ptr1 = (char*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_DEVICE_EXP, + CL_SVM_TYPE_DEVICE_ALLOC_EXP, + CL_MEM_READ_WRITE, 16, 0, nullptr ); printf("Allocated Device pointer 1: ptr = %p\n", ptr1); - cl_svm_mem_type_exp type = 0; + cl_svm_type_exp type = 0; - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr1); - printf("Queried base pointer 1: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr1); + printf("Queried base pointer 1: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr1 + 4); - printf("Queried offset pointer 1: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr1 + 4); + printf("Queried offset pointer 1: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr1 + 64); - printf("Queried out of range pointer 1: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr1 + 64); + printf("Queried out of range pointer 1: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr0); - printf("Queried base pointer 0: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr0); + printf("Queried base pointer 0: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr0 + 4); - printf("Queried offset pointer 0: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr0 + 4); + printf("Queried offset pointer 0: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr0 + 64); - printf("Queried out of range pointer 0: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr0 + 64); + printf("Queried out of range pointer 0: type = %s (%X)\n", svm_type_to_string(type), type); - const void* base = getSVM_MEM_INFO_BASE_PTR_EXP(context, ptr0 + 4); + const void* base = getSVM_INFO_BASE_PTR_EXP(context, ptr0 + 4); printf("Queried offset pointer 0: base = %p\n", base); - size_t size = getSVM_MEM_INFO_SIZE_EXP(context, ptr0 + 4); + size_t size = getSVM_INFO_SIZE_EXP(context, ptr0 + 4); printf("Queried offset pointer 0: size = %u\n", (unsigned)size); - cl_device_id device = getSVM_MEM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP(context, ptr0 + 4); + cl_device_id device = getSVM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP(context, ptr0 + 4); printf("Queried offset pointer 0: device = %p\n", device); clSVMFree( @@ -254,7 +256,7 @@ int main( printf("\nThis device does not support DEVICE allocations.\n"); } - if( svmCaps & CL_SVM_MEM_TYPE_SHARED_EXP ) + if( svmCaps & CL_DEVICE_SVM_SHARED_ALLOC_EXP ) { printf("\nTesting Shared Allocations:\n"); printf("Associated Device is: %p (%s)\n", @@ -267,7 +269,8 @@ int main( char* ptr0 = (char*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_SHARED_EXP, + CL_SVM_TYPE_SHARED_ALLOC_EXP, + CL_MEM_READ_WRITE, 16, 0, nullptr ); @@ -275,39 +278,40 @@ int main( char* ptr1 = (char*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_SHARED_EXP, + CL_SVM_TYPE_SHARED_ALLOC_EXP, + CL_MEM_READ_WRITE, 16, 0, nullptr ); printf("Allocated Shared pointer 1: ptr = %p\n", ptr1); - cl_svm_mem_type_exp type = 0; + cl_svm_type_exp type = 0; - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr1); - printf("Queried base pointer 1: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr1); + printf("Queried base pointer 1: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr1 + 4); - printf("Queried offset pointer 1: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr1 + 4); + printf("Queried offset pointer 1: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr1 + 64); - printf("Queried out of range pointer 1: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr1 + 64); + printf("Queried out of range pointer 1: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr0); - printf("Queried base pointer 0: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr0); + printf("Queried base pointer 0: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr0 + 4); - printf("Queried offset pointer 0: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr0 + 4); + printf("Queried offset pointer 0: type = %s (%X)\n", svm_type_to_string(type), type); - type = getSVM_MEM_INFO_TYPE_EXP(context, ptr0 + 64); - printf("Queried out of range pointer 0: type = %s (%X)\n", usvm_type_to_string(type), type); + type = getSVM_INFO_TYPE_EXP(context, ptr0 + 64); + printf("Queried out of range pointer 0: type = %s (%X)\n", svm_type_to_string(type), type); - const void* base = getSVM_MEM_INFO_BASE_PTR_EXP(context, ptr0 + 4); + const void* base = getSVM_INFO_BASE_PTR_EXP(context, ptr0 + 4); printf("Queried offset pointer 0: base = %p\n", base); - size_t size = getSVM_MEM_INFO_SIZE_EXP(context, ptr0 + 4); + size_t size = getSVM_INFO_SIZE_EXP(context, ptr0 + 4); printf("Queried offset pointer 0: size = %u\n", (unsigned)size); - cl_device_id device = getSVM_MEM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP(context, ptr0 + 4); + cl_device_id device = getSVM_INFO_ASSOCIATED_DEVICE_HANDLE_EXP(context, ptr0 + 4); printf("Queried offset pointer 0: device = %p\n", device); clSVMFree( diff --git a/samples/usvm/100_udmemhelloworld/main.cpp b/samples/usvm/100_udmemhelloworld/main.cpp index e18369d..5e9c93b 100644 --- a/samples/usvm/100_udmemhelloworld/main.cpp +++ b/samples/usvm/100_udmemhelloworld/main.cpp @@ -73,14 +73,16 @@ int main( cl_uint* d_src = (cl_uint*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_DEVICE_EXP, + CL_SVM_TYPE_DEVICE_ALLOC_EXP, + CL_MEM_READ_WRITE, gwx * sizeof(cl_uint), 0, nullptr ); cl_uint* d_dst = (cl_uint*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_DEVICE_EXP, + CL_SVM_TYPE_DEVICE_ALLOC_EXP, + CL_MEM_READ_WRITE, gwx * sizeof(cl_uint), 0, nullptr ); diff --git a/samples/usvm/101_udmemlinkedlist/main.cpp b/samples/usvm/101_udmemlinkedlist/main.cpp index 8bb6cd7..e197b12 100644 --- a/samples/usvm/101_udmemlinkedlist/main.cpp +++ b/samples/usvm/101_udmemlinkedlist/main.cpp @@ -58,7 +58,8 @@ static void init( cl::Context& context, cl::Device& device ) d_head = (Node*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_DEVICE_EXP, + CL_SVM_TYPE_DEVICE_ALLOC_EXP, + CL_MEM_READ_WRITE, sizeof(Node), 0, nullptr ); @@ -74,7 +75,8 @@ static void init( cl::Context& context, cl::Device& device ) h_cur.pNext = (Node*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_DEVICE_EXP, + CL_SVM_TYPE_DEVICE_ALLOC_EXP, + CL_MEM_READ_WRITE, sizeof(Node), 0, nullptr ); @@ -237,12 +239,12 @@ int main( } #endif kernel = cl::Kernel{ program, "WalkLinkedList" }; - cl_bool enableIndirectAccess = CL_TRUE; + cl_svm_type_exp indirectSVM = CL_SVM_TYPE_DEVICE_ALLOC_EXP; clSetKernelExecInfo( kernel(), - CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_EXP, - sizeof(enableIndirectAccess), - &enableIndirectAccess ); + CL_KERNEL_EXEC_INFO_SVM_INDIRECT_ACCESS_ENABLE_EXP, + sizeof(indirectSVM), + &indirectSVM ); init( context, devices[deviceIndex] ); go(); diff --git a/samples/usvm/200_uhmemhelloworld/main.cpp b/samples/usvm/200_uhmemhelloworld/main.cpp index f15ba12..e54721d 100644 --- a/samples/usvm/200_uhmemhelloworld/main.cpp +++ b/samples/usvm/200_uhmemhelloworld/main.cpp @@ -67,14 +67,16 @@ int main( cl_uint* h_src = (cl_uint*)clSVMAllocWithPropertiesEXP( context(), nullptr, - CL_MEM_SVM_HOST_EXP, + CL_SVM_TYPE_HOST_ALLOC_EXP, + CL_MEM_READ_WRITE, gwx * sizeof(cl_uint), 0, nullptr ); cl_uint* h_dst = (cl_uint*)clSVMAllocWithPropertiesEXP( context(), nullptr, - CL_MEM_SVM_HOST_EXP, + CL_SVM_TYPE_HOST_ALLOC_EXP, + CL_MEM_READ_WRITE, gwx * sizeof(cl_uint), 0, nullptr ); diff --git a/samples/usvm/201_uhmemlinkedlist/main.cpp b/samples/usvm/201_uhmemlinkedlist/main.cpp index ea58267..5dd782f 100644 --- a/samples/usvm/201_uhmemlinkedlist/main.cpp +++ b/samples/usvm/201_uhmemlinkedlist/main.cpp @@ -52,7 +52,8 @@ static void init( cl::Context& context, cl::Device& device ) h_head = (Node*)clSVMAllocWithPropertiesEXP( context(), nullptr, - CL_MEM_SVM_HOST_EXP, + CL_SVM_TYPE_HOST_ALLOC_EXP, + CL_MEM_READ_WRITE, sizeof(Node), 0, nullptr ); @@ -68,7 +69,8 @@ static void init( cl::Context& context, cl::Device& device ) h_cur->pNext = (Node*)clSVMAllocWithPropertiesEXP( context(), nullptr, - CL_MEM_SVM_HOST_EXP, + CL_SVM_TYPE_HOST_ALLOC_EXP, + CL_MEM_READ_WRITE, sizeof(Node), 0, nullptr ); @@ -214,12 +216,12 @@ int main( } #endif kernel = cl::Kernel{ program, "WalkLinkedList" }; - cl_bool enableIndirectAccess = CL_TRUE; + cl_svm_type_exp indirectSVM = CL_SVM_TYPE_HOST_ALLOC_EXP; clSetKernelExecInfo( kernel(), - CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_EXP, - sizeof(enableIndirectAccess), - &enableIndirectAccess ); + CL_KERNEL_EXEC_INFO_SVM_INDIRECT_ACCESS_ENABLE_EXP, + sizeof(indirectSVM), + &indirectSVM ); init( context, devices[deviceIndex] ); go(); diff --git a/samples/usvm/300_usmemhelloworld/main.cpp b/samples/usvm/300_usmemhelloworld/main.cpp index 56a027f..baff68b 100644 --- a/samples/usvm/300_usmemhelloworld/main.cpp +++ b/samples/usvm/300_usmemhelloworld/main.cpp @@ -71,14 +71,16 @@ int main( cl_uint* s_src = (cl_uint*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_SHARED_EXP, + CL_SVM_TYPE_SHARED_ALLOC_EXP, + CL_MEM_READ_WRITE, gwx * sizeof(cl_uint), 0, nullptr ); cl_uint* s_dst = (cl_uint*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_SHARED_EXP, + CL_SVM_TYPE_SHARED_ALLOC_EXP, + CL_MEM_READ_WRITE, gwx * sizeof(cl_uint), 0, nullptr ); diff --git a/samples/usvm/301_usmemlinkedlist/main.cpp b/samples/usvm/301_usmemlinkedlist/main.cpp index 437369c..b65c082 100644 --- a/samples/usvm/301_usmemlinkedlist/main.cpp +++ b/samples/usvm/301_usmemlinkedlist/main.cpp @@ -57,7 +57,8 @@ static void init( cl::Context& context, cl::Device& device ) s_head = (Node*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_SHARED_EXP, + CL_SVM_TYPE_SHARED_ALLOC_EXP, + CL_MEM_READ_WRITE, sizeof(Node), 0, nullptr ); @@ -73,7 +74,8 @@ static void init( cl::Context& context, cl::Device& device ) s_cur->pNext = (Node*)clSVMAllocWithPropertiesEXP( context(), props, - CL_MEM_SVM_SHARED_EXP, + CL_SVM_TYPE_SHARED_ALLOC_EXP, + CL_MEM_READ_WRITE, sizeof(Node), 0, nullptr ); @@ -219,12 +221,12 @@ int main( } #endif kernel = cl::Kernel{ program, "WalkLinkedList" }; - cl_bool enableIndirectAccess = CL_TRUE; + cl_svm_type_exp indirectSVM = CL_SVM_TYPE_SHARED_ALLOC_EXP; clSetKernelExecInfo( kernel(), - CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_EXP, - sizeof(enableIndirectAccess), - &enableIndirectAccess ); + CL_KERNEL_EXEC_INFO_SVM_INDIRECT_ACCESS_ENABLE_EXP, + sizeof(indirectSVM), + &indirectSVM ); init( context, devices[deviceIndex] ); go(); diff --git a/xml/cl.xml b/xml/cl.xml index 7d66406..932d93c 100644 --- a/xml/cl.xml +++ b/xml/cl.xml @@ -255,13 +255,14 @@ server's OpenCL/api-docs repository. typedef cl_bitfield cl_platform_command_buffer_capabilities_khr; typedef cl_bitfield cl_mutable_dispatch_asserts_khr typedef cl_bitfield cl_device_kernel_clock_capabilities_khr; - typedef cl_bitfield cl_device_unified_svm_capabilities_exp; + typedef cl_bitfield cl_svm_type_capabilities_exp; + typedef cl_bitfield cl_svm_type_exp; typedef cl_properties cl_svm_alloc_properties_exp; + typedef cl_bitfield cl_svm_alloc_flags_exp; typedef cl_properties cl_svm_free_properties_exp; - typedef cl_uint cl_svm_mem_info_exp; - typedef cl_uint cl_svm_mem_type_exp; - typedef cl_uint cl_svm_mem_advice_exp; typedef cl_bitfield cl_svm_free_flags_exp; + typedef cl_uint cl_svm_info_exp; + typedef cl_uint cl_svm_advice_exp; Structure types @@ -399,9 +400,9 @@ server's OpenCL/api-docs repository. const cl_mutable_dispatch_config_khr* mutable_dispatch_list - - cl_svm_mem_flags mem_flags - cl_device_unified_svm_capabilities_exp capabilities + + cl_svm_type_exp type + cl_svm_type_capabilities_exp capabilities @@ -842,6 +843,17 @@ server's OpenCL/api-docs repository. + + + + + + + + + + + @@ -913,11 +925,7 @@ server's OpenCL/api-docs repository. - - - - - + @@ -1261,18 +1269,18 @@ server's OpenCL/api-docs repository. - - - - - - - - - - - - + + + + + + + + + + + + @@ -1281,6 +1289,13 @@ server's OpenCL/api-docs repository. + + + + + + + @@ -1594,7 +1609,7 @@ server's OpenCL/api-docs repository. - + @@ -1773,7 +1788,9 @@ server's OpenCL/api-docs repository. - + + + @@ -1935,7 +1952,17 @@ server's OpenCL/api-docs repository. - + + + + + + + + + + + @@ -2229,34 +2256,25 @@ server's OpenCL/api-docs repository. - - - - - + - - - - - - + - + - + - + @@ -2289,17 +2307,14 @@ server's OpenCL/api-docs repository. - - - - + @@ -3370,7 +3385,8 @@ server's OpenCL/api-docs repository. void* clSVMAllocWithPropertiesEXP cl_context context const cl_svm_alloc_properties_exp* properties - cl_svm_mem_flags flags + cl_svm_type_exp type + cl_mem_flags flags size_t size cl_uint alignment cl_int* errcode_ret @@ -3383,20 +3399,20 @@ server's OpenCL/api-docs repository. void* ptr - cl_int clGetSVMMemInfoEXP + cl_int clGetSVMInfoEXP cl_context context const void* ptr - cl_svm_mem_info_exp param_name + cl_svm_info_exp param_name size_t param_value_size void* param_value size_t* param_value_size_ret - cl_int clEnqueueSVMMemAdviseEXP + cl_int clEnqueueSVMAdviseEXP cl_command_queue command_queue const void* ptr size_t size - cl_svm_mem_advice_exp advice + cl_svm_advice_exp advice cl_uint num_events_in_wait_list const cl_event* event_wait_list cl_event* event @@ -7574,81 +7590,81 @@ server's OpenCL/api-docs repository. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + - + - - + +