Skip to main content

TrackedCudaSlice

Struct TrackedCudaSlice 

Source
pub struct TrackedCudaSlice<T: DeviceRepr> { /* private fields */ }
Expand description

A typed view retaining its actual device allocation and memory budget.

Native owning slices cannot be extracted through a safe mutable borrow:

ⓘ
use xlog_cuda::memory::TrackedCudaSlice;
use cudarc::driver::CudaSlice;
fn native_owner(slice: &mut TrackedCudaSlice<u8>) -> &mut CudaSlice<u8> {
    slice
}

Device access must be prepared by XLOG; a passive allocation handle cannot bypass its access reservation through cudarc’s safe pointer API:

ⓘ
use xlog_cuda::memory::TrackedCudaSlice;
use cudarc::driver::DevicePtr;
fn native_read(slice: &TrackedCudaSlice<u8>) {
    fn accepts_native<T: DevicePtr<u8>>(_: &T) {}
    accepts_native(slice);
}

Implementations§

Source§

impl<T: DeviceRepr> TrackedCudaSlice<T>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn stream(&self) -> &Arc<CudaStream> ⓘ

Source

pub fn device_ptr(&self) -> &CUdeviceptr

Source

pub fn device_ptr_value(&self) -> CUdeviceptr

Source

pub fn view(&self) -> DeviceMemoryView<T>

A passive view retaining this allocation; obtaining it performs no device access.

Source

pub fn try_slice( &self, range: impl RangeBounds<usize>, ) -> Option<DeviceMemoryView<T>>

Source

pub fn slice(&self, range: impl RangeBounds<usize>) -> DeviceMemoryView<T>

Source

pub fn slice_mut( &mut self, range: impl RangeBounds<usize>, ) -> DeviceMemoryView<T>

Source

pub fn memory_manager_ptr_value(&self) -> usize

Stable address of the memory manager that owns this allocation.

Source

pub fn runtime_block(&self) -> Option<&DeviceBlock>

Runtime block identity, when present. Device-native and foreign owners have no runtime block ID but still participate in shared range admission.

Source

pub fn into_bytes(self) -> TrackedCudaSlice<u8>

Reinterpret this typed allocation as a raw byte allocation.

This is a zero-copy conversion used by XLOG’s columnar CudaBuffer representation, which stores device memory as untyped bytes + a schema. The conversion preserves the underlying [Backing] — runtime-routed slices remain runtime-routed, legacy cudarc slices remain cudarc-routed — so deallocation continues to match the original allocator.

Trait Implementations§

Auto Trait Implementations§

§

impl<T> Freeze for TrackedCudaSlice<T>

§

impl<T> RefUnwindSafe for TrackedCudaSlice<T>
where T: RefUnwindSafe,

§

impl<T> Send for TrackedCudaSlice<T>
where T: Send,

§

impl<T> Sync for TrackedCudaSlice<T>
where T: Sync,

§

impl<T> Unpin for TrackedCudaSlice<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for TrackedCudaSlice<T>

§

impl<T> UnwindSafe for TrackedCudaSlice<T>
where T: UnwindSafe,

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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