UpdateGraphRefreshableFeatureMemoryBase
Description
Updates the base address of the feature memory that can be refreshed except fixed memory. The memory size is obtained from GetCompiledGraphSummary > GetRefreshableFeatureMemorySize.
If the graph has fixed memory and neither SetGraphFixedFeatureMemoryBase nor SetGraphFixedFeatureMemoryBaseWithType is called to set the base address of the fixed feature memory for the default memory type, the fixed memory is automatically allocated by default.
Feature memory refers to the intermediate memory required during model execution (for example, the input and output memory of intermediate nodes).
Prototype
Status UpdateGraphRefreshableFeatureMemoryBase(uint32_t graph_id, const void *const memory, size_t size);
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
graph_id |
Input |
Subgraph ID. |
memory |
Input |
Base address of the feature memory that can be refreshed except fixed memory. |
size |
Input |
Size of the feature memory that can be refreshed except fixed memory. |
Returns
Parameter |
Type |
Description |
|---|---|---|
- |
Status |
SUCCESS: The setting is successful. FAILED: The setting fails. |
Restrictions
- Before calling this API, you must call CompileGraph to compile the graph.
- After compiling a graph by calling CompileGraph, you can call GetCompiledGraphSummary to check whether the feature address can be refreshed. Only graphs whose feature addresses can be refreshed can call this API again to refresh the feature addresses.
- This API applies only to statically compiled graphs. You can call the IsStatic API in GetCompiledGraphSummary to check whether a graph is statically compiled.
- If this API is used and RegisterExternalAllocator is configured, RegisterExternalAllocator does not take effect.
- If the address of the fixed memory with the memory type MEMORY_TYPE_DEFAULT is set to a nullptr and size is set to 0 through SetGraphFixedFeatureMemoryBase or SetGraphFixedFeatureMemoryBaseWithType, the fixed memory function is disabled. In this scenario, UpdateGraphRefreshableFeatureMemoryBase cannot be called.
- This API cannot be called along with UpdateGraphFeatureMemoryBase.