mod accelerate;
#[allow(clippy::module_inception)]
mod backend;
mod coverage;
mod cuda;
mod formula;
mod fused;
mod manifest;
mod metal;
mod numerics;
mod service;
mod task;
#[cfg(any(
all(feature = "accelerate", target_os = "macos"),
all(feature = "cuda", target_os = "linux")
))]
mod operand;
mod simd;
mod stablehlo;
pub use backend::{Backend, BackendUnavailable};
pub use coverage::{Coverage, Dispatch, Fidelity};
pub use formula::{Formula, Precision};
pub use numerics::Numerics;
pub use service::Service;
pub use task::MapTask;
pub(crate) use numerics::NumericsScope;
use task::Task;
pub(crate) fn offered<T: Task>(task: &T) -> Option<T::Product> {
let required = numerics::current().fidelity();
for &backend in T::FORMULA.chain(T::PRECISION) {
if !backend.coverage(T::FORMULA).meets(required) {
continue;
}
if let Some(product) = task.offer(backend) {
service::note(T::FORMULA, T::PRECISION, Some(backend));
return Some(product);
}
}
service::note(T::FORMULA, T::PRECISION, None);
None
}
#[cfg(test)]
#[path = "tests/chain_tests.rs"]
mod tests;