rusticl/program: add il stubs
authorKarol Herbst <kherbst@redhat.com>
Fri, 18 Mar 2022 00:49:08 +0000 (01:49 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Sep 2022 05:58:12 +0000 (05:58 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15439>

src/gallium/frontends/rusticl/api/icd.rs
src/gallium/frontends/rusticl/api/program.rs

index 801ab02..e5d8f00 100644 (file)
@@ -160,14 +160,14 @@ pub static DISPATCH: cl_icd_dispatch = cl_icd_dispatch {
     clSetKernelExecInfo: None,
     clGetKernelSubGroupInfoKHR: None,
     clCloneKernel: Some(cl_clone_kernel),
-    clCreateProgramWithIL: None,
+    clCreateProgramWithIL: Some(cl_create_program_with_il),
     clEnqueueSVMMigrateMem: None,
     clGetDeviceAndHostTimer: None,
     clGetHostTimer: None,
     clGetKernelSubGroupInfo: None,
     clSetDefaultDeviceCommandQueue: None,
     clSetProgramReleaseCallback: None,
-    clSetProgramSpecializationConstant: None,
+    clSetProgramSpecializationConstant: Some(cl_set_program_specialization_constant),
     clCreateBufferWithProperties: None,
     clCreateImageWithProperties: None,
     clSetContextDestructorCallback: Some(cl_set_context_destructor_callback),
@@ -1507,6 +1507,26 @@ extern "C" fn cl_clone_kernel(source_kernel: cl_kernel, errcode_ret: *mut cl_int
     match_obj!(clone_kernel(source_kernel), errcode_ret)
 }
 
+extern "C" fn cl_create_program_with_il(
+    context: cl_context,
+    il: *const ::std::os::raw::c_void,
+    length: usize,
+    errcode_ret: *mut cl_int,
+) -> cl_program {
+    match_obj!(create_program_with_il(context, il, length), errcode_ret)
+}
+
+extern "C" fn cl_set_program_specialization_constant(
+    program: cl_program,
+    spec_id: cl_uint,
+    spec_size: usize,
+    spec_value: *const ::std::os::raw::c_void,
+) -> cl_int {
+    match_err!(set_program_specialization_constant(
+        program, spec_id, spec_size, spec_value
+    ))
+}
+
 extern "C" fn cl_set_context_destructor_callback(
     context: cl_context,
     pfn_notify: ::std::option::Option<DeleteContextCB>,
index 68bb150..1ff71ff 100644 (file)
@@ -42,6 +42,7 @@ impl CLInfo<cl_program_info> for cl_program {
                         .collect(),
                 )
             }
+            CL_PROGRAM_IL => Vec::new(),
             CL_PROGRAM_KERNEL_NAMES => cl_prop::<String>(prog.kernels().join(";")),
             CL_PROGRAM_NUM_DEVICES => cl_prop::<cl_uint>(prog.devs.len() as cl_uint),
             CL_PROGRAM_NUM_KERNELS => cl_prop::<usize>(prog.kernels().len()),
@@ -194,6 +195,21 @@ pub fn create_program_with_binary(
     //• CL_INVALID_BINARY if an invalid program binary was encountered for any device. binary_status will return specific status for each device.
 }
 
+pub fn create_program_with_il(
+    context: cl_context,
+    _il: *const ::std::os::raw::c_void,
+    _length: usize,
+) -> CLResult<cl_program> {
+    let _c = context.get_ref()?;
+
+    println!("create_program_with_il not implemented");
+    Err(CL_INVALID_OPERATION)
+    //• CL_INVALID_CONTEXT if context is not a valid context.
+    //• CL_INVALID_OPERATION if no devices in context support intermediate language programs.
+    //• CL_INVALID_VALUE if il is NULL or if length is zero.
+    //• CL_INVALID_VALUE if the length-byte memory pointed to by il does not contain well-formed intermediate language input that can be consumed by the OpenCL runtime.
+}
+
 pub fn build_program(
     program: cl_program,
     num_devices: cl_uint,
@@ -345,3 +361,13 @@ pub fn link_program(
     //• CL_INVALID_LINKER_OPTIONS if the linker options specified by options are invalid.
     //• CL_INVALID_OPERATION if the rules for devices containing compiled binaries or libraries as described in input_programs argument above are not followed.
 }
+
+pub fn set_program_specialization_constant(
+    _program: cl_program,
+    _spec_id: cl_uint,
+    _spec_size: usize,
+    _spec_value: *const ::std::os::raw::c_void,
+) -> CLResult<()> {
+    println!("set_program_specialization_constantnot implemented");
+    Err(CL_INVALID_OPERATION)
+}