Struct mnn::ffi::halide_device_interface_t

source ·
#[repr(C)]
pub struct halide_device_interface_t {
Show 14 fields pub device_malloc: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: *const halide_device_interface_t) -> i32>, pub device_free: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>, pub device_sync: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>, pub device_release: Option<unsafe extern "C" fn(_: *mut c_void, _: *const halide_device_interface_t)>, pub copy_to_host: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>, pub copy_to_device: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: *const halide_device_interface_t) -> i32>, pub device_and_host_malloc: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: *const halide_device_interface_t) -> i32>, pub device_and_host_free: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>, pub buffer_copy: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: *const halide_device_interface_t, _: *mut halide_buffer_t) -> i32>, pub device_crop: Option<unsafe extern "C" fn(_: *mut c_void, _: *const halide_buffer_t, _: *mut halide_buffer_t) -> i32>, pub device_release_crop: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>, pub wrap_native: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: u64, _: *const halide_device_interface_t) -> i32>, pub detach_native: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>, pub impl_: *const halide_device_interface_impl_t,
}
Expand description

Each GPU API provides a halide_device_interface_t struct pointing to the code that manages device allocations. You can access these functions directly from the struct member function pointers, or by calling the functions declared below. Note that the global functions are not available when using Halide as a JIT compiler. If you are using raw halide_buffer_t in that context you must use the function pointers in the device_interface struct.

The function pointers below are currently the same for every GPU API; only the impl field varies. These top-level functions do the bookkeeping that is common across all GPU APIs, and then dispatch to more API-specific functions via another set of function pointers hidden inside the impl field.

Fields§

§device_malloc: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: *const halide_device_interface_t) -> i32>§device_free: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>§device_sync: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>§device_release: Option<unsafe extern "C" fn(_: *mut c_void, _: *const halide_device_interface_t)>§copy_to_host: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>§copy_to_device: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: *const halide_device_interface_t) -> i32>§device_and_host_malloc: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: *const halide_device_interface_t) -> i32>§device_and_host_free: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>§buffer_copy: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: *const halide_device_interface_t, _: *mut halide_buffer_t) -> i32>§device_crop: Option<unsafe extern "C" fn(_: *mut c_void, _: *const halide_buffer_t, _: *mut halide_buffer_t) -> i32>§device_release_crop: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>§wrap_native: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t, _: u64, _: *const halide_device_interface_t) -> i32>§detach_native: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut halide_buffer_t) -> i32>§impl_: *const halide_device_interface_impl_t

Trait Implementations§

source§

impl Clone for halide_device_interface_t

source§

fn clone(&self) -> halide_device_interface_t

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for halide_device_interface_t

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Copy for halide_device_interface_t

Auto Trait Implementations§

Blanket Implementations§

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> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.