SetGraphFixedFeatureMemoryBase

Description

Sets the fixed feature memory base address of a graph. The memory size is obtained from GetCompiledGraphSummary > GetFixedFeatureMemorySize.

Feature memory refers to the intermediate memory required during model execution (for example, the input and output memory of intermediate nodes).

  • If the graph contains the fixed memory which is not specified by the user, the fixed memory is allocated by default.
  • If you do not want the fixed memory to be allocated by default, set the address to a nullptr and size to 0.

Prototype

Status SetGraphFixedFeatureMemoryBase(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 fixed feature memory.

size

Input

Size of the fixed feature 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.
  • Each graph can be set only once and cannot be refreshed.
  • This API cannot be used together with UpdateGraphFeatureMemoryBase.
  • This API cannot be used together with SetGraphFixedFeatureMemoryBaseWithType. SetGraphFixedFeatureMemoryBaseWithType is used to set the fixed memory base addresses for different memory types, while SetGraphFixedFeatureMemoryBase is used to specify the fixed memory base address and size for a specified memory type.
  • When the fixed memory length is 0, calling this API does not take effect, and a warning log will be generated.