pub struct GpuRuntime {
pub device: GpuDeviceInfo,
pub devices: Vec<GpuDeviceInfo>,
pub policy: GpuDispatchPolicy,
pub memory_budget_bytes: usize,
}Fields§
§device: GpuDeviceInfoHighest-scoring probed CUDA device. Existing dispatch code routes one-shot kernels through this device.
devices: Vec<GpuDeviceInfo>All usable CUDA devices discovered at probe time, ordered by score.
policy: GpuDispatchPolicy§memory_budget_bytes: usizeImplementations§
Source§impl GpuRuntime
impl GpuRuntime
pub fn probe() -> Result<GpuAvailability, GpuError>
Sourcepub fn availability() -> Result<GpuAvailabilityRef<'static>, GpuError>
pub fn availability() -> Result<GpuAvailabilityRef<'static>, GpuError>
Return the cached probe outcome without collapsing faults into absence.
Sourcepub fn resolve(policy: GpuPolicy) -> Result<Option<&'static Self>, GpuError>
pub fn resolve(policy: GpuPolicy) -> Result<Option<&'static Self>, GpuError>
Resolve CUDA under an explicit policy. Ok(None) is reserved for a
genuine absence under Auto/Off; probe faults always remain Err, and
Required converts absence into RequiredDeviceUnavailable.
Sourcepub fn require() -> Result<&'static Self, GpuError>
pub fn require() -> Result<&'static Self, GpuError>
Resolve CUDA under Required semantics and return the device handle.
Sourcepub fn resolve_if_fused_batch_exceeds_floor(
policy: GpuPolicy,
rows: usize,
) -> Result<Option<&'static Self>, GpuError>
pub fn resolve_if_fused_batch_exceeds_floor( policy: GpuPolicy, rows: usize, ) -> Result<Option<&'static Self>, GpuError>
Size-gated Self::resolve for independent fused row kernels.
Batches below
GpuDispatchPolicy::MIN_CALIBRATABLE_FUSED_KERNEL_N cannot be
admitted by either the default or any device-calibrated policy. Refuse
them before availability resolution so a CPU-sized first call does not
create CUDA contexts and run calibration merely to learn that it should
stay on the CPU. At and above the universal floor, the concrete
runtime’s calibrated policy remains authoritative.
pub fn policy(&self) -> &GpuDispatchPolicy
pub fn selected_device(&self) -> &GpuDeviceInfo
Source§impl GpuRuntime
impl GpuRuntime
Sourcepub fn device_ordinals(&self) -> Vec<usize>
pub fn device_ordinals(&self) -> Vec<usize>
Ordinals of all usable devices, highest-score first.
self.devices is already score-sorted at probe time, so this simply
projects out the ordinals. Empty only if the probe somehow produced no
devices (the public probe() guarantees at least one on Ok(Some(_))).
Sourcepub fn device_count(&self) -> usize
pub fn device_count(&self) -> usize
Number of usable devices in the pool.
Sourcepub fn memory_budget_for(&self, ordinal: usize) -> usize
pub fn memory_budget_for(&self, ordinal: usize) -> usize
Per-device byte budget: free memory capped at half of total, matching the
primary-device budget computed in device_runtime::probe. Falls back to the
primary memory_budget_bytes when the ordinal is not in the pool so a
caller that passes a stale ordinal still gets a usable (conservative)
budget rather than zero.
Trait Implementations§
Source§impl Clone for GpuRuntime
impl Clone for GpuRuntime
Source§fn clone(&self) -> GpuRuntime
fn clone(&self) -> GpuRuntime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GpuRuntime
impl RefUnwindSafe for GpuRuntime
impl Send for GpuRuntime
impl Sync for GpuRuntime
impl Unpin for GpuRuntime
impl UnsafeUnpin for GpuRuntime
impl UnwindSafe for GpuRuntime
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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