Halide 22.0.0 Halide compiler and libraries

Public Attributes | List of all members
halide_device_interface_t Struct Reference

Each GPU API provides a halide_device_interface_t struct pointing to the code that manages device allocations. More...

`#include <HalideRuntime.h>`

## Public Attributes
int(* | device_malloc )(void *user_context, struct halide_buffer_t *buf, const struct halide_device_interface_t *device_interface)
int(* | device_free )(void *user_context, struct halide_buffer_t *buf)
int(* | device_sync )(void *user_context, struct halide_buffer_t *buf)
void(* | device_release )(void *user_context, const struct halide_device_interface_t *device_interface)
int(* | copy_to_host )(void *user_context, struct halide_buffer_t *buf)
int(* | copy_to_device )(void *user_context, struct halide_buffer_t *buf, const struct halide_device_interface_t *device_interface)
int(* | device_and_host_malloc )(void *user_context, struct halide_buffer_t *buf, const struct halide_device_interface_t *device_interface)
int(* | device_and_host_free )(void *user_context, struct halide_buffer_t *buf)
int(* | buffer_copy )(void *user_context, struct halide_buffer_t *src, const struct halide_device_interface_t *dst_device_interface, struct halide_buffer_t *dst)
int(* | device_crop )(void *user_context, const struct halide_buffer_t *src, struct halide_buffer_t *dst)
int(* | device_slice )(void *user_context, const struct halide_buffer_t *src, int slice_dim, int slice_pos, struct halide_buffer_t *dst)
int(* | device_release_crop )(void *user_context, struct halide_buffer_t *buf)
int(* | wrap_native )(void *user_context, struct halide_buffer_t *buf, uint64_t handle, const struct halide_device_interface_t *device_interface)
int(* | detach_native )(void *user_context, struct halide_buffer_t *buf)
int(* | compute_capability )(void *user_context, int *major, int *minor)
const struct halide_device_interface_impl_t * | impl

## Detailed 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.

Definition at line 797 of file HalideRuntime.h.

## Member Data Documentation

## ◆ device_malloc

int(* halide_device_interface_t::device_malloc) (void *user_context, struct halide_buffer_t *buf, const struct halide_device_interface_t *device_interface)

Definition at line 798 of file HalideRuntime.h.

Referenced by Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::device_malloc().

## ◆ device_free

int(* halide_device_interface_t::device_free) (void *user_context, struct halide_buffer_t *buf)

Definition at line 800 of file HalideRuntime.h.

Referenced by Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::device_free().

## ◆ device_sync

int(* halide_device_interface_t::device_sync) (void *user_context, struct halide_buffer_t *buf)

Definition at line 801 of file HalideRuntime.h.

## ◆ device_release

void(* halide_device_interface_t::device_release) (void *user_context, const struct halide_device_interface_t *device_interface)

Definition at line 802 of file HalideRuntime.h.

## ◆ copy_to_host

int(* halide_device_interface_t::copy_to_host) (void *user_context, struct halide_buffer_t *buf)

Definition at line 804 of file HalideRuntime.h.

Referenced by Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::copy_to_host().

## ◆ copy_to_device

int(* halide_device_interface_t::copy_to_device) (void *user_context, struct halide_buffer_t *buf, const struct halide_device_interface_t *device_interface)

Definition at line 805 of file HalideRuntime.h.

Referenced by Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::copy_to_device().

## ◆ device_and_host_malloc

int(* halide_device_interface_t::device_and_host_malloc) (void *user_context, struct halide_buffer_t *buf, const struct halide_device_interface_t *device_interface)

Definition at line 807 of file HalideRuntime.h.

Referenced by Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::device_and_host_malloc().

## ◆ device_and_host_free

int(* halide_device_interface_t::device_and_host_free) (void *user_context, struct halide_buffer_t *buf)

Definition at line 809 of file HalideRuntime.h.

Referenced by Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::device_and_host_free().

## ◆ buffer_copy

int(* halide_device_interface_t::buffer_copy) (void *user_context, struct halide_buffer_t *src, const struct halide_device_interface_t *dst_device_interface, struct halide_buffer_t *dst)

Definition at line 810 of file HalideRuntime.h.

## ◆ device_crop

int(* halide_device_interface_t::device_crop) (void *user_context, const struct halide_buffer_t *src, struct halide_buffer_t *dst)

Definition at line 812 of file HalideRuntime.h.

## ◆ device_slice

int(* halide_device_interface_t::device_slice) (void *user_context, const struct halide_buffer_t *src, int slice_dim, int slice_pos, struct halide_buffer_t *dst)

Definition at line 814 of file HalideRuntime.h.

## ◆ device_release_crop

int(* halide_device_interface_t::device_release_crop) (void *user_context, struct halide_buffer_t *buf)

Definition at line 816 of file HalideRuntime.h.

## ◆ wrap_native

int(* halide_device_interface_t::wrap_native) (void *user_context, struct halide_buffer_t *buf, uint64_t handle, const struct halide_device_interface_t *device_interface)

Definition at line 817 of file HalideRuntime.h.

Referenced by Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::device_wrap_native().

## ◆ detach_native

int(* halide_device_interface_t::detach_native) (void *user_context, struct halide_buffer_t *buf)

Definition at line 819 of file HalideRuntime.h.

Referenced by Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::device_detach_native().

## ◆ compute_capability

int(* halide_device_interface_t::compute_capability) (void *user_context, int *major, int *minor)

Definition at line 820 of file HalideRuntime.h.

## ◆ impl

const struct halide_device_interface_impl_t* halide_device_interface_t::impl

Definition at line 821 of file HalideRuntime.h.

The documentation for this struct was generated from the following file:

- src/runtime/HalideRuntime.h