rusticl: implement CL 3.1 platform features

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41358>
This commit is contained in:
Karol Herbst 2026-03-02 02:05:24 +01:00 committed by Marge Bot
parent e5526bbac0
commit 626ec83855
4 changed files with 8 additions and 11 deletions

View file

@ -211,6 +211,7 @@ cl_dispatch!([
clCreateBufferWithProperties: Some(clCreateBufferWithProperties),
clCreateImageWithProperties: Some(clCreateImageWithProperties),
clSetContextDestructorCallback: Some(clSetContextDestructorCallback),
clGetKernelSuggestedLocalWorkSize: Some(clGetKernelSuggestedLocalWorkSize),
]);
pub type CLError = cl_int;
@ -577,7 +578,7 @@ pub extern "C" fn clGetExtensionFunctionAddress(
"clRetainSemaphoreKHR" => cl_ext_func!(clRetainSemaphoreKHR: clRetainSemaphoreKHR_t),
// cl_khr_suggested_local_work_size
"clGetKernelSuggestedLocalWorkSizeKHR" => cl_ext_func!(clGetKernelSuggestedLocalWorkSizeKHR: clGetKernelSuggestedLocalWorkSizeKHR_fn),
"clGetKernelSuggestedLocalWorkSizeKHR" => cl_ext_func!(clGetKernelSuggestedLocalWorkSize: clGetKernelSuggestedLocalWorkSizeKHR_fn),
// cl_ext_buffer_device_address
"clSetKernelArgDevicePointerEXT" => cl_ext_func!(clSetKernelArgDevicePointerEXT: clSetKernelArgDevicePointerEXT_fn),

View file

@ -389,11 +389,7 @@ fn set_kernel_arg(
// arg_size != sizeof(cl_mem) or if arg_size is zero and the argument is declared with the
// local qualifier or if the argument is a sampler and arg_size != sizeof(cl_sampler).
match arg.kind {
KernelArgType::MemLocal => {
if arg_size == 0 {
return Err(CL_INVALID_ARG_SIZE);
}
}
KernelArgType::MemLocal => {}
KernelArgType::MemGlobal
| KernelArgType::MemConstant
| KernelArgType::Image
@ -856,8 +852,8 @@ fn clone_kernel(source_kernel: cl_kernel) -> CLResult<cl_kernel> {
Ok(Arc::new(k.clone()).into_cl())
}
#[cl_entrypoint(clGetKernelSuggestedLocalWorkSizeKHR)]
fn get_kernel_suggested_local_work_size_khr(
#[cl_entrypoint(clGetKernelSuggestedLocalWorkSize)]
fn get_kernel_suggested_local_work_size(
command_queue: cl_command_queue,
kernel: cl_kernel,
work_dim: cl_uint,

View file

@ -25,7 +25,7 @@ unsafe impl CLInfo<cl_platform_info> for cl_platform_id {
CL_PLATFORM_HOST_TIMER_RESOLUTION => v.write::<cl_ulong>(1),
CL_PLATFORM_ICD_SUFFIX_KHR => v.write::<&CStr>(c"MESA"),
CL_PLATFORM_NAME => v.write::<&CStr>(c"rusticl"),
CL_PLATFORM_NUMERIC_VERSION => v.write::<cl_version>(CLVersion::Cl3_0.into()),
CL_PLATFORM_NUMERIC_VERSION => v.write::<cl_version>(CLVersion::Cl3_1.into()),
CL_PLATFORM_PROFILE => v.write::<&CStr>(c"FULL_PROFILE"),
CL_PLATFORM_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR => {
v.write::<&[cl_external_semaphore_handle_type_khr]>(
@ -54,7 +54,7 @@ unsafe impl CLInfo<cl_platform_info> for cl_platform_id {
}
CL_PLATFORM_VENDOR => v.write::<&CStr>(c"Mesa/X.org"),
// OpenCL<space><major_version.minor_version><space><platform-specific information>
CL_PLATFORM_VERSION => v.write::<&CStr>(c"OpenCL 3.0 "),
CL_PLATFORM_VERSION => v.write::<&CStr>(c"OpenCL 3.1 "),
// CL_INVALID_VALUE if param_name is not one of the supported values
_ => Err(CL_INVALID_VALUE),
}

View file

@ -128,7 +128,7 @@ cl_c_args = [
'-DCL_USE_DEPRECATED_OPENCL_2_0_APIS',
'-DCL_USE_DEPRECATED_OPENCL_2_1_APIS',
'-DCL_USE_DEPRECATED_OPENCL_2_2_APIS',
'-DCL_TARGET_OPENCL_VERSION=300',
'-DCL_TARGET_OPENCL_VERSION=310',
]
rusticl_opencl_bindings_rs = rust.bindgen(