From fa99fc34914cef30a880913d21b7724bd8202f4e Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sat, 12 Nov 2022 17:10:59 +0100 Subject: [PATCH] rusticl: advertise conformance on 12th Intel iGPUs Submission can be found here: https://www.khronos.org/conformance/adopters/conformant-products/opencl#submission_405 Signed-off-by: Karol Herbst Hard-reviewed-by: Alyssa Rosenzweig Reviewed-by: Erik Faye-Lund Acked-by: Jordan Justen Part-of: --- src/gallium/drivers/iris/iris_screen.c | 14 ++++++++++++++ src/gallium/frontends/rusticl/api/device.rs | 4 +++- src/gallium/frontends/rusticl/mesa/pipe/screen.rs | 19 +++++++++++++++++++ src/gallium/include/pipe/p_screen.h | 7 +++++++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index 500fec8..3ee6114 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -143,6 +143,19 @@ iris_get_name(struct pipe_screen *pscreen) return buf; } +static const char * +iris_get_cl_cts_version(struct pipe_screen *pscreen) +{ + struct iris_screen *screen = (struct iris_screen *)pscreen; + const struct intel_device_info *devinfo = &screen->devinfo; + + /* https://www.khronos.org/conformance/adopters/conformant-products/opencl#submission_405 */ + if (devinfo->verx10 == 120) + return "v2022-04-22-00"; + + return NULL; +} + static int iris_get_video_memory(struct iris_screen *screen) { @@ -867,6 +880,7 @@ iris_screen_create(int fd, const struct pipe_screen_config *config) pscreen->get_name = iris_get_name; pscreen->get_vendor = iris_get_vendor; pscreen->get_device_vendor = iris_get_device_vendor; + pscreen->get_cl_cts_version = iris_get_cl_cts_version; pscreen->get_param = iris_get_param; pscreen->get_shader_param = iris_get_shader_param; pscreen->get_compute_param = iris_get_compute_param; diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs index cabe3bf..21d4ab3 100644 --- a/src/gallium/frontends/rusticl/api/device.rs +++ b/src/gallium/frontends/rusticl/api/device.rs @@ -89,7 +89,9 @@ impl CLInfo for cl_device_id { CL_DEVICE_IMAGE3D_MAX_HEIGHT => cl_prop::(dev.image_3d_size()), CL_DEVICE_IMAGE3D_MAX_WIDTH => cl_prop::(dev.image_3d_size()), CL_DEVICE_IMAGE3D_MAX_DEPTH => cl_prop::(dev.image_3d_size()), - CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED => cl_prop::<&str>("v0000-01-01-00"), + CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED => { + cl_prop::<&CStr>(dev.screen().cl_cts_version()) + } CL_DEVICE_LINKER_AVAILABLE => cl_prop::(true), CL_DEVICE_LOCAL_MEM_SIZE => cl_prop::(dev.local_mem_size()), // TODO add query for CL_LOCAL vs CL_GLOBAL diff --git a/src/gallium/frontends/rusticl/mesa/pipe/screen.rs b/src/gallium/frontends/rusticl/mesa/pipe/screen.rs index 37bd1b8..cba0646 100644 --- a/src/gallium/frontends/rusticl/mesa/pipe/screen.rs +++ b/src/gallium/frontends/rusticl/mesa/pipe/screen.rs @@ -8,6 +8,7 @@ use mesa_rust_gen::*; use mesa_rust_util::string::*; use std::convert::TryInto; +use std::ffi::CStr; use std::mem::size_of; use std::os::raw::c_void; use std::ptr; @@ -238,6 +239,24 @@ impl PipeScreen { unsafe { *self.ldev.ldev }.type_ } + pub fn cl_cts_version(&self) -> &CStr { + unsafe { + let s = *self.screen; + + let ptr = s + .get_cl_cts_version + .map_or(ptr::null(), |get_cl_cts_version| { + get_cl_cts_version(self.screen) + }); + if ptr.is_null() { + // this string is good enough to pass the CTS + CStr::from_bytes_with_nul(b"v0000-01-01-00\0").unwrap() + } else { + CStr::from_ptr(ptr) + } + } + } + pub fn is_format_supported( &self, format: pipe_format, diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index bf7002c..3ee2687 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -113,6 +113,13 @@ struct pipe_screen { const char *(*get_device_vendor)(struct pipe_screen *); /** + * Returns the latest OpenCL CTS version passed + * + * The returned value should be the git tag used when passing conformance. + */ + const char *(*get_cl_cts_version)(struct pipe_screen *); + + /** * Query an integer-valued capability/parameter/limit * \param param one of PIPE_CAP_x */ -- 2.7.4