rusticl/device: allow enablement of fp64 via RUSTICL_FEATURES

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22649>
This commit is contained in:
Karol Herbst 2023-04-24 13:08:07 +02:00 committed by Marge Bot
parent b90d1cfbfe
commit cc0de56a0e
3 changed files with 11 additions and 5 deletions

View file

@ -915,6 +915,8 @@ Rusticl environment variables
a comma-separated list of features to enable. Those are disabled by default
as they might not be stable enough or break OpenCL conformance.
- ``fp64`` enables OpenCL double support
.. envvar:: RUSTICL_DEBUG
a comma-separated list of debug channels to enable.

View file

@ -1,6 +1,7 @@
use crate::api::icd::*;
use crate::api::util::*;
use crate::core::format::*;
use crate::core::platform::*;
use crate::core::util::*;
use crate::core::version::*;
use crate::impl_cl_type_trait;
@ -582,11 +583,11 @@ impl Device {
}
pub fn doubles_supported(&self) -> bool {
false
/*
if !Platform::features().fp64 {
return false;
}
self.screen.param(pipe_cap::PIPE_CAP_DOUBLES) == 1
*/
}
pub fn doubles_is_softfp(&self) -> bool {

View file

@ -21,7 +21,9 @@ pub struct PlatformDebug {
pub program: bool,
}
pub struct PlatformFeatures {}
pub struct PlatformFeatures {
pub fp64: bool,
}
static PLATFORM_ENV_ONCE: Once = Once::new();
static PLATFORM_ONCE: Once = Once::new();
@ -35,7 +37,7 @@ static mut PLATFORM: Platform = Platform {
devs: Vec::new(),
};
static mut PLATFORM_DBG: PlatformDebug = PlatformDebug { program: false };
static mut PLATFORM_FEATURES: PlatformFeatures = PlatformFeatures {};
static mut PLATFORM_FEATURES: PlatformFeatures = PlatformFeatures { fp64: false };
fn load_env() {
let debug = unsafe { &mut PLATFORM_DBG };
@ -52,6 +54,7 @@ fn load_env() {
if let Ok(feature_flags) = env::var("RUSTICL_FEATURES") {
for flag in feature_flags.split(',') {
match flag {
"fp64" => features.fp64 = true,
_ => eprintln!("Unknown RUSTICL_FEATURES flag found: {}", flag),
}
}