rusticl/pipe: add clGetPipeInfo stub end return CL_INVALID_MEM_OBJECT
authorKarol Herbst <kherbst@redhat.com>
Sun, 20 Mar 2022 20:47:33 +0000 (21:47 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Sep 2022 05:58:12 +0000 (05:58 +0000)
spec requires this for devices not supporting pipes

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/memory.rs
src/gallium/frontends/rusticl/meson.build

index 6eebb02..2424d5d 100644 (file)
@@ -1516,14 +1516,18 @@ extern "C" fn cl_create_pipe(
 }
 
 extern "C" fn cl_get_pipe_info(
-    _pipe: cl_mem,
-    _param_name: cl_pipe_info,
-    _param_value_size: usize,
-    _param_value: *mut ::std::os::raw::c_void,
-    _param_value_size_ret: *mut usize,
+    pipe: cl_mem,
+    param_name: cl_pipe_info,
+    param_value_size: usize,
+    param_value: *mut ::std::os::raw::c_void,
+    param_value_size_ret: *mut usize,
 ) -> cl_int {
-    println!("get_pipe_info not implemented");
-    CL_OUT_OF_HOST_MEMORY
+    match_err!(pipe.get_info(
+        param_name,
+        param_value_size,
+        param_value,
+        param_value_size_ret,
+    ))
 }
 
 extern "C" fn cl_svm_alloc(
index 4b7372c..b52c1bd 100644 (file)
@@ -1604,3 +1604,10 @@ pub fn enqueue_migrate_mem_objects(
 
     //• CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for the specified set of memory objects in mem_objects.
 }
+
+impl CLInfo<cl_pipe_info> for cl_mem {
+    fn query(&self, _q: cl_pipe_info, _: &[u8]) -> CLResult<Vec<u8>> {
+        // CL_INVALID_MEM_OBJECT if pipe is a not a valid pipe object.
+        Err(CL_INVALID_MEM_OBJECT)
+    }
+}
index 633672d..44d2c85 100644 (file)
@@ -133,7 +133,7 @@ rusticl_opencl_bindings_rs = rust.bindgen(
     '--whitelist-type', 'cl_.*',
     '--whitelist-var', 'CL_.*',
     # some info types need to be strongly typed so we can implement various get_infos
-    '--new-type-alias-deref', 'cl_(mem|image)_info',
+    '--new-type-alias-deref', 'cl_(mem|image|pipe)_info',
     '--new-type-alias-deref', 'cl_kernel_(arg|work_group)_info',
     '--new-type-alias-deref', 'cl_(event|profiling)_info',
   ],