@@ -18,22 +18,6 @@ extern "C" {
1818
1919#include "NeutronErrors.h"
2020
21- /* Neutron Driver error category codes */
22- typedef enum ERROR_CATEGORY_DRIVER {
23- ERROR_CATEGORY_DRIVER_GENERIC , /* Generic error category */
24- ERROR_CATEGORY_DRIVER_UNSUPPORTED , /* Unsupported function */
25- ERROR_CATEGORY_DRIVER_UCODE , /* Microcode bad magic or version incompatible.
26- */
27- ERROR_CATEGORY_DRIVER_INVALID , /* Invalid arguments */
28- ERROR_CATEGORY_DRIVER_BAD_HANDLE , /* Bad inference handle */
29- ERROR_CATEGORY_DRIVER_NO_MEMORY , /* Not enough memory */
30- ERROR_CATEGORY_DRIVER_INTERNAL_FAULT , /* Internal error */
31- ERROR_CATEGORY_DRIVER_UNKNOWN_ARCH , /* Unknown architecture */
32- ERROR_CATEGORY_DRIVER_TRACE_NOT_RUN , /* Tracing did not run, but trace buffer
33- was requested. */
34- ERROR_CATEGORY_DRIVER_TIMEOUT /* Timeout error. */
35- } ERROR_CATEGORY_DRIVER ;
36-
3721/// Trace configuration to enable kernel level tracing.
3822#define TRACE_CONFIG_KERNEL_LEVEL (1U << 0)
3923
@@ -169,6 +153,12 @@ NeutronError neutronCustomExec(
169153 NeutronModelHandle hdl ,
170154 const NeutronDataConfig * neutron_dcfg );
171155
156+ /// - Setup the input and output data ptr to use Neutron memory area.
157+ /// - The input and ouput data ptr is stored in neutron_dcfg.
158+ NeutronError neutronDataSetup (
159+ NeutronModelHandle hdl ,
160+ NeutronDataConfig * neutron_dcfg );
161+
172162/// - Prepare Neutron execution for a model with the given configuration.
173163/// - This function only prepares the execution by transferring the parameters
174164/// to the firmware.
@@ -245,6 +235,29 @@ void* neutronMemAlloc(size_t alignment, size_t size);
245235/// - This function is only available for Neutron-S in the Linux environment.
246236void neutronMemFree (void * ptr );
247237
238+ /// - Allocates size bytes large buffer in DDR to be used for specialized
239+ /// kernels (e.g. batch matmul)
240+ /// Uses Linux CMA allocator
241+ NeutronError allocateBuffer (uint64_t size , void * * pBuffer , bool userspace );
242+
243+ /// - Frees buffer allocated via allocateBuffer function
244+ NeutronError releaseBuffer (void * buffer );
245+
246+ /// - Clean/flush cache for DDR allocated buffer
247+ /// TODO: rename function as "cleanCache" to satisfy neutron-software naming
248+ /// convention
249+ NeutronError clean_cache (const void * addr , int size );
250+
251+ /// - Function for calling firmware for specialized kernel (matmul)
252+ NeutronError matmul (
253+ const void * info ,
254+ int sizeInfo ,
255+ const void * in ,
256+ int sizeIn ,
257+ const void * out ,
258+ int sizeOut ,
259+ int idxSlot );
260+
248261/// Other functions to control the state of driver/firmware.
249262#ifdef __cplusplus
250263}
0 commit comments