Skip to main content

CompressedDeviceBuffer

Struct CompressedDeviceBuffer 

Source
pub struct CompressedDeviceBuffer { /* private fields */ }
Expand description

Host-side descriptor for a compressed device allocation.

Tracks the logical size, the physically reserved (granularity-aligned) size, and an observed compression ratio that the application can update as it learns how compressible its data is. The descriptor never owns a GPU pointer here — that is filled in by the device-gated path — but it provides the bandwidth and footprint accounting that callers use to decide whether compression is worthwhile.

The compression ratio is defined as physical / effective: a ratio of 2.0 means the data occupies half its physical footprint over the memory bus, doubling effective bandwidth for that region.

Implementations§

Source§

impl CompressedDeviceBuffer

Source

pub fn new(plan: CompressionPlan) -> Self

Creates a descriptor for a freshly planned compressed buffer.

The compression ratio starts at 1.0 (no measured compression yet).

Source

pub fn alloc( requested_bytes: usize, support: CompressionSupport, ) -> CudaResult<Self>

Builds a descriptor directly from a request, applying capability gating and granularity alignment in one step.

§Errors

Forwards errors from CompressionPlan::new.

Source

pub fn plan(&self) -> CompressionPlan

Returns the underlying allocation plan.

Source

pub fn compression_type(&self) -> CompressionType

Returns the compression type recorded for this buffer.

Source

pub fn logical_bytes(&self) -> usize

The logical (requested) size in bytes.

Source

pub fn physical_bytes(&self) -> usize

The physical (granularity-aligned) footprint in bytes.

Source

pub fn set_ratio(&mut self, ratio: f64)

Records an observed compression ratio (physical / effective).

Values below 1.0 are clamped to 1.0 (data cannot expand under lossless compression as far as bus traffic is concerned). Non-finite inputs are ignored.

Source

pub fn ratio(&self) -> f64

Returns the recorded compression ratio (>= 1.0).

Source

pub fn effective_bus_bytes(&self) -> usize

The effective number of bytes that traverse the memory bus given the recorded compression ratio.

Equal to physical_bytes / ratio, rounded down. With a ratio of 1.0 this equals the physical footprint.

Source

pub fn effective_bandwidth_gbps(&self, dram_gbps: f64) -> f64

Estimates the effective bandwidth seen by a transfer of this buffer’s physical footprint, given a raw dram_gbps DRAM bandwidth.

Because compression reduces bus traffic by ratio, the effective bandwidth observed for compressible data is dram_gbps * ratio. Non-positive bandwidth returns 0.0.

Source

pub fn bytes_saved(&self) -> usize

The number of physical bytes saved on the bus relative to an uncompressed transfer (physical - effective).

Trait Implementations§

Source§

impl Clone for CompressedDeviceBuffer

Source§

fn clone(&self) -> CompressedDeviceBuffer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CompressedDeviceBuffer

Source§

impl Debug for CompressedDeviceBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CompressedDeviceBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CompressedDeviceBuffer

Source§

fn eq(&self, other: &CompressedDeviceBuffer) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for CompressedDeviceBuffer

Auto Trait Implementations§

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

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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