pub struct Residency {
set: Retained<ProtocolObject<dyn MTLResidencySet>>,
base: *const u8,
stride: usize,
bufs: Vec<Option<Retained<ProtocolObject<dyn MTLBuffer>>>>,
member_pos: Vec<u32>,
members: Vec<u32>,
last_used: Vec<u64>,
dirty: bool,
pub budget: usize,
}Fields§
§set: Retained<ProtocolObject<dyn MTLResidencySet>>§base: *const u8§stride: usize§bufs: Vec<Option<Retained<ProtocolObject<dyn MTLBuffer>>>>§member_pos: Vec<u32>Position in members, or u32::MAX when not in the set.
members: Vec<u32>§last_used: Vec<u64>Step of last use per record (LRU key; also the eviction guard).
dirty: boolRecords added to the set object since the last commit.
budget: usizeImplementations§
Source§impl Residency
impl Residency
pub fn new( ctx: &MetalContext, base: *const u8, stride: usize, n_records: usize, budget: usize, ) -> Result<Self>
pub fn resident(&self) -> usize
pub fn is_member(&self, rid: usize) -> bool
Sourcepub fn buf(
&mut self,
ctx: &MetalContext,
rid: usize,
) -> Result<Retained<ProtocolObject<dyn MTLBuffer>>>
pub fn buf( &mut self, ctx: &MetalContext, rid: usize, ) -> Result<Retained<ProtocolObject<dyn MTLBuffer>>>
The record’s sub-buffer (wrapped on first use).
Sourcepub fn addr(&mut self, ctx: &MetalContext, rid: usize) -> Result<u64>
pub fn addr(&mut self, ctx: &MetalContext, rid: usize) -> Result<u64>
GPU address of the record.
Sourcepub fn acquire(
&mut self,
ctx: &MetalContext,
rids: &[usize],
step: u64,
) -> Result<Vec<usize>>
pub fn acquire( &mut self, ctx: &MetalContext, rids: &[usize], step: u64, ) -> Result<Vec<usize>>
This method reserves membership for the step’s records, evicting the
least recently used members outside the step as needed. It returns
records that still need to be read and added. Call finish once their
pages are in memory.
fn evict_one(&mut self, ctx: &MetalContext, step: u64) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Residency
impl !Sync for Residency
impl !UnwindSafe for Residency
impl Freeze for Residency
impl Unpin for Residency
impl UnsafeUnpin for Residency
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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