diff --git a/crates/mesh-llm-commands/src/runtime_native/formatters.rs b/crates/mesh-llm-commands/src/runtime_native/formatters.rs index 31eff126de..3b9e9c1298 100644 --- a/crates/mesh-llm-commands/src/runtime_native/formatters.rs +++ b/crates/mesh-llm-commands/src/runtime_native/formatters.rs @@ -357,8 +357,33 @@ fn format_rejection(reason: &CandidateRejection) -> String { CandidateRejection::CudaProfileMissing => { "CUDA runtime requires CUDA, but no CUDA profile was detected".to_string() } - CandidateRejection::CudaToolkitMajorMismatch { required } => { - format!("CUDA toolkit mismatch: runtime requires CUDA {required}") + CandidateRejection::CudaToolkitMajorMismatch { + required, + installed, + } => { + let installed = installed + .iter() + .map(|major| major.to_string()) + .collect::>() + .join(", "); + format!( + "CUDA toolkit mismatch: runtime requires CUDA {required}, host has CUDA {installed} installed" + ) + } + CandidateRejection::CudaToolkitMajorAboveDriver { + required, + driver_max, + } => { + format!( + "CUDA driver too old: runtime requires CUDA {required}, driver supports up to CUDA {driver_max}" + ) + } + CandidateRejection::CudaToolkitNotDetected { required } => { + format!( + "no CUDA toolkit detected: runtime requires CUDA {required} libraries \ + (libcudart, libcublas, libcublasLt) on the loader path; \ + set MESH_LLM_CUDA_TOOLKIT_MAJORS if the toolkit is installed elsewhere" + ) } CandidateRejection::CudaGpuArchUnsupported { supported } => { format!( diff --git a/crates/mesh-llm-hardware-profile/src/lib.rs b/crates/mesh-llm-hardware-profile/src/lib.rs index d96cfdeace..095f9de054 100644 --- a/crates/mesh-llm-hardware-profile/src/lib.rs +++ b/crates/mesh-llm-hardware-profile/src/lib.rs @@ -4,6 +4,9 @@ use mesh_llm_native_runtime::{ NativeRuntimeBackendKind, }; use std::collections::{BTreeMap, BTreeSet}; +use std::fs; +use std::io::Read; +use std::path::{Path, PathBuf}; use std::process::Command; mod rocm; @@ -304,24 +307,224 @@ fn detect_cuda_profile(gpus: &[HostGpuProfile]) -> Option { toolkit_majors.insert(major); } if toolkit_majors.is_empty() { - toolkit_majors.extend(cuda_majors_from_nvidia_smi()); + toolkit_majors.extend(installed_cuda_toolkit_majors()); } + // `nvidia-smi` reports the newest CUDA the driver supports, which is often + // ahead of the installed toolkit. Keep it separate so it is only used as an + // upper bound during runtime selection. + let driver_max_major = env_u32("MESH_LLM_CUDA_DRIVER_MAX_MAJOR") + .or_else(|| cuda_majors_from_nvidia_smi().into_iter().next_back()); let mut gpu_arches = env_string_set("MESH_LLM_CUDA_GPU_ARCHES"); gpu_arches.extend(gpus.iter().filter_map(|gpu| gpu.cuda_sm.clone())); let has_cuda_label = gpus.iter().any(|gpu| { let label = gpu.display_name.to_ascii_lowercase(); label.contains("nvidia") || label.contains("cuda") }); - if toolkit_majors.is_empty() && gpu_arches.is_empty() && !has_cuda_label { + if toolkit_majors.is_empty() + && driver_max_major.is_none() + && gpu_arches.is_empty() + && !has_cuda_label + { return None; } Some(HostCudaProfile { toolkit_majors, + driver_max_major, driver_version: std::env::var("MESH_LLM_CUDA_DRIVER_VERSION").ok(), gpu_arches, }) } +/// CUDA toolkit majors that the dynamic loader can actually resolve on this +/// host. +/// +/// Linux native runtimes link `libcudart`/`libcublas`/`libcublasLt` without +/// bundling them, so a runtime only loads when the loader itself can find a +/// matching-major copy of all three. Deliberately probe the loader's own view +/// — the `ldconfig` cache and `LD_LIBRARY_PATH` — rather than guessing from +/// installation directory names: a `/usr/local/cuda-13` directory can exist +/// with no usable libraries, and a toolkit that the loader cannot see cannot +/// be loaded no matter where it lives. +fn installed_cuda_toolkit_majors() -> BTreeSet { + let mut evidence: BTreeMap = BTreeMap::new(); + if let Some(output) = command_output("ldconfig", &["-p"]) { + for line in output.lines() { + record_cuda_ldconfig_line(&mut evidence, line); + } + } + for dir in loader_search_dirs() { + let Ok(entries) = fs::read_dir(&dir) else { + continue; + }; + for entry in entries.flatten() { + let path = entry.path(); + record_cuda_soname_path(&mut evidence, &entry.file_name().to_string_lossy(), &path); + } + } + evidence + .into_iter() + .filter(|(_, found)| found.is_complete()) + .map(|(major, _)| major) + .collect() +} + +/// Directories the loader searches ahead of its cache, plus common CUDA roots. +fn loader_search_dirs() -> Vec { + let mut dirs = Vec::new(); + if let Some(value) = std::env::var_os("LD_LIBRARY_PATH") { + dirs.extend(std::env::split_paths(&value)); + } + for variable in ["CUDA_HOME", "CUDA_PATH", "CUDA_ROOT", "CONDA_PREFIX"] { + if let Some(root) = std::env::var_os(variable).filter(|value| !value.is_empty()) { + append_cuda_root_dirs(&mut dirs, Path::new(&root)); + } + } + append_cuda_roots_under(&mut dirs, Path::new("/usr/local")); + dirs.sort(); + dirs.dedup(); + dirs +} + +fn append_cuda_root_dirs(dirs: &mut Vec, root: &Path) { + dirs.push(root.to_path_buf()); + for suffix in [ + "lib64", + "lib", + "targets/x86_64-linux/lib", + "targets/aarch64-linux/lib", + ] { + dirs.push(root.join(suffix)); + } +} + +fn append_cuda_roots_under(dirs: &mut Vec, parent: &Path) { + let Ok(entries) = fs::read_dir(parent) else { + return; + }; + for entry in entries.flatten() { + let path = entry.path(); + let name = entry.file_name(); + if path.is_dir() && (name == "cuda" || name.to_string_lossy().starts_with("cuda-")) { + append_cuda_root_dirs(dirs, &path); + } + } +} + +/// Per-major record of which valid, current-architecture CUDA libraries were found. +#[derive(Default)] +struct CudaLibraryEvidence { + cudart: bool, + cublas: bool, + cublas_lt: bool, +} + +impl CudaLibraryEvidence { + /// A native runtime needs all three, so partial installs do not count. + fn is_complete(&self) -> bool { + self.cudart && self.cublas && self.cublas_lt + } +} + +fn record_cuda_ldconfig_line(evidence: &mut BTreeMap, line: &str) { + let Some((library, target)) = line.rsplit_once("=>") else { + return; + }; + let Some(name) = library.split_whitespace().next() else { + return; + }; + record_cuda_soname_path(evidence, name, Path::new(target.trim())); +} + +fn record_cuda_soname_path( + evidence: &mut BTreeMap, + token: &str, + path: &Path, +) { + let name = token.rsplit('/').next().unwrap_or(token); + // `libcublasLt.so.` is checked first so it is not shadowed by `libcublas`. + for prefix in ["libcudart.so.", "libcublasLt.so.", "libcublas.so."] { + let Some(rest) = name.strip_prefix(prefix) else { + continue; + }; + let Some(major) = leading_major_version(rest) else { + continue; + }; + if !valid_cuda_library_target(path) { + return; + } + let found = evidence.entry(major).or_default(); + match prefix { + "libcudart.so." => found.cudart = true, + "libcublasLt.so." => found.cublas_lt = true, + _ => found.cublas = true, + } + return; + } +} + +fn valid_cuda_library_target(path: &Path) -> bool { + let Ok(mut file) = fs::File::open(path) else { + return false; + }; + let mut bytes = [0_u8; 20]; + if file.read_exact(&mut bytes).is_err() || &bytes[..4] != b"\x7fELF" { + return false; + } + let machine = match bytes[5] { + 1 => u16::from_le_bytes([bytes[18], bytes[19]]), + 2 => u16::from_be_bytes([bytes[18], bytes[19]]), + _ => return false, + }; + let identity = (bytes[4], machine); + match current_elf_identity() { + Some(expected) => identity == expected, + None => true, + } +} + +fn current_elf_identity() -> Option<(u8, u16)> { + #[cfg(target_arch = "x86_64")] + { + Some((2, 62)) + } + #[cfg(target_arch = "aarch64")] + { + Some((2, 183)) + } + #[cfg(target_arch = "x86")] + { + Some((1, 3)) + } + #[cfg(target_arch = "arm")] + { + Some((1, 40)) + } + #[cfg(target_arch = "riscv64")] + { + Some((2, 243)) + } + #[cfg(target_arch = "powerpc64")] + { + Some((2, 21)) + } + #[cfg(target_arch = "s390x")] + { + Some((2, 22)) + } + #[cfg(not(any( + target_arch = "x86_64", + target_arch = "aarch64", + target_arch = "x86", + target_arch = "arm", + target_arch = "riscv64", + target_arch = "powerpc64", + target_arch = "s390x" + )))] + { + None + } +} + fn detect_rocm_profile(gpus: &[HostGpuProfile]) -> Option { let mut gpu_arches = env_string_set("MESH_LLM_ROCM_GPU_ARCHES"); gpu_arches.extend(rocm::gpu_arches()); @@ -638,6 +841,54 @@ mod tests { } } + fn write_minimal_elf(path: &Path, class: u8, machine: u16) { + let mut bytes = vec![0; 20]; + bytes[..4].copy_from_slice(b"\x7fELF"); + bytes[4] = class; + bytes[5] = 1; + bytes[18..20].copy_from_slice(&machine.to_le_bytes()); + fs::write(path, bytes).unwrap(); + } + + #[test] + fn cuda_library_probe_includes_custom_roots_and_rejects_invalid_targets() { + let Some((class, machine)) = current_elf_identity() else { + return; + }; + let root = std::env::temp_dir().join(format!("mesh-llm-cuda-probe-{}", std::process::id())); + let _ = fs::remove_dir_all(&root); + fs::create_dir_all(&root).unwrap(); + for name in ["libcudart.so.12", "libcublas.so.12", "libcublasLt.so.12"] { + write_minimal_elf(&root.join(name), class, machine); + } + for name in ["libcudart.so.13", "libcublas.so.13", "libcublasLt.so.13"] { + write_minimal_elf(&root.join(name), class, machine.wrapping_add(1)); + } + + let mut evidence = BTreeMap::new(); + for name in ["libcudart.so.12", "libcublas.so.12", "libcublasLt.so.12"] { + record_cuda_soname_path(&mut evidence, name, &root.join(name)); + } + record_cuda_soname_path(&mut evidence, "libcudart.so.12", &root.join("missing.so")); + for name in ["libcudart.so.13", "libcublas.so.13", "libcublasLt.so.13"] { + record_cuda_soname_path(&mut evidence, name, &root.join(name)); + } + + assert_eq!( + evidence + .into_iter() + .filter(|(_, evidence)| evidence.is_complete()) + .map(|(major, _)| major) + .collect::>(), + BTreeSet::from([12]) + ); + let mut custom_root_dirs = Vec::new(); + append_cuda_root_dirs(&mut custom_root_dirs, Path::new("/opt/cuda-12")); + assert!(custom_root_dirs.contains(&PathBuf::from("/opt/cuda-12/lib64"))); + assert!(custom_root_dirs.contains(&PathBuf::from("/opt/cuda-12/lib"))); + let _ = fs::remove_dir_all(root); + } + fn profile(label: &str) -> HostGpuProfile { HostGpuProfile { display_name: label.to_string(), diff --git a/crates/mesh-llm-native-runtime/README.md b/crates/mesh-llm-native-runtime/README.md index db07e2fe90..c1c0ffa163 100644 --- a/crates/mesh-llm-native-runtime/README.md +++ b/crates/mesh-llm-native-runtime/README.md @@ -126,6 +126,7 @@ let profile = HostRuntimeProfile { gpus: Vec::new(), cuda: Some(HostCudaProfile { toolkit_majors: BTreeSet::from([12]), + driver_max_major: Some(12), driver_version: None, gpu_arches: BTreeSet::from(["sm_90".to_string()]), }), @@ -137,8 +138,26 @@ let profile = HostRuntimeProfile { `mesh-llm-hardware-profile` builds this profile for real hosts. It supports explicit environment overrides for CI/release testing, including `MESH_LLM_CUDA_TOOLKIT_MAJOR`, `MESH_LLM_CUDA_TOOLKIT_MAJORS`, -`MESH_LLM_CUDA_GPU_ARCHES`, `MESH_LLM_ROCM_GPU_ARCHES`, and -`MESH_LLM_VULKAN_AVAILABLE`. +`MESH_LLM_CUDA_DRIVER_MAX_MAJOR`, `MESH_LLM_CUDA_GPU_ARCHES`, +`MESH_LLM_ROCM_GPU_ARCHES`, and `MESH_LLM_VULKAN_AVAILABLE`. + +### CUDA toolkit vs driver + +`toolkit_majors` and `driver_max_major` are deliberately separate: + +- `toolkit_majors` — CUDA majors whose runtime libraries are actually installed + (probed from `libcudart.so.` sonames and `/usr/local/cuda-`). +- `driver_max_major` — the newest CUDA the installed driver supports, from + `nvidia-smi`. This is an upper bound only. + +Linux native runtimes link `libcudart`/`libcublas` without bundling them, so +they can only load when a matching toolkit major is installed. Windows runtimes +ship their own copies and are self contained, so they are accepted on any driver +new enough to run them. + +Conflating the two selects a runtime the host cannot load. A CUDA 13 driver with +a CUDA 12 toolkit must still choose the cuda12 runtime, otherwise startup fails +with `libcudart.so.13: cannot open shared object file`. ## Resolution diff --git a/crates/mesh-llm-native-runtime/src/host.rs b/crates/mesh-llm-native-runtime/src/host.rs index 92823ccbe3..5c9daf7e77 100644 --- a/crates/mesh-llm-native-runtime/src/host.rs +++ b/crates/mesh-llm-native-runtime/src/host.rs @@ -30,8 +30,16 @@ pub struct HostGpuProfile { #[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)] pub struct HostCudaProfile { + /// CUDA toolkit majors whose runtime libraries are actually installed on + /// this host (for example `libcudart.so.12`). A runtime that does not ship + /// its own CUDA libraries can only load if its major appears here. #[serde(default)] pub toolkit_majors: BTreeSet, + /// Highest CUDA major the installed driver supports, as reported by + /// `nvidia-smi`. This is an upper bound, not evidence that a matching + /// toolkit is installed. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub driver_max_major: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub driver_version: Option, #[serde(default)] diff --git a/crates/mesh-llm-native-runtime/src/resolver.rs b/crates/mesh-llm-native-runtime/src/resolver.rs index d0f096e11b..76a1c8ff60 100644 --- a/crates/mesh-llm-native-runtime/src/resolver.rs +++ b/crates/mesh-llm-native-runtime/src/resolver.rs @@ -1,6 +1,6 @@ use crate::{ - HostRuntimeProfile, NativeRuntimeArtifact, NativeRuntimeBackendKind, NativeRuntimeCache, - NativeRuntimeReleaseManifest, + HostCudaProfile, HostRuntimeProfile, NativeRuntimeArtifact, NativeRuntimeBackendKind, + NativeRuntimeCache, NativeRuntimeReleaseManifest, }; use anyhow::{Result, bail}; use serde::{Deserialize, Serialize}; @@ -27,7 +27,9 @@ pub enum CandidateRejection { TargetTripleMismatch { expected: String, actual: String }, BackendNotSupported { backend: NativeRuntimeBackendKind }, CudaProfileMissing, - CudaToolkitMajorMismatch { required: u32 }, + CudaToolkitMajorMismatch { required: u32, installed: Vec }, + CudaToolkitMajorAboveDriver { required: u32, driver_max: u32 }, + CudaToolkitNotDetected { required: u32 }, CudaGpuArchUnsupported { supported: Vec }, RocmProfileMissing, RocmGpuArchUnsupported { supported: Vec }, @@ -403,11 +405,7 @@ fn evaluate_cuda_requirements( reasons.push(CandidateRejection::CudaProfileMissing); return; }; - if !cuda.toolkit_majors.contains(&requirements.toolkit_major) { - reasons.push(CandidateRejection::CudaToolkitMajorMismatch { - required: requirements.toolkit_major, - }); - } + evaluate_cuda_toolkit_major(artifact, requirements.toolkit_major, cuda, reasons); if !requirements.gpu_arches.is_empty() && requirements .gpu_arches @@ -420,6 +418,81 @@ fn evaluate_cuda_requirements( } } +/// A CUDA runtime can only load if the CUDA runtime libraries it links against +/// are present. Runtimes that ship their own copies (Windows) are self +/// contained; runtimes that do not (Linux) need a matching toolkit major +/// installed on the host. +/// +/// `nvidia-smi` reports the highest CUDA major the *driver* supports, which is +/// routinely newer than the installed toolkit. Treat it as an upper bound only, +/// so a CUDA 13 driver with a CUDA 12 toolkit still selects the cuda12 runtime. +fn evaluate_cuda_toolkit_major( + artifact: &NativeRuntimeArtifact, + required: u32, + cuda: &HostCudaProfile, + reasons: &mut Vec, +) { + if let Some(driver_max) = cuda.driver_max_major + && required > driver_max + { + reasons.push(CandidateRejection::CudaToolkitMajorAboveDriver { + required, + driver_max, + }); + return; + } + + if artifact_bundles_cuda_runtime(artifact) { + return; + } + + // Host-linked runtime with no detected toolkit: reject rather than guess. + // + // Accepting here would let a driver-only profile pick a runtime whose + // libraries cannot be resolved, which is exactly the failure this check + // exists to prevent. A wrong choice surfaces as a bare + // `libcudart.so.: cannot open shared object file` at load; refusing + // instead keeps the reason visible and actionable. Hosts with a toolkit + // installed somewhere the loader cannot see it can set + // `MESH_LLM_CUDA_TOOLKIT_MAJORS`. + if cuda.toolkit_majors.is_empty() { + reasons.push(CandidateRejection::CudaToolkitNotDetected { required }); + return; + } + + if !cuda.toolkit_majors.contains(&required) { + reasons.push(CandidateRejection::CudaToolkitMajorMismatch { + required, + installed: cuda.toolkit_majors.iter().copied().collect(), + }); + } +} + +/// True when the artifact ships the CUDA runtime libraries it links against and +/// therefore does not depend on a host toolkit. +/// +/// Requires the complete set the runtime loads (`cudart`, `cublas`, +/// `cublasLt`). A single bundled library does not make an artifact self +/// contained: shipping `cudart` alone still leaves `cublas` to the host. +fn artifact_bundles_cuda_runtime(artifact: &NativeRuntimeArtifact) -> bool { + let mut cudart = false; + let mut cublas = false; + let mut cublas_lt = false; + for library in &artifact.libraries { + let name = library.rsplit('/').next().unwrap_or(library).to_lowercase(); + let name = name.strip_prefix("lib").unwrap_or(&name); + // `cublaslt` is checked first so it is not shadowed by `cublas`. + if name.starts_with("cublaslt") { + cublas_lt = true; + } else if name.starts_with("cublas") { + cublas = true; + } else if name.starts_with("cudart") { + cudart = true; + } + } + cudart && cublas && cublas_lt +} + fn evaluate_rocm_requirements( artifact: &NativeRuntimeArtifact, profile: &HostRuntimeProfile, @@ -542,6 +615,7 @@ mod tests { gpus: Vec::new(), cuda: Some(HostCudaProfile { toolkit_majors: BTreeSet::from([12]), + driver_max_major: Some(12), driver_version: None, gpu_arches: BTreeSet::from(["sm_90".to_string()]), }), @@ -635,6 +709,148 @@ mod tests { ); } + /// A CUDA 13 driver with only a CUDA 12 toolkit installed must still select + /// the cuda12 runtime. Linux runtimes do not bundle `libcudart`, so + /// selecting cuda13 here fails at load with + /// `libcudart.so.13: cannot open shared object file`. + #[test] + fn newer_driver_with_older_toolkit_selects_installed_toolkit_runtime() { + let mut host = profile(); + let cuda = host.cuda.as_mut().unwrap(); + cuda.toolkit_majors = BTreeSet::from([12]); + cuda.driver_max_major = Some(13); + + let manifest = NativeRuntimeReleaseManifest { + mesh_version: "0.68.0".to_string(), + skippy_abi: "0.1.25".to_string(), + artifacts: vec![ + cuda_runtime("meshllm-runtime-linux-x86_64-cuda12", 12, &["sm_90"]), + cuda_runtime("meshllm-runtime-linux-x86_64-cuda13", 13, &["sm_90"]), + ], + }; + + let selected = + select_native_runtime(&manifest, &host, "0.68.0", &RuntimeSelection::Recommended) + .unwrap(); + + assert_eq!(selected.artifact.id, "meshllm-runtime-linux-x86_64-cuda12"); + } + + /// Runtimes that ship their own CUDA libraries (Windows) do not depend on a + /// host toolkit, so a newer driver must not reject them. Regression test for + /// the silent Vulkan fallback in #1127. + #[test] + fn self_contained_cuda_runtime_is_accepted_on_newer_driver() { + let mut host = profile(); + host.os = "windows".to_string(); + let cuda = host.cuda.as_mut().unwrap(); + cuda.toolkit_majors = BTreeSet::new(); + cuda.driver_max_major = Some(13); + + let mut bundled = cuda_runtime("meshllm-runtime-windows-x86_64-cuda12", 12, &["sm_90"]); + bundled.platform.os = "windows".to_string(); + bundled.libraries.extend([ + "lib/cudart64_12.dll".to_string(), + "lib/cublas64_12.dll".to_string(), + "lib/cublasLt64_12.dll".to_string(), + ]); + + let manifest = NativeRuntimeReleaseManifest { + mesh_version: "0.68.0".to_string(), + skippy_abi: "0.1.25".to_string(), + artifacts: vec![bundled], + }; + + let selected = + select_native_runtime(&manifest, &host, "0.68.0", &RuntimeSelection::Recommended) + .unwrap(); + + assert_eq!( + selected.artifact.id, + "meshllm-runtime-windows-x86_64-cuda12" + ); + } + + /// Bundling only part of the CUDA library set does not make an artifact + /// self contained: `cublas` would still have to come from the host. + #[test] + fn partially_bundled_cuda_runtime_is_not_treated_as_self_contained() { + let mut host = profile(); + host.os = "windows".to_string(); + let cuda = host.cuda.as_mut().unwrap(); + cuda.toolkit_majors = BTreeSet::new(); + cuda.driver_max_major = Some(13); + + let mut partial = cuda_runtime("meshllm-runtime-windows-x86_64-cuda12", 12, &["sm_90"]); + partial.platform.os = "windows".to_string(); + partial.libraries.push("lib/cudart64_12.dll".to_string()); + + let manifest = NativeRuntimeReleaseManifest { + mesh_version: "0.68.0".to_string(), + skippy_abi: "0.1.25".to_string(), + artifacts: vec![partial], + }; + + assert!( + select_native_runtime(&manifest, &host, "0.68.0", &RuntimeSelection::Recommended) + .is_none() + ); + } + + /// A host-linked runtime must not be selected when no CUDA toolkit was + /// detected. Accepting on driver evidence alone reproduces the + /// `libcudart.so.: cannot open shared object file` failure. + #[test] + fn host_linked_runtime_is_rejected_without_detected_toolkit() { + let mut host = profile(); + let cuda = host.cuda.as_mut().unwrap(); + cuda.toolkit_majors = BTreeSet::new(); + cuda.driver_max_major = Some(13); + + let manifest = NativeRuntimeReleaseManifest { + mesh_version: "0.68.0".to_string(), + skippy_abi: "0.1.25".to_string(), + artifacts: vec![cuda_runtime( + "meshllm-runtime-linux-x86_64-cuda12", + 12, + &["sm_90"], + )], + }; + + assert!( + select_native_runtime(&manifest, &host, "0.68.0", &RuntimeSelection::Recommended) + .is_none() + ); + } + + /// The same host still falls back to CPU rather than being left with no + /// runtime at all. + #[test] + fn undetected_toolkit_falls_back_to_cpu_runtime() { + let mut host = profile(); + let cuda = host.cuda.as_mut().unwrap(); + cuda.toolkit_majors = BTreeSet::new(); + cuda.driver_max_major = Some(13); + + let manifest = NativeRuntimeReleaseManifest { + mesh_version: "0.68.0".to_string(), + skippy_abi: "0.1.25".to_string(), + artifacts: vec![ + artifact( + "meshllm-runtime-linux-x86_64-cpu", + NativeRuntimeBackend::cpu(), + ), + cuda_runtime("meshllm-runtime-linux-x86_64-cuda12", 12, &["sm_90"]), + ], + }; + + let selected = + select_native_runtime(&manifest, &host, "0.68.0", &RuntimeSelection::Recommended) + .unwrap(); + + assert_eq!(selected.artifact.id, "meshllm-runtime-linux-x86_64-cpu"); + } + #[test] fn unsupported_cuda_gpu_arch_is_rejected() { let manifest = NativeRuntimeReleaseManifest {