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>
impl<T: DeviceRepr> TrackedCudaSlice<T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn stream(&self) -> &Arc<CudaStream> ⓘ
pub fn device_ptr(&self) -> &CUdeviceptr
pub fn device_ptr_value(&self) -> CUdeviceptr
Sourcepub fn view(&self) -> DeviceMemoryView<T>
pub fn view(&self) -> DeviceMemoryView<T>
A passive view retaining this allocation; obtaining it performs no device access.
pub fn try_slice( &self, range: impl RangeBounds<usize>, ) -> Option<DeviceMemoryView<T>>
pub fn slice(&self, range: impl RangeBounds<usize>) -> DeviceMemoryView<T>
pub fn slice_mut( &mut self, range: impl RangeBounds<usize>, ) -> DeviceMemoryView<T>
Sourcepub fn memory_manager_ptr_value(&self) -> usize
pub fn memory_manager_ptr_value(&self) -> usize
Stable address of the memory manager that owns this allocation.
Sourcepub fn runtime_block(&self) -> Option<&DeviceBlock>
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.
Sourcepub fn into_bytes(self) -> TrackedCudaSlice<u8>
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.