#[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
impl Clone for halide_device_interface_t
source§fn clone(&self) -> halide_device_interface_t
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for halide_device_interface_t
impl Debug for halide_device_interface_t
impl Copy for halide_device_interface_t
Auto Trait Implementations§
impl Freeze for halide_device_interface_t
impl RefUnwindSafe for halide_device_interface_t
impl !Send for halide_device_interface_t
impl !Sync for halide_device_interface_t
impl Unpin for halide_device_interface_t
impl UnwindSafe for halide_device_interface_t
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)