Native alloc, native free, get device id, etc. More...

Functions

AFAPI af_err af_memory_manager_get_active_device_id (af_memory_manager handle, int *id)
 Gets the id of the currently-active device. More...
 
AFAPI af_err af_memory_manager_native_alloc (af_memory_manager handle, void **ptr, size_t size)
 Allocates memory with a native memory function for the active backend. More...
 
AFAPI af_err af_memory_manager_native_free (af_memory_manager handle, void *ptr)
 Frees a pointer with a native memory function for the active backend. More...
 
AFAPI af_err af_memory_manager_get_max_memory_size (af_memory_manager handle, size_t *size, int id)
 Gets the maximum memory size for a managed device. More...
 
AFAPI af_err af_memory_manager_get_memory_pressure_threshold (af_memory_manager handle, float *value)
 Gets the memory pressure threshold for a memory manager. More...
 
AFAPI af_err af_memory_manager_set_memory_pressure_threshold (af_memory_manager handle, float value)
 Sets the memory pressure threshold for a memory manager. More...
 

Detailed Description

Native alloc, native free, get device id, etc.

Function Documentation

◆ af_memory_manager_get_active_device_id()

AFAPI af_err af_memory_manager_get_active_device_id ( af_memory_manager  handle,
int *  id 
)

Gets the id of the currently-active device.

Parameters
[in]handlethe af_memory_manager handle
[out]idthe id of the active device
Returns
AF_SUCCESS

◆ af_memory_manager_get_max_memory_size()

AFAPI af_err af_memory_manager_get_max_memory_size ( af_memory_manager  handle,
size_t *  size,
int  id 
)

Gets the maximum memory size for a managed device.

Parameters
[in]handlethe af_memory_manager handle
[out]sizethe max memory size for the device
[in]idthe device id
Returns
AF_SUCCESS

◆ af_memory_manager_get_memory_pressure_threshold()

AFAPI af_err af_memory_manager_get_memory_pressure_threshold ( af_memory_manager  handle,
float *  value 
)

Gets the memory pressure threshold for a memory manager.

Parameters
[in]handlethe af_memory_manager handle
[out]valuethe memory pressure threshold
Returns
AF_SUCCESS

◆ af_memory_manager_native_alloc()

AFAPI af_err af_memory_manager_native_alloc ( af_memory_manager  handle,
void **  ptr,
size_t  size 
)

Allocates memory with a native memory function for the active backend.

Parameters
[in]handlethe af_memory_manager handle
[out]ptrthe pointer to the allocated buffer (for the CUDA and CPU backends). For the OpenCL backend, this is a pointer to a cl_mem, which can be cast accordingly
[in]sizethe size of the pointer allocation
Returns
AF_SUCCESS

◆ af_memory_manager_native_free()

AFAPI af_err af_memory_manager_native_free ( af_memory_manager  handle,
void *  ptr 
)

Frees a pointer with a native memory function for the active backend.

Parameters
[in]handlethe af_memory_manager handle
[in]ptrthe pointer to free
Returns
AF_SUCCESS

◆ af_memory_manager_set_memory_pressure_threshold()

AFAPI af_err af_memory_manager_set_memory_pressure_threshold ( af_memory_manager  handle,
float  value 
)

Sets the memory pressure threshold for a memory manager.

The memory pressure threshold determines when the JIT tree evaluates based on how much memory usage there is. If the value returned by af_memory_manager_get_memory_pressure_fn exceeds the memory pressure threshold, the JIT will evaluate a subtree if generated kernels are valid.

Parameters
[in]handlethe af_memory_manager handle
[in]valuethe new threshold value
Returns
AF_SUCCESS