pub struct DeviceArena { /* private fields */ }Expand description
Power-of-two bucketed free list of f64 device slices.
Allocations round the requested element count up to the next
usize::next_power_of_two. On drop the slab is handed back to the
arena under the same bucket via DeviceArena::release. Held under
a Mutex by every backend that uses it because large-scale fits
dispatch from multiple rayon workers; the mutex is only held during
alloc / release, never across kernel launches.
Implementations§
Source§impl DeviceArena
impl DeviceArena
pub fn bucket_of(elements: usize) -> usize
Sourcepub fn alloc(
&mut self,
stream: &Arc<CudaStream>,
elements: usize,
label: &'static str,
) -> Result<(usize, CudaSlice<f64>), GpuError>
pub fn alloc( &mut self, stream: &Arc<CudaStream>, elements: usize, label: &'static str, ) -> Result<(usize, CudaSlice<f64>), GpuError>
Allocate a device slice of at least elements f64s. Returns the
bucket size actually allocated so the caller can release into the
same bucket on drop. label is woven into the error message if
the underlying alloc_zeros fails so failures stay attributable
to the originating backend (matching the pre-extraction wording).
pub fn release(&mut self, bucket: usize, slab: CudaSlice<f64>)
Trait Implementations§
Source§impl Default for DeviceArena
impl Default for DeviceArena
Source§fn default() -> DeviceArena
fn default() -> DeviceArena
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DeviceArena
impl RefUnwindSafe for DeviceArena
impl Send for DeviceArena
impl Sync for DeviceArena
impl Unpin for DeviceArena
impl UnsafeUnpin for DeviceArena
impl UnwindSafe for DeviceArena
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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 more