pub struct RocmMemoryBackend { /* private fields */ }Expand description
ROCm memory backend implementation
Implementations§
Source§impl RocmMemoryBackend
impl RocmMemoryBackend
Sourcepub fn new(config: RocmConfig) -> Result<Self, RocmError>
pub fn new(config: RocmConfig) -> Result<Self, RocmError>
Create new ROCm backend
Sourcepub fn allocate(
&mut self,
size: usize,
memory_type: RocmMemoryType,
) -> Result<*mut c_void, RocmError>
pub fn allocate( &mut self, size: usize, memory_type: RocmMemoryType, ) -> Result<*mut c_void, RocmError>
Allocate device memory
Sourcepub fn free(
&mut self,
ptr: *mut c_void,
memory_type: RocmMemoryType,
) -> Result<(), RocmError>
pub fn free( &mut self, ptr: *mut c_void, memory_type: RocmMemoryType, ) -> Result<(), RocmError>
Free device memory
Sourcepub fn memcpy(
&mut self,
dst: *mut c_void,
src: *const c_void,
size: usize,
kind: RocmMemcpyKind,
) -> Result<(), RocmError>
pub fn memcpy( &mut self, dst: *mut c_void, src: *const c_void, size: usize, kind: RocmMemcpyKind, ) -> Result<(), RocmError>
Copy memory
Sourcepub fn memcpy_async(
&mut self,
dst: *mut c_void,
src: *const c_void,
size: usize,
kind: RocmMemcpyKind,
stream_id: u32,
) -> Result<(), RocmError>
pub fn memcpy_async( &mut self, dst: *mut c_void, src: *const c_void, size: usize, kind: RocmMemcpyKind, stream_id: u32, ) -> Result<(), RocmError>
Asynchronous memory copy
Sourcepub fn create_context(
&mut self,
flags: HipContextFlags,
) -> Result<u32, RocmError>
pub fn create_context( &mut self, flags: HipContextFlags, ) -> Result<u32, RocmError>
Create HIP context
Sourcepub fn get_device_properties(&self) -> &RocmDeviceProperties
pub fn get_device_properties(&self) -> &RocmDeviceProperties
Get device properties
Sourcepub fn device_synchronize(&mut self) -> Result<(), RocmError>
pub fn device_synchronize(&mut self) -> Result<(), RocmError>
Synchronize device
Sourcepub fn query_memory_attributes(
&self,
ptr: *mut c_void,
) -> Result<RocmMemoryAttributes, RocmError>
pub fn query_memory_attributes( &self, ptr: *mut c_void, ) -> Result<RocmMemoryAttributes, RocmError>
Query memory attributes
Trait Implementations§
impl Send for RocmMemoryBackend
impl Sync for RocmMemoryBackend
Auto Trait Implementations§
impl Freeze for RocmMemoryBackend
impl RefUnwindSafe for RocmMemoryBackend
impl Unpin for RocmMemoryBackend
impl UnsafeUnpin for RocmMemoryBackend
impl UnwindSafe for RocmMemoryBackend
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> 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