pub struct CubeclStorageHandle { /* private fields */ }Expand description
Device-resident buffer handle for CubeCL-backed tensors.
Holds:
- A
cubecl::server::Handlepointing to GPU memory. - An
Arc<CubeRuntime>so the device client stays alive. len: element count (f32elements).ordinal: device ordinal.
This is the concrete type stored inside StorageBuffer::Cubecl for XPU
tensors. Constructed by upload_f32.
Implementations§
Source§impl CubeclStorageHandle
impl CubeclStorageHandle
Sourcepub fn from_raw(
handle: Handle,
runtime: Arc<CubeRuntime>,
len: usize,
ordinal: usize,
) -> Self
pub fn from_raw( handle: Handle, runtime: Arc<CubeRuntime>, len: usize, ordinal: usize, ) -> Self
Construct a handle from a raw cubecl::server::Handle returned by a
kernel launcher.
Used by ferrotorch-xpu’s wrap_result_handle to turn the
(cubecl::server::Handle, shape) pair from portable_* into a
CubeclStorageHandle without an extra H2D upload. Issue #673.
Sourcepub fn raw_handle(&self) -> &Handle
pub fn raw_handle(&self) -> &Handle
Borrow the raw cubecl::server::Handle.
Used by ops.rs to pass handles directly to kernel launchers without
an extra H2D upload. Issue #673.
Sourcepub fn runtime(&self) -> &Arc<CubeRuntime>
pub fn runtime(&self) -> &Arc<CubeRuntime>
Borrow the CubeRuntime this handle belongs to.
Trait Implementations§
Source§impl CubeStorageHandle for CubeclStorageHandle
impl CubeStorageHandle for CubeclStorageHandle
Source§fn read_to_host(&self) -> FerrotorchResult<Vec<f32>>
fn read_to_host(&self) -> FerrotorchResult<Vec<f32>>
Read the buffer contents back to the host as
Vec<f32>. Read moreSource§fn clone_handle(&self) -> Box<dyn CubeStorageHandle>
fn clone_handle(&self) -> Box<dyn CubeStorageHandle>
Clone the handle (allocate a new device buffer with the same contents).
Auto Trait Implementations§
impl !RefUnwindSafe for CubeclStorageHandle
impl !UnwindSafe for CubeclStorageHandle
impl Freeze for CubeclStorageHandle
impl Send for CubeclStorageHandle
impl Sync for CubeclStorageHandle
impl Unpin for CubeclStorageHandle
impl UnsafeUnpin for CubeclStorageHandle
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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