pub struct GpuMemoryBudget {
pub limits: GpuMemoryLimits,
pub allocated_bytes: u64,
pub storage_bindings_used: u32,
}Expand description
Tracks GPU buffer allocations and enforces limits.
Fields§
§limits: GpuMemoryLimits§allocated_bytes: u64Total bytes currently allocated across all buffers.
storage_bindings_used: u32Number of storage buffer bindings in use.
Implementations§
Source§impl GpuMemoryBudget
impl GpuMemoryBudget
pub fn new(limits: GpuMemoryLimits) -> Self
Sourcepub fn webgpu_default() -> Self
pub fn webgpu_default() -> Self
WebGPU default limits.
Sourcepub fn check_buffer(&self, size_bytes: u64) -> Result<(), MemoryError>
pub fn check_buffer(&self, size_bytes: u64) -> Result<(), MemoryError>
Check if a buffer allocation would exceed limits.
Sourcepub fn check_storage_binding(&self) -> Result<(), MemoryError>
pub fn check_storage_binding(&self) -> Result<(), MemoryError>
Check if a storage binding can be added.
Sourcepub fn check_workgroup(
&self,
size: [u32; 3],
count: [u32; 3],
) -> Result<(), MemoryError>
pub fn check_workgroup( &self, size: [u32; 3], count: [u32; 3], ) -> Result<(), MemoryError>
Check workgroup configuration validity.
Sourcepub fn estimate_orbital_grid_memory(
&self,
n_basis: usize,
grid_points: usize,
max_primitives_per_basis: usize,
) -> Result<OrbitalGridMemoryEstimate, MemoryError>
pub fn estimate_orbital_grid_memory( &self, n_basis: usize, grid_points: usize, max_primitives_per_basis: usize, ) -> Result<OrbitalGridMemoryEstimate, MemoryError>
Pre-flight check for an orbital grid computation.
Returns the estimated total GPU memory needed in bytes.
Sourcepub fn estimate_d4_dispersion_memory(
&self,
n_atoms: usize,
) -> Result<PairwiseMemoryEstimate, MemoryError>
pub fn estimate_d4_dispersion_memory( &self, n_atoms: usize, ) -> Result<PairwiseMemoryEstimate, MemoryError>
Estimate memory for D4 dispersion pairwise computation.
Sourcepub fn optimal_grid_dispatch(&self, dims: [u32; 3]) -> ([u32; 3], [u32; 3])
pub fn optimal_grid_dispatch(&self, dims: [u32; 3]) -> ([u32; 3], [u32; 3])
Compute optimal workgroup dispatch for a 3D grid.
Sourcepub fn optimal_1d_dispatch(&self, n: u32) -> (u32, u32)
pub fn optimal_1d_dispatch(&self, n: u32) -> (u32, u32)
Compute optimal workgroup dispatch for a 1D array.
Trait Implementations§
Source§impl Clone for GpuMemoryBudget
impl Clone for GpuMemoryBudget
Source§fn clone(&self) -> GpuMemoryBudget
fn clone(&self) -> GpuMemoryBudget
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GpuMemoryBudget
impl RefUnwindSafe for GpuMemoryBudget
impl Send for GpuMemoryBudget
impl Sync for GpuMemoryBudget
impl Unpin for GpuMemoryBudget
impl UnsafeUnpin for GpuMemoryBudget
impl UnwindSafe for GpuMemoryBudget
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.