Skip to content

Commit 15517f1

Browse files
committed
Incorporate OpenCL-Headers issue: KhronosGroup/OpenCL-Headers#249
1 parent e1a0dcb commit 15517f1

3 files changed

Lines changed: 56 additions & 21 deletions

File tree

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Rust
1+
name: Rust CI
22

33
on:
44
push:
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v4
1818
- name: Install Rust
1919
run: rustup update stable
20-
- name: Unit test
20+
- name: check
2121
run: cargo check
2222

2323
test:

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ cl_khr_d3d11_sharing = []
6666
cl_loader_info = []
6767
cl_pocl_content_size = []
6868
cl_loader_layers = []
69+
cl_img_cancel_command = []
6970

7071
[dependencies]
7172
libc = "0.2"

src/cl_ext.rs

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,17 @@ pub type clCommandNDRangeKernelKHR_t = Option<
271271
>;
272272
pub type clCommandNDRangeKernelKHR_fn = clCommandNDRangeKernelKHR_t;
273273

274+
pub type clGetCommandBufferInfoKHR_t = Option<
275+
unsafe extern "C" fn(
276+
command_buffer: cl_command_buffer_khr,
277+
param_name: cl_command_buffer_info_khr,
278+
param_value_size: size_t,
279+
param_value: *mut c_void,
280+
param_value_size_ret: *mut size_t,
281+
) -> cl_int,
282+
>;
283+
pub type clGetCommandBufferInfoKHR_fn = clGetCommandBufferInfoKHR_t;
284+
274285
pub type clCommandSVMMemcpyKHR_t = Option<
275286
unsafe extern "C" fn(
276287
command_buffer: cl_command_buffer_khr,
@@ -302,17 +313,6 @@ pub type clCommandSVMMemFillKHR_t = Option<
302313
>;
303314
pub type clCommandSVMMemFillKHR_fn = clCommandSVMMemFillKHR_t;
304315

305-
pub type clGetCommandBufferInfoKHR_t = Option<
306-
unsafe extern "C" fn(
307-
command_buffer: cl_command_buffer_khr,
308-
param_name: cl_command_buffer_info_khr,
309-
param_value_size: size_t,
310-
param_value: *mut c_void,
311-
param_value_size_ret: *mut size_t,
312-
) -> cl_int,
313-
>;
314-
pub type clGetCommandBufferInfoKHR_fn = clGetCommandBufferInfoKHR_t;
315-
316316
#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
317317
#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
318318
#[cfg(feature = "cl_khr_command_buffer")]
@@ -466,6 +466,14 @@ extern "system" {
466466
mutable_handle: *mut cl_mutable_command_khr,
467467
) -> cl_int;
468468

469+
pub fn clGetCommandBufferInfoKHR(
470+
command_buffer: cl_command_buffer_khr,
471+
param_name: cl_command_buffer_info_khr,
472+
param_value_size: size_t,
473+
param_value: *mut c_void,
474+
param_value_size_ret: *mut size_t,
475+
) -> cl_int;
476+
469477
pub fn clCommandSVMMemcpyKHR(
470478
command_buffer: cl_command_buffer_khr,
471479
command_queue: cl_command_queue,
@@ -491,14 +499,6 @@ extern "system" {
491499
mutable_handle: *mut cl_mutable_command_khr,
492500
) -> cl_int;
493501

494-
pub fn clGetCommandBufferInfoKHR(
495-
command_buffer: cl_command_buffer_khr,
496-
param_name: cl_command_buffer_info_khr,
497-
param_value_size: size_t,
498-
param_value: *mut c_void,
499-
param_value_size_ret: *mut size_t,
500-
) -> cl_int;
501-
502502
}
503503

504504
// cl_khr_command_buffer_multi_device
@@ -1297,6 +1297,13 @@ pub type cl_mem_alloc_flags_img = cl_bitfield;
12971297

12981298
// To be used with cl_mem_alloc_flags_img
12991299
pub const CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG: cl_mem_alloc_flags_img = 1 << 0;
1300+
pub const CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG: cl_mem_alloc_flags_img = 1 << 1;
1301+
pub const CL_MEM_ALLOC_GPU_CACHED_IMG: cl_mem_alloc_flags_img = 1 << 2;
1302+
pub const CL_MEM_ALLOC_CPU_LOCAL_IMG: cl_mem_alloc_flags_img = 1 << 3;
1303+
pub const CL_MEM_ALLOC_GPU_LOCAL_IMG: cl_mem_alloc_flags_img = 1 << 4;
1304+
pub const CL_MEM_ALLOC_GPU_PRIVATE_IMG: cl_mem_alloc_flags_img = 1 << 5;
1305+
1306+
pub const CL_DEVICE_MEMORY_CAPABILITIES_IMG: cl_device_info = 0x40D8;
13001307

13011308
// cl_khr_subgroups extension
13021309
pub const CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR: cl_kernel_sub_group_info = 0x2033;
@@ -3102,6 +3109,33 @@ extern "system" {
31023109
pub const CL_UNSIGNED_INT_RAW10_EXT: cl_uint = 0x10E3;
31033110
pub const CL_UNSIGNED_INT_RAW12_EXT: cl_uint = 0x10E4;
31043111

3112+
// cl_khr_kernel_clock
3113+
3114+
pub const CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR: cl_device_info = 0x1076;
3115+
3116+
pub type cl_device_kernel_clock_capabilities_khr = cl_bitfield;
3117+
3118+
pub const CL_DEVICE_KERNEL_CLOCK_SCOPE_DEVICE_KHR: cl_device_kernel_clock_capabilities_khr = 1 << 0;
3119+
pub const CL_DEVICE_KERNEL_CLOCK_SCOPE_WORK_GROUP_KHR: cl_device_kernel_clock_capabilities_khr = 1 << 1;
3120+
pub const CL_DEVICE_KERNEL_CLOCK_SCOPE_SUB_GROUP_KHR: cl_device_kernel_clock_capabilities_khr = 1 << 2;
3121+
3122+
// cl_img_cancel_command
3123+
3124+
pub const CL_CANCELLED_IMG: cl_int = -1126;
3125+
3126+
pub type clCancelCommandsIMG_t = Option<
3127+
unsafe extern "C" fn(event_list: *const cl_event, num_events_in_list: usize) -> cl_int,
3128+
>;
3129+
pub type clCancelCommandsIMG_fn = clCancelCommandsIMG_t;
3130+
3131+
#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3132+
#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3133+
#[cfg(feature = "cl_img_cancel_command")]
3134+
#[cfg(feature = "static")]
3135+
unsafe extern "C" {
3136+
pub fn clCancelCommandsIMG(event_list: *const cl_event, num_events_in_list: usize) -> cl_int;
3137+
}
3138+
31053139
#[cfg(test)]
31063140
mod tests {
31073141
use super::*;

0 commit comments

Comments
 (0)