mesh-llm-native-runtime
Shared native runtime manifest, host profile, resolver, cache, and load-plan policy for MeshLLM.
This crate is the source of truth for selecting native runtimes. CLI install, SDK serving install, dynamic loading, and autoupdate should all use this same contract instead of carrying their own CUDA/ROCm/Vulkan detection logic.
Native Runtimes
A native runtime is a release artifact containing patched llama.cpp/Skippy
shared libraries for one platform/backend lane. The mesh-llm binary can stay
one artifact per OS/architecture; native runtimes carry the backend-specific
matrix:
cpumetalcudawith a CUDA toolkit major such as 12 or 13rocmwith optional GFX targetsvulkan
The hard compatibility boundary is exact Skippy ABI. mesh_version is still
recorded and used for cache/prune layout, but a runtime is selected by
skippy_abi, platform, and backend requirements.
Artifact Manifest
Each packaged runtime directory contains manifest.json:
CPU uses:
"backend":
ROCm uses:
"backend":
Important fields:
id: stable runtime ID used for explicit selection and cache paths.skippy_abi: exact ABI version required by the loader.platform: OS/arch/optional Rust target triple.backend: structured backend requirements.rank: optional rank adjustment. Higher compatible ranks win.libraries: runtime-relative load-order library paths.urlandsha256: populated in release manifests for downloads.
Release Manifest
Release jobs publish native-runtimes.json:
Host Profile
Selection evaluates artifacts against HostRuntimeProfile:
use ;
use BTreeSet;
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.
Resolution
Use NativeRuntimeResolver when the caller needs both the selected artifact and
where it should come from:
use ;
use PathBuf;
#
Selection strings accepted by RuntimeSelection::parse:
recommendedcpumetalcudacuda12cuda13rocmvulkanexact:<runtime-id>
Compatibility checks:
- exact Skippy ABI
- OS/arch/target triple
- backend kind support
- CUDA toolkit major
- CUDA SM architecture
- ROCm GFX architecture
- Vulkan availability
- explicit selection policy
Every candidate is returned in NativeRuntimeResolution::evaluated with
structured rejection reasons for mesh-llm runtime list, mesh-llm doctor, SDK
diagnostics, and support output.
Cache Layout
Installed runtimes are stored under:
<cache-root>/<mesh_version>/<runtime-id>/
manifest.json
lib/...
mesh_version remains part of the cache layout and prune policy so upgrading
MeshLLM can install the newly selected runtime, switch to it, and remove older
runtime caches after success.
Load Plan Boundary
This crate does not load dynamic libraries. InstalledNativeRuntime::load_plan
validates runtime.libraries and returns absolute paths for the Skippy FFI
loader:
#
Packaging
Package and verify a runtime:
Linux runtime packages must be relocatable from the installed cache. Packaged
ELF shared libraries use $ORIGIN in their runtime search path so sibling
libraries under lib/ resolve without requiring users, CI, or SDK smoke tests to
set LD_LIBRARY_PATH. The package verifier rejects absolute build or CI
RPATH/RUNPATH entries and checks packaged Linux dependencies with
LD_LIBRARY_PATH removed from the environment.
CUDA lanes use MESH_LLM_CUDA_TOOLKIT_MAJOR to emit IDs such as cuda12 or
cuda13. --backend cuda-blackwell defaults to cuda13-sm120.
Generate the release manifest: