Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/call_all.c.mako
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ defaultValueForType = {
'cl_kernel_exec_info_arm' : 'CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM',
'cl_kernel_sub_group_info' : 'CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR',
'cl_mem_advice_intel' : '0',
'cl_mem_device_address_ext' : '0',
'cl_mutable_command_info_khr' : 'CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR',
'cl_map_flags' : 'CL_MAP_READ',
'cl_mem_flags' : 'CL_MEM_READ_WRITE',
Expand Down
38 changes: 38 additions & 0 deletions src/openclext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,17 @@ typedef cl_int (CL_API_CALL* clTerminateContextKHR_clextfn)(
#pragma message("Define for cl_khr_terminate_context was not found! Please update your headers.")
#endif // defined(cl_khr_terminate_context)

#if defined(cl_ext_buffer_device_address)

typedef cl_int (CL_API_CALL* clSetKernelArgDevicePointerEXT_clextfn)(
cl_kernel kernel,
cl_uint arg_index,
cl_mem_device_address_ext arg_value);

#else
#pragma message("Define for cl_ext_buffer_device_address was not found! Please update your headers.")
#endif // defined(cl_ext_buffer_device_address)

#if defined(cl_ext_device_fission)

typedef cl_int (CL_API_CALL* clReleaseDeviceEXT_clextfn)(
Expand Down Expand Up @@ -1445,6 +1456,10 @@ struct openclext_dispatch_table {
clTerminateContextKHR_clextfn clTerminateContextKHR;
#endif // defined(cl_khr_terminate_context)

#if defined(cl_ext_buffer_device_address)
clSetKernelArgDevicePointerEXT_clextfn clSetKernelArgDevicePointerEXT;
#endif // defined(cl_ext_buffer_device_address)

#if defined(cl_ext_device_fission)
clReleaseDeviceEXT_clextfn clReleaseDeviceEXT;
clRetainDeviceEXT_clextfn clRetainDeviceEXT;
Expand Down Expand Up @@ -1721,6 +1736,10 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt
CLEXT_GET_EXTENSION(clTerminateContextKHR);
#endif // defined(cl_khr_terminate_context)

#if defined(cl_ext_buffer_device_address)
CLEXT_GET_EXTENSION(clSetKernelArgDevicePointerEXT);
#endif // defined(cl_ext_buffer_device_address)

#if defined(cl_ext_device_fission)
CLEXT_GET_EXTENSION(clReleaseDeviceEXT);
CLEXT_GET_EXTENSION(clRetainDeviceEXT);
Expand Down Expand Up @@ -3414,6 +3433,25 @@ cl_int CL_API_CALL clTerminateContextKHR(

#endif // defined(cl_khr_terminate_context)

#if defined(cl_ext_buffer_device_address)

cl_int CL_API_CALL clSetKernelArgDevicePointerEXT(
cl_kernel kernel,
cl_uint arg_index,
cl_mem_device_address_ext arg_value)
{
struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(kernel);
if (dispatch_ptr == nullptr || dispatch_ptr->clSetKernelArgDevicePointerEXT == nullptr) {
return CL_INVALID_OPERATION;
}
return dispatch_ptr->clSetKernelArgDevicePointerEXT(
kernel,
arg_index,
arg_value);
}

#endif // defined(cl_ext_buffer_device_address)

#if defined(cl_ext_device_fission)

cl_int CL_API_CALL clReleaseDeviceEXT(
Expand Down
4 changes: 4 additions & 0 deletions tests/call_all.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ void call_all(void)
clTerminateContextKHR(NULL);
#endif // cl_khr_terminate_context

#ifdef cl_ext_buffer_device_address
clSetKernelArgDevicePointerEXT(NULL, 0, 0);
#endif // cl_ext_buffer_device_address

#ifdef cl_ext_device_fission
clReleaseDeviceEXT(NULL);
clRetainDeviceEXT(NULL);
Expand Down