From fc30fe2c110f2fcfcec38b3bf6edbf3802050413 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Thu, 17 Mar 2022 17:55:34 +0100 Subject: [PATCH] rusticl/kernel: add missing preprocessor definitions Signed-off-by: Karol Herbst Acked-by: Alyssa Rosenzweig Part-of: --- src/gallium/frontends/rusticl/core/program.rs | 6 ++++++ src/gallium/frontends/rusticl/core/version.rs | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/gallium/frontends/rusticl/core/program.rs b/src/gallium/frontends/rusticl/core/program.rs index 0c123a405a9..e927366d835 100644 --- a/src/gallium/frontends/rusticl/core/program.rs +++ b/src/gallium/frontends/rusticl/core/program.rs @@ -58,9 +58,15 @@ struct ProgramDevBuild { fn prepare_options(options: &str, dev: &Device) -> Vec { let mut options = options.to_owned(); + if !options.contains("-cl-std=CL") { + options.push_str(" -cl-std=CL"); + options.push_str(dev.clc_version.api_str()); + } if !dev.image_supported() { options.push_str(" -U__IMAGE_SUPPORT__"); } + options.push_str(" -D__OPENCL_VERSION__="); + options.push_str(dev.cl_version.clc_str()); options .split_whitespace() .map(|a| match a { diff --git a/src/gallium/frontends/rusticl/core/version.rs b/src/gallium/frontends/rusticl/core/version.rs index 1c3375690dc..c615b441c35 100644 --- a/src/gallium/frontends/rusticl/core/version.rs +++ b/src/gallium/frontends/rusticl/core/version.rs @@ -60,6 +60,18 @@ impl CLVersion { CLVersion::Cl3_0 => "3.0", } } + + pub fn clc_str(&self) -> &'static str { + match self { + CLVersion::Cl1_0 => "100", + CLVersion::Cl1_1 => "110", + CLVersion::Cl1_2 => "120", + CLVersion::Cl2_0 => "200", + CLVersion::Cl2_1 => "210", + CLVersion::Cl2_2 => "220", + CLVersion::Cl3_0 => "300", + } + } } impl TryFrom for CLVersion {