From 46c17a8e54bfd41fef8ded58188bab22d3e698ab Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Fri, 1 Sep 2023 11:10:28 +0200 Subject: [PATCH] rusticl/queue: properly implement clCreateCommandQueueWithProperties It didn't do any of the error checking, but it was supposed to be. Also the error checking was slightly wrong and we should return CL_INVALID_QUEUE_PROPERTIES instead of CL_INVALID_VALUE for unsupported properties. Signed-off-by: Karol Herbst Part-of: --- src/gallium/frontends/rusticl/api/queue.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/gallium/frontends/rusticl/api/queue.rs b/src/gallium/frontends/rusticl/api/queue.rs index d3a734a..01e8e11 100644 --- a/src/gallium/frontends/rusticl/api/queue.rs +++ b/src/gallium/frontends/rusticl/api/queue.rs @@ -41,8 +41,12 @@ impl CLInfo for cl_command_queue { } fn valid_command_queue_properties(properties: cl_command_queue_properties) -> bool { - let valid_flags = - cl_bitfield::from(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE); + let valid_flags = cl_bitfield::from( + CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE + | CL_QUEUE_PROFILING_ENABLE + | CL_QUEUE_ON_DEVICE + | CL_QUEUE_ON_DEVICE_DEFAULT, + ); properties & !valid_flags == 0 } @@ -110,9 +114,6 @@ fn create_command_queue_with_properties( device: cl_device_id, properties: *const cl_queue_properties, ) -> CLResult { - let c = context.get_arc()?; - let d = device.get_ref()?.to_static().ok_or(CL_INVALID_DEVICE)?; - let mut queue_properties = cl_command_queue_properties::default(); let properties = if properties.is_null() { None @@ -132,12 +133,7 @@ fn create_command_queue_with_properties( Some(properties) }; - Ok(cl_command_queue::from_arc(Queue::new( - c, - d, - queue_properties, - properties, - )?)) + create_command_queue_impl(context, device, queue_properties, properties) } #[cl_entrypoint] -- 2.7.4