Intel® oneAPI Deep Neural Network Developer Guide and Reference
Allocator
Overview
Definitions of allocator which is used to acquire memory resources in partition compilation and execution. More…
// typedefs
typedef void* (*dnnl_graph_host_allocate_f)(
    size_t size,
    size_t alignment
    );
typedef void (*dnnl_graph_host_deallocate_f)(void *);
typedef struct dnnl_graph_allocator* dnnl_graph_allocator_t;
typedef const struct dnnl_graph_allocator* const_dnnl_graph_allocator_t;
// classes
class dnnl::graph::allocator;
// global functions
dnnl_status_t DNNL_API dnnl_graph_allocator_create(
    dnnl_graph_allocator_t* allocator,
    dnnl_graph_host_allocate_f host_malloc,
    dnnl_graph_host_deallocate_f host_free
    );
dnnl_status_t DNNL_API dnnl_graph_allocator_destroy(dnnl_graph_allocator_t allocator); 
  Detailed Documentation
Definitions of allocator which is used to acquire memory resources in partition compilation and execution.
SYCL allocator (dnnl::graph::sycl_interop::make_allocator) should be used for SYCL runtime and host allocator should be used for non-SYCL.
Typedefs
typedef void* (*dnnl_graph_host_allocate_f)(
    size_t size,
    size_t alignment
    ) 
   Allocation call-back function interface for host.
For SYCL allocator, see dnnl_graph_sycl_allocate_f.
typedef void (*dnnl_graph_host_deallocate_f)(void *) 
   Deallocation call-back function interface for host.
For SYCL allocator, see dnnl_graph_sycl_deallocate_f.
typedef struct dnnl_graph_allocator* dnnl_graph_allocator_t 
   An allocator handle.
typedef const struct dnnl_graph_allocator* const_dnnl_graph_allocator_t 
   A constant allocator handle.
Global Functions
dnnl_status_t DNNL_API dnnl_graph_allocator_create(
    dnnl_graph_allocator_t* allocator,
    dnnl_graph_host_allocate_f host_malloc,
    dnnl_graph_host_deallocate_f host_free
    ) 
   Creates a host allocator with the given allocation and deallocation call-back function pointers.
Parameters:
allocator  |  
        Output allocator.  |  
       
host_malloc  |  
        A pointer to malloc function for host.  |  
       
host_free  |  
        A pointer to free function for host.  |  
       
Returns:
dnnl_success on success or a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_graph_allocator_destroy(dnnl_graph_allocator_t allocator) 
   Destroys an allocator.
Parameters:
allocator  |  
        The allocator to be destroyed.  |  
       
Returns:
dnnl_success on success or a status describing the error otherwise.