From 069c122b4899d95468bdf2156d9f6645b47c9d14 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Thu, 17 Mar 2022 23:48:47 +0100 Subject: [PATCH] rusticl: advertize CL 1.1 and CL 1.2 extensions That leads us stright to CL 3.0 Signed-off-by: Karol Herbst Acked-by: Alyssa Rosenzweig Part-of: --- src/gallium/frontends/rusticl/core/device.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index 79afe84..1404fe9 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -315,7 +315,16 @@ impl Device { exts_str.push(ext.to_owned()); }; + // add extensions all drivers support add_ext(1, 0, 0, "cl_khr_byte_addressable_store"); + add_ext(1, 0, 0, "cl_khr_global_int32_base_atomics"); + add_ext(1, 0, 0, "cl_khr_global_int32_extended_atomics"); + add_ext(1, 0, 0, "cl_khr_local_int32_base_atomics"); + add_ext(1, 0, 0, "cl_khr_local_int32_extended_atomics"); + + if self.doubles_supported() { + add_ext(1, 0, 0, "cl_khr_fp64"); + } self.extensions = exts; self.extension_string = exts_str.join(" "); @@ -356,6 +365,19 @@ impl Device { }) as cl_device_type } + pub fn doubles_supported(&self) -> bool { + if self.screen.param(pipe_cap::PIPE_CAP_DOUBLES) == 0 { + return false; + } + let nir_options = self + .screen + .nir_shader_compiler_options(pipe_shader_type::PIPE_SHADER_COMPUTE); + !bit_check( + unsafe { *nir_options }.lower_doubles_options as u32, + nir_lower_doubles_options::nir_lower_fp64_full_software as u32, + ) + } + pub fn global_mem_size(&self) -> cl_ulong { self.screen .compute_param(pipe_compute_cap::PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE) @@ -486,7 +508,7 @@ impl Device { pub fn cl_features(&self) -> clc_optional_features { clc_optional_features { fp16: false, - fp64: false, + fp64: self.doubles_supported(), int64: false, images: self.image_supported(), images_read_write: false, -- 2.7.4