Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
HalideRuntimeHexagonHost.h File Reference

Routines specific to the Halide Hexagon host-side runtime. More...

#include "HalideRuntime.h"

Go to the source code of this file.

Classes

struct  halide_hexagon_power_t
 More detailed power settings to control Hexagon. More...
 

Macros

#define HALIDE_RUNTIME_HEXAGON
 

Typedefs

typedef int halide_hexagon_handle_t
 
typedef enum halide_hexagon_power_mode_t halide_hexagon_power_mode_t
 Power modes for Hexagon.
 
typedef halide_hexagon_power_t halide_hvx_power_perf_t
 

Enumerations

enum  halide_hexagon_power_mode_t {
  halide_hexagon_power_low = 0 , halide_hexagon_power_nominal = 1 , halide_hexagon_power_turbo = 2 , halide_hexagon_power_default = 3 ,
  halide_hexagon_power_low_plus = 4 , halide_hexagon_power_low_2 = 5 , halide_hexagon_power_nominal_plus = 6 , halide_hvx_power_low = halide_hexagon_power_low ,
  halide_hvx_power_nominal = halide_hexagon_power_nominal , halide_hvx_power_turbo = halide_hexagon_power_turbo , halide_hvx_power_default = halide_hexagon_power_default
}
 Power modes for Hexagon. More...
 

Functions

const struct halide_device_interface_thalide_hexagon_device_interface ()
 
bool halide_is_hexagon_available (void *user_context)
 Check if the Hexagon runtime (libhalide_hexagon_host.so) is available.
 
int halide_hexagon_wrap_device_handle (void *user_context, struct halide_buffer_t *buf, void *ptr, uint64_t size)
 The device handle for Hexagon is simply a pointer and size, stored in the dev field of the halide_buffer_t.
 
int halide_hexagon_detach_device_handle (void *user_context, struct halide_buffer_t *buf)
 Disconnect this halide_buffer_t from the device handle it was previously wrapped around.
 
void * halide_hexagon_get_device_handle (void *user_context, struct halide_buffer_t *buf)
 Return the underlying device handle for a halide_buffer_t.
 
uint64_t halide_hexagon_get_device_size (void *user_context, struct halide_buffer_t *buf)
 
void * halide_hexagon_get_module_state (void *user_context, void **host)
 Return a pointer to the module_state.
 
int halide_hexagon_power_hvx_on (void *user_context)
 Power HVX on and off.
 
int halide_hexagon_power_hvx_off (void *user_context)
 
void halide_hexagon_power_hvx_off_as_destructor (void *user_context, void *)
 
int halide_hexagon_set_performance_mode (void *user_context, halide_hexagon_power_mode_t mode)
 Set a performance target for Hexagon.
 
int halide_hexagon_set_performance (void *user_context, halide_hexagon_power_t *perf)
 
int halide_hexagon_set_thread_priority (void *user_context, int priority)
 Set the default priority for Halide Hexagon user threads:
 
int halide_hexagon_initialize_kernels (void *user_context, void **module_ptr, const uint8_t *code, uint64_t code_size, const uint8_t *runtime, uint64_t runtime_size)
 These are forward declared here to allow clients to override the Halide Hexagon runtime.
 
int halide_hexagon_run (void *user_context, void *module_ptr, const char *name, halide_hexagon_handle_t *function, uint64_t arg_sizes[], void *args[], int arg_flags[])
 
void halide_hexagon_finalize_kernels (void *user_context, void *state_ptr)
 
int halide_hexagon_device_release (void *user_context)
 

Detailed Description

Routines specific to the Halide Hexagon host-side runtime.

Definition in file HalideRuntimeHexagonHost.h.

Macro Definition Documentation

◆ HALIDE_RUNTIME_HEXAGON

#define HALIDE_RUNTIME_HEXAGON

Definition at line 19 of file HalideRuntimeHexagonHost.h.

Typedef Documentation

◆ halide_hexagon_handle_t

Definition at line 21 of file HalideRuntimeHexagonHost.h.

◆ halide_hexagon_power_mode_t

Power modes for Hexagon.

◆ halide_hvx_power_perf_t

Enumeration Type Documentation

◆ halide_hexagon_power_mode_t

Power modes for Hexagon.

Enumerator
halide_hexagon_power_low 
halide_hexagon_power_nominal 
halide_hexagon_power_turbo 
halide_hexagon_power_default 
halide_hexagon_power_low_plus 

Resets power to its default state.

halide_hexagon_power_low_2 
halide_hexagon_power_nominal_plus 
halide_hvx_power_low 
halide_hvx_power_nominal 
halide_hvx_power_turbo 
halide_hvx_power_default 

