pub struct GpuAcceleratedOps { /* private fields */ }Expand description
GPU-accelerated operations manager
This provides a high-level interface for GPU-accelerated tensor operations, automatically selecting the best implementation based on available hardware.
Implementations§
Source§impl GpuAcceleratedOps
impl GpuAcceleratedOps
Sourcepub fn new(config: GpuOpsConfig) -> Result<Self>
pub fn new(config: GpuOpsConfig) -> Result<Self>
Create new GPU-accelerated operations manager
Sourcepub fn matmul(&self, a: &Tensor, b: &Tensor) -> Result<Tensor>
pub fn matmul(&self, a: &Tensor, b: &Tensor) -> Result<Tensor>
Matrix multiplication with GPU acceleration
Sourcepub fn batch_matmul(&self, a: &Tensor, b: &Tensor) -> Result<Tensor>
pub fn batch_matmul(&self, a: &Tensor, b: &Tensor) -> Result<Tensor>
Batch matrix multiplication
Sourcepub fn flash_attention(
&self,
query: &Tensor,
key: &Tensor,
value: &Tensor,
scale: f32,
mask: Option<&Tensor>,
) -> Result<Tensor>
pub fn flash_attention( &self, query: &Tensor, key: &Tensor, value: &Tensor, scale: f32, mask: Option<&Tensor>, ) -> Result<Tensor>
Flash attention implementation
Sourcepub fn layer_norm(
&self,
input: &Tensor,
gamma: &Tensor,
beta: &Tensor,
epsilon: f32,
) -> Result<Tensor>
pub fn layer_norm( &self, input: &Tensor, gamma: &Tensor, beta: &Tensor, epsilon: f32, ) -> Result<Tensor>
Layer normalization with GPU acceleration
Sourcepub fn reduce_sum(&self, input: &Tensor, dim: usize) -> Result<Tensor>
pub fn reduce_sum(&self, input: &Tensor, dim: usize) -> Result<Tensor>
Reduce sum with GPU acceleration
Sourcepub fn softmax(&self, input: &Tensor, dim: usize) -> Result<Tensor>
pub fn softmax(&self, input: &Tensor, dim: usize) -> Result<Tensor>
Softmax with GPU acceleration
Sourcepub fn is_gpu_available(&self) -> bool
pub fn is_gpu_available(&self) -> bool
Check if GPU acceleration is available
Sourcepub fn get_backend(&self) -> GpuBackend
pub fn get_backend(&self) -> GpuBackend
Get current GPU backend
Sourcepub fn synchronize(&self) -> Result<()>
pub fn synchronize(&self) -> Result<()>
Synchronize GPU operations
Auto Trait Implementations§
impl Freeze for GpuAcceleratedOps
impl RefUnwindSafe for GpuAcceleratedOps
impl Send for GpuAcceleratedOps
impl Sync for GpuAcceleratedOps
impl Unpin for GpuAcceleratedOps
impl UnsafeUnpin for GpuAcceleratedOps
impl UnwindSafe for GpuAcceleratedOps
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> 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