pub enum Pool {
Set(Residency),
Copy(CopyPool),
}Variants§
Implementations§
Source§impl Pool
impl Pool
Sourcepub fn new(
ctx: &MetalContext,
base: *const u8,
stride: usize,
slot_stride: usize,
n_records: usize,
budget: usize,
copy: bool,
) -> Result<Self>
pub fn new( ctx: &MetalContext, base: *const u8, stride: usize, slot_stride: usize, n_records: usize, budget: usize, copy: bool, ) -> Result<Self>
budget records over the mapping at base; copy selects the
wired-copy backing (allocation may fail: the caller shrinks).
slot_stride is the pitch of a pool slot, which is the low-bit
record stride when every record is low-bit (more slots in the same
wired budget); stride stays the 4-bit stride for file offsets.
Sourcepub fn set_low_bit_store(
&mut self,
file: File,
low_stride: usize,
default_kind: u8,
)
pub fn set_low_bit_store( &mut self, file: File, low_stride: usize, default_kind: u8, )
Attach a low-bit store (copy pool only): its file and record
stride. With default_kind non-zero every slot holds a low-bit
record, so nothing reads the 4-bit file.
Sourcepub fn kind(&self, rid: usize) -> u8
pub fn kind(&self, rid: usize) -> u8
Which store a record’s slot holds (0 = 4-bit, 1 = 3-bit, 2 = 2-bit); 0 when not resident or not a copy pool.
Sourcepub fn set_kind(&mut self, rid: usize, kind: u8)
pub fn set_kind(&mut self, rid: usize, kind: u8)
Choose the store for a record acquired this step (before
plan_reads); copy pool only.
Sourcepub fn store_file<'a>(&'a self, original: &'a File, kind: u8) -> &'a File
pub fn store_file<'a>(&'a self, original: &'a File, kind: u8) -> &'a File
Store backing a prefill ring read. Its precision is also used to select the GEMM, so compressed bytes never reach a Q4 kernel.
pub fn budget(&self) -> usize
pub fn resident(&self) -> usize
pub fn is_member(&self, rid: usize) -> bool
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>>
Mark records used this step and reserve room for them, evicting
least recently used records not used this step. Returns the
records that still have to be read (plan_reads, run the plan,
then finish).
Sourcepub fn plan_reads(&self, need: &[usize]) -> (ReadPlan, usize)
pub fn plan_reads(&self, need: &[usize]) -> (ReadPlan, usize)
The reads for records returned by acquire, and how many of them
need none (their pages are still in memory).
Sourcepub fn finish(&mut self, ctx: &MetalContext, rids: &[usize]) -> Result<()>
pub fn finish(&mut self, ctx: &MetalContext, rids: &[usize]) -> Result<()>
Records from acquire whose reads are done become usable.
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 a usable record.
Sourcepub fn buf(
&mut self,
ctx: &MetalContext,
rid: usize,
) -> Result<(Retained<ProtocolObject<dyn MTLBuffer>>, usize)>
pub fn buf( &mut self, ctx: &MetalContext, rid: usize, ) -> Result<(Retained<ProtocolObject<dyn MTLBuffer>>, usize)>
A usable record as (buffer, byte offset) for binding.
Auto Trait Implementations§
impl !RefUnwindSafe for Pool
impl !Send for Pool
impl !Sync for Pool
impl !UnwindSafe for Pool
impl Freeze for Pool
impl Unpin for Pool
impl UnsafeUnpin for Pool
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
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>
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