.. index:: pair: group; Allocator .. _doxid-group__dnnl__graph__api__allocator: Allocator ========= .. toctree:: :hidden: class_dnnl_graph_allocator.rst Overview ~~~~~~~~ Definitions of allocator which is used to acquire memory resources in partition compilation and execution. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block // typedefs typedef void* (*:ref:`dnnl_graph_host_allocate_f`)( size_t size, size_t alignment ); typedef void (*:ref:`dnnl_graph_host_deallocate_f`)(void *); typedef struct dnnl_graph_allocator* :ref:`dnnl_graph_allocator_t`; typedef const struct dnnl_graph_allocator* :ref:`const_dnnl_graph_allocator_t`; // classes class :ref:`dnnl::graph::allocator`; // global functions :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_allocator_create`( :ref:`dnnl_graph_allocator_t`* allocator, :ref:`dnnl_graph_host_allocate_f` host_malloc, :ref:`dnnl_graph_host_deallocate_f` host_free ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_graph_allocator_destroy`(:ref:`dnnl_graph_allocator_t` allocator); .. _details-group__dnnl__graph__api__allocator: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Definitions of allocator which is used to acquire memory resources in partition compilation and execution. SYCL allocator (:ref:`dnnl::graph::sycl_interop::make_allocator `) should be used for SYCL runtime and host allocator should be used for non-SYCL. Typedefs -------- .. index:: pair: typedef; dnnl_graph_host_allocate_f .. _doxid-group__dnnl__graph__api__allocator_1gae34382069edddd880a407f22c5dfd8e1: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef void* (*dnnl_graph_host_allocate_f)( size_t size, size_t alignment ) Allocation call-back function interface for host. For SYCL allocator, see :ref:`dnnl_graph_sycl_allocate_f `. .. index:: pair: typedef; dnnl_graph_host_deallocate_f .. _doxid-group__dnnl__graph__api__allocator_1gaaa02889e076ef93c15da152bba7d29b0: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef void (*dnnl_graph_host_deallocate_f)(void *) Deallocation call-back function interface for host. For SYCL allocator, see :ref:`dnnl_graph_sycl_deallocate_f `. .. index:: pair: typedef; dnnl_graph_allocator_t .. _doxid-group__dnnl__graph__api__allocator_1ga7e5ba6788922a000348e762ac8c88cc6: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef struct dnnl_graph_allocator* dnnl_graph_allocator_t An allocator handle. .. index:: pair: typedef; const_dnnl_graph_allocator_t .. _doxid-group__dnnl__graph__api__allocator_1ga82fcfed1f65be71d0d1c5cf865f8f499: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef const struct dnnl_graph_allocator* const_dnnl_graph_allocator_t A constant allocator handle. Global Functions ---------------- .. index:: pair: function; dnnl_graph_allocator_create .. _doxid-group__dnnl__graph__api__allocator_1gaac19f3f00e51bdd323be1a9073282fcd: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_allocator_create( :ref:`dnnl_graph_allocator_t`* allocator, :ref:`dnnl_graph_host_allocate_f` host_malloc, :ref:`dnnl_graph_host_deallocate_f` host_free ) Creates a host allocator with the given allocation and deallocation call-back function pointers. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - allocator - Output allocator. * - host_malloc - A pointer to malloc function for host. * - host_free - A pointer to free function for host. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise. .. index:: pair: function; dnnl_graph_allocator_destroy .. _doxid-group__dnnl__graph__api__allocator_1gad2c3000cd39878198f6e461a30dd42c8: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_graph_allocator_destroy(:ref:`dnnl_graph_allocator_t` allocator) Destroys an allocator. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - allocator - The allocator to be destroyed. .. rubric:: Returns: :ref:`dnnl_success ` on success or a status describing the error otherwise.