#[non_exhaustive]pub struct RuntimeConfig {
pub model_dir: Option<PathBuf>,
pub ort_dylib: Option<PathBuf>,
pub intra_threads: usize,
pub sessions_per_model: usize,
}Expand description
How the shared layer resolves files and sizes its pools.
§Threads
intra_threads x sessions_per_model x the caller’s page parallelism
should not exceed the cores; one caller-facing thread budget (later, the
CLI’s --threads) drives both numbers. There is no automatic pool sizing:
what is set here is what runs.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model_dir: Option<PathBuf>Explicit model dir; wins over the env var and the default. Model
files only: the runtime library never reads this field (see
resolve_ort_dylib).
ort_dylib: Option<PathBuf>Explicit ONNX Runtime library; wins over the env var and the default.
intra_threads: usizeONNX Runtime intra-op threads per session. Default 4.
sessions_per_model: usizeSessions per model: a pool so parallel pages/tables do not serialise
on one Mutex. Default 1. 0 is clamped to 1 (see below).
Implementations§
Source§impl RuntimeConfig
impl RuntimeConfig
Sourcepub fn with_model_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn with_model_dir(self, dir: impl Into<PathBuf>) -> Self
Set the explicit model dir; wins over everything.
Sourcepub fn with_ort_dylib(self, lib: impl Into<PathBuf>) -> Self
pub fn with_ort_dylib(self, lib: impl Into<PathBuf>) -> Self
Set the explicit ONNX Runtime library; wins over everything.
Sourcepub fn with_intra_threads(self, threads: usize) -> Self
pub fn with_intra_threads(self, threads: usize) -> Self
Set the ONNX Runtime intra-op threads per session.
Sourcepub fn with_sessions_per_model(self, sessions: usize) -> Self
pub fn with_sessions_per_model(self, sessions: usize) -> Self
Set the sessions per model.
A pool so parallel pages/tables do not serialise on one Mutex;
SharedSession::run blocks until a session is free. 0 would block
forever (a pool that can never hold a session), so it is clamped to 1
when the pool is built – the only automatic sizing in this module, and
a degenerate-input guard rather than a policy.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuntimeConfig
impl RefUnwindSafe for RuntimeConfig
impl Send for RuntimeConfig
impl Sync for RuntimeConfig
impl Unpin for RuntimeConfig
impl UnsafeUnpin for RuntimeConfig
impl UnwindSafe for RuntimeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more