Skip to content

Commit f07c8c7

Browse files
authored
update the extension loader to support the latest extensions (#133)
Adds the define to CL_ENABLE_BETA_EXTENSIONS Adds support for cl_ext_buffer_device_address Updates all copyright dates to 2025
1 parent 89e0e06 commit f07c8c7

11 files changed

Lines changed: 55 additions & 11 deletions

lib/src/Extensions/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021-2023 Ben Ashbaugh
1+
# Copyright (c) 2021-2025 Ben Ashbaugh
22
#
33
# SPDX-License-Identifier: MIT or Apache-2.0
44

@@ -78,6 +78,7 @@ set_target_properties(OpenCLExt PROPERTIES FOLDER "OpenCLExtensionLoader")
7878
set_target_properties(OpenCLExt PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
7979
target_include_directories(OpenCLExt PRIVATE ${OPENCL_EXTENSION_LOADER_INCLUDE_DIRS})
8080
target_compile_definitions(OpenCLExt PRIVATE CL_TARGET_OPENCL_VERSION=300)
81+
target_compile_definitions(OpenCLExt PRIVATE CL_ENABLE_BETA_EXTENSIONS)
8182
if (OPENCL_EXTENSION_LOADER_SINGLE_PLATFORM_ONLY)
8283
target_compile_definitions(OpenCLExt PRIVATE CLEXT_SINGLE_PLATFORM_ONLY)
8384
endif()

lib/src/Extensions/LICENSE-MIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021-2023 Ben Ashbaugh
3+
Copyright (c) 2021-2025 Ben Ashbaugh
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

lib/src/Extensions/scripts/call_all.c.mako

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ defaultValueForType = {
5959
'cl_kernel_exec_info_arm' : 'CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM',
6060
'cl_kernel_sub_group_info' : 'CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR',
6161
'cl_mem_advice_intel' : '0',
62+
'cl_mem_device_address_ext' : '0',
6263
'cl_mutable_command_info_khr' : 'CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR',
6364
'cl_map_flags' : 'CL_MAP_READ',
6465
'cl_mem_flags' : 'CL_MEM_READ_WRITE',
@@ -119,7 +120,7 @@ def getCallArgs(params):
119120
return callstr
120121
121122
%>/*******************************************************************************
122-
// Copyright (c) 2021-2024 Ben Ashbaugh
123+
// Copyright (c) 2021-2025 Ben Ashbaugh
123124
//
124125
// SPDX-License-Identifier: MIT or Apache-2.0
125126
*/

lib/src/Extensions/scripts/gen_openclext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python3
22

3-
# Copyright (c) 2021-2023 Ben Ashbaugh
3+
# Copyright (c) 2021-2025 Ben Ashbaugh
44
#
55
# SPDX-License-Identifier: MIT or Apache-2.0
66

lib/src/Extensions/scripts/openclext.cpp.mako

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def getCParameterStrings(params):
116116
return strings
117117
118118
%>/*******************************************************************************
119-
// Copyright (c) 2021-2024 Ben Ashbaugh
119+
// Copyright (c) 2021-2025 Ben Ashbaugh
120120
//
121121
// SPDX-License-Identifier: MIT or Apache-2.0
122122
*/

lib/src/Extensions/src/openclext.cpp

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
// Copyright (c) 2021-2024 Ben Ashbaugh
2+
// Copyright (c) 2021-2025 Ben Ashbaugh
33
//
44
// SPDX-License-Identifier: MIT or Apache-2.0
55
*/
@@ -751,6 +751,17 @@ typedef cl_int (CL_API_CALL* clTerminateContextKHR_clextfn)(
751751
#pragma message("Define for cl_khr_terminate_context was not found! Please update your headers.")
752752
#endif // defined(cl_khr_terminate_context)
753753

754+
#if defined(cl_ext_buffer_device_address)
755+
756+
typedef cl_int (CL_API_CALL* clSetKernelArgDevicePointerEXT_clextfn)(
757+
cl_kernel kernel,
758+
cl_uint arg_index,
759+
cl_mem_device_address_ext arg_value);
760+
761+
#else
762+
#pragma message("Define for cl_ext_buffer_device_address was not found! Please update your headers.")
763+
#endif // defined(cl_ext_buffer_device_address)
764+
754765
#if defined(cl_ext_device_fission)
755766

756767
typedef cl_int (CL_API_CALL* clReleaseDeviceEXT_clextfn)(
@@ -1440,6 +1451,10 @@ struct openclext_dispatch_table {
14401451
clTerminateContextKHR_clextfn clTerminateContextKHR;
14411452
#endif // defined(cl_khr_terminate_context)
14421453

1454+
#if defined(cl_ext_buffer_device_address)
1455+
clSetKernelArgDevicePointerEXT_clextfn clSetKernelArgDevicePointerEXT;
1456+
#endif // defined(cl_ext_buffer_device_address)
1457+
14431458
#if defined(cl_ext_device_fission)
14441459
clReleaseDeviceEXT_clextfn clReleaseDeviceEXT;
14451460
clRetainDeviceEXT_clextfn clRetainDeviceEXT;
@@ -1716,6 +1731,10 @@ static void _init(cl_platform_id platform, openclext_dispatch_table* dispatch_pt
17161731
CLEXT_GET_EXTENSION(clTerminateContextKHR);
17171732
#endif // defined(cl_khr_terminate_context)
17181733

1734+
#if defined(cl_ext_buffer_device_address)
1735+
CLEXT_GET_EXTENSION(clSetKernelArgDevicePointerEXT);
1736+
#endif // defined(cl_ext_buffer_device_address)
1737+
17191738
#if defined(cl_ext_device_fission)
17201739
CLEXT_GET_EXTENSION(clReleaseDeviceEXT);
17211740
CLEXT_GET_EXTENSION(clRetainDeviceEXT);
@@ -3409,6 +3428,25 @@ cl_int CL_API_CALL clTerminateContextKHR(
34093428

34103429
#endif // defined(cl_khr_terminate_context)
34113430

3431+
#if defined(cl_ext_buffer_device_address)
3432+
3433+
cl_int CL_API_CALL clSetKernelArgDevicePointerEXT(
3434+
cl_kernel kernel,
3435+
cl_uint arg_index,
3436+
cl_mem_device_address_ext arg_value)
3437+
{
3438+
struct openclext_dispatch_table* dispatch_ptr = _get_dispatch(kernel);
3439+
if (dispatch_ptr == nullptr || dispatch_ptr->clSetKernelArgDevicePointerEXT == nullptr) {
3440+
return CL_INVALID_OPERATION;
3441+
}
3442+
return dispatch_ptr->clSetKernelArgDevicePointerEXT(
3443+
kernel,
3444+
arg_index,
3445+
arg_value);
3446+
}
3447+
3448+
#endif // defined(cl_ext_buffer_device_address)
3449+
34123450
#if defined(cl_ext_device_fission)
34133451

34143452
cl_int CL_API_CALL clReleaseDeviceEXT(

lib/src/Extensions/tests/call_all.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
// Copyright (c) 2021-2024 Ben Ashbaugh
2+
// Copyright (c) 2021-2025 Ben Ashbaugh
33
//
44
// SPDX-License-Identifier: MIT or Apache-2.0
55
*/
@@ -161,6 +161,10 @@ void call_all(void)
161161
clTerminateContextKHR(NULL);
162162
#endif // cl_khr_terminate_context
163163

164+
#ifdef cl_ext_buffer_device_address
165+
clSetKernelArgDevicePointerEXT(NULL, 0, 0);
166+
#endif // cl_ext_buffer_device_address
167+
164168
#ifdef cl_ext_device_fission
165169
clReleaseDeviceEXT(NULL);
166170
clRetainDeviceEXT(NULL);

lib/src/Extensions/tests/dx_sharing_prototypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
// Copyright (c) 2021-2023 Ben Ashbaugh
2+
// Copyright (c) 2021-2025 Ben Ashbaugh
33
//
44
// SPDX-License-Identifier: MIT or Apache-2.0
55
*/

lib/src/Extensions/tests/loader_info_prototypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
// Copyright (c) 2023 Ben Ashbaugh
2+
// Copyright (c) 2023-2025 Ben Ashbaugh
33
//
44
// SPDX-License-Identifier: MIT or Apache-2.0
55
*/

lib/src/Extensions/tests/test_extension_loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
// Copyright (c) 2021-2023 Ben Ashbaugh
2+
// Copyright (c) 2021-2025 Ben Ashbaugh
33
//
44
// SPDX-License-Identifier: MIT or Apache-2.0
55
*/

0 commit comments

Comments
 (0)