Definition at line 69 of file HalideRuntimeHexagonHost.h.

Function Documentation

◆ halide_hexagon_device_interface()

const struct halide_device_interface_t * halide_hexagon_device_interface ( )
extern

◆ halide_is_hexagon_available()

bool halide_is_hexagon_available ( void * user_context)
extern

Check if the Hexagon runtime (libhalide_hexagon_host.so) is available.

If it is not, pipelines using Hexagon will fail.

◆ halide_hexagon_wrap_device_handle()

int halide_hexagon_wrap_device_handle ( void * user_context,
struct halide_buffer_t * buf,
void * ptr,
uint64_t size )
extern

The device handle for Hexagon is simply a pointer and size, stored in the dev field of the halide_buffer_t.

If the buffer is allocated in a particular way (ion_alloc), the buffer will be shared with Hexagon (not copied). The device field of the halide_buffer_t must be NULL when this routine is called. This call can fail due to running out of memory or being passed an invalid device handle. The device and host dirty bits are left unmodified.

◆ halide_hexagon_detach_device_handle()

int halide_hexagon_detach_device_handle ( void * user_context,
struct halide_buffer_t * buf )
extern

Disconnect this halide_buffer_t from the device handle it was previously wrapped around.

Should only be called for a halide_buffer_t that halide_hexagon_wrap_device_handle was previously called on. Frees any storage associated with the binding of the halide_buffer_t and the device handle, but does not free the device handle. The device field of the halide_buffer_t will be NULL on return.

◆ halide_hexagon_get_device_handle()

void * halide_hexagon_get_device_handle ( void * user_context,
struct halide_buffer_t * buf )
extern

Return the underlying device handle for a halide_buffer_t.

If there is no device memory (dev field is NULL), this returns 0.

◆ halide_hexagon_get_device_size()

uint64_t halide_hexagon_get_device_size ( void * user_context,
struct halide_buffer_t * buf )
extern

◆ halide_hexagon_get_module_state()

void * halide_hexagon_get_module_state ( void * user_context,
void ** host )
extern

Return a pointer to the module_state.

◆ halide_hexagon_power_hvx_on()

int halide_hexagon_power_hvx_on ( void * user_context)
extern

Power HVX on and off.

Calling a Halide pipeline will do this automatically on each pipeline invocation; however, it costs a small but possibly significant amount of time for short running pipelines. To avoid this cost, HVX can be powered on prior to running several pipelines, and powered off afterwards. If HVX is powered on, subsequent calls to power HVX on will be cheap.

◆ halide_hexagon_power_hvx_off()

int halide_hexagon_power_hvx_off ( void * user_context)
extern

◆ halide_hexagon_power_hvx_off_as_destructor()

void halide_hexagon_power_hvx_off_as_destructor ( void * user_context,
void *  )
extern

◆ halide_hexagon_set_performance_mode()

int halide_hexagon_set_performance_mode ( void * user_context,
halide_hexagon_power_mode_t mode )
extern

Set a performance target for Hexagon.

Hexagon applications can vote for the performance levels they want, which may or may not be respected by Hexagon. Applications should be careful not to leave Hexagon in a high power state for too long. These functions can significantly increase standby power consumption. Use halide_hexagon_power_default to reset performance to the default power state.

◆ halide_hexagon_set_performance()

int halide_hexagon_set_performance ( void * user_context,
halide_hexagon_power_t * perf )
extern

◆ halide_hexagon_set_thread_priority()

int halide_hexagon_set_thread_priority ( void * user_context,
int priority )
extern

Set the default priority for Halide Hexagon user threads:

  • Valid priority values range from 1 to 255
  • Smaller number for higher priority
  • The highest priority for a user thread is 1
  • Priority 0 is reserved for OS usage If this routine is not called, the priority will default to 100. This is intended to be called before dispatching any pipeline.

◆ halide_hexagon_initialize_kernels()

int halide_hexagon_initialize_kernels ( void * user_context,
void ** module_ptr,
const uint8_t * code,
uint64_t code_size,
const uint8_t * runtime,
uint64_t runtime_size )
extern

These are forward declared here to allow clients to override the Halide Hexagon runtime.

Do not call them.

◆ halide_hexagon_run()

int halide_hexagon_run ( void * user_context,
void * module_ptr,
const char * name,
halide_hexagon_handle_t * function,
uint64_t arg_sizes[],
void * args[],
int arg_flags[] )
extern

◆ halide_hexagon_finalize_kernels()

void halide_hexagon_finalize_kernels ( void * user_context,
void * state_ptr )
extern

◆ halide_hexagon_device_release()

int halide_hexagon_device_release ( void * user_context)
extern