[feat] introduce Config for centralized runtime settings; refactor progress management and backend selection to leverage config

This commit is contained in:
2025-08-12 02:57:42 +02:00
parent ee67b56d6b
commit 9120e8fb26
4 changed files with 63 additions and 19 deletions

View File

@@ -226,7 +226,7 @@ pub struct SelectionResult {
/// guidance on how to enable it.
///
/// Set `verbose` to true to print detection/selection info to stderr.
pub fn select_backend(requested: BackendKind, verbose: bool) -> Result<SelectionResult> {
pub fn select_backend(requested: BackendKind, config: &crate::Config) -> Result<SelectionResult> {
let mut detected = Vec::new();
if cuda_available() {
detected.push(BackendKind::Cuda);
@@ -290,7 +290,7 @@ pub fn select_backend(requested: BackendKind, verbose: bool) -> Result<Selection
BackendKind::Cpu => BackendKind::Cpu,
};
if verbose {
if config.verbose >= 1 && !config.quiet {
crate::dlog!(1, "Detected backends: {:?}", detected);
crate::dlog!(1, "Selected backend: {:?}", chosen);
}