|
ONE - On-device Neural Engine
|
This file defines the GGMA context management API. More...
#include "ggma_types.h"Go to the source code of this file.
Typedefs | |
| typedef struct ggma_context | ggma_context |
| Opaque handle to a GGMA inference context. | |
Functions | |
| GGMA_STATUS | ggma_create_context (ggma_context **context, const char *package_path) |
| Creates a context from a package path. | |
| GGMA_STATUS | ggma_free_context (ggma_context *context) |
| Closes a GGMA context and releases its resources. | |
This file defines the GGMA context management API.
Definition in file ggma_context.h.
| typedef struct ggma_context ggma_context |
Opaque handle to a GGMA inference context.
A GGMA context represents the environment for inference. It includes model, computation graph, KV caches, and other resources for token generation.
Definition at line 36 of file ggma_context.h.
| GGMA_STATUS ggma_create_context | ( | ggma_context ** | context, |
| const char * | package_path | ||
| ) |
Creates a context from a package path.
This function initializes a context for inference from the specified package path. Once the context is no longer needed, it must be destroyed by calling ggma_free_context.
| [out] | context | A pointer to the variable that will receive the new context handle. |
| [in] | package_path | The path to the GGMA package directory. |
GGMA_STATUS_NO_ERROR on success, or an appropriate error code on failure. Definition at line 23 of file ggma_context.cc.
References GGMA_STATUS_ERROR, GGMA_STATUS_NO_ERROR, GGMA_STATUS_OUT_OF_MEMORY, and GGMA_STATUS_UNEXPECTED_NULL.
| GGMA_STATUS ggma_free_context | ( | ggma_context * | context | ) |
Closes a GGMA context and releases its resources.
This function deallocates all resources associated with the context, including the GGMA package it was created with. After this function returns, the context handle is invalid and must not be used.
| [in] | context | The context to close. |
GGMA_STATUS_NO_ERROR on success, or an appropriate error code on failure. Definition at line 46 of file ggma_context.cc.
References GGMA_STATUS_NO_ERROR.