Skip to main content

Pool

Enum Pool 

Source
pub enum Pool {
    Set(Residency),
    Copy(CopyPool),
}

Variants§

Implementations§

Source§

impl Pool

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn budget(&self) -> usize

Source

pub fn resident(&self) -> usize

Source

pub fn is_member(&self, rid: usize) -> bool

Source

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).

Source

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).

Source

pub fn bytes(&self) -> usize

Logical resident budget in bytes (low-bit slots are shorter).

Source

pub fn finish(&mut self, ctx: &MetalContext, rids: &[usize]) -> Result<()>

Records from acquire whose reads are done become usable.

Source

pub fn addr(&mut self, ctx: &MetalContext, rid: usize) -> Result<u64>

GPU address of a usable record.

Source

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> DropFlavorWrapper<T> for T

§

type Flavor = MayDrop

The DropFlavor that [wrap]s T into Self
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for T
where T: ?Sized,

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more