SetGraphFixedFeatureMemoryBaseWithType
Description
Sets the fixed feature memory base address for different memory types of a graph. The memory size is obtained from GetCompiledGraphSummary> GetAllFeatureMemoryTypeSize. 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. (This is not applicable to the scenario where the memory type is MEMORY_TYPE_P2P.)
Prototype
Status SetGraphFixedFeatureMemoryBaseWithType(uint32_t graph_id, MemoryType type, const void *const memory, size_t size);
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
graph_id |
Input |
Subgraph ID. |
type |
Input |
Memory type, such as MemoryType::MEMORY_TYPE_DEFAULT and MemoryType::MEMORY_TYPE_P2P. |
memory |
Input |
Base address of the fixed feature memory. |
size |
Input |
Size of the fixed feature memory. The value must be greater than or equal to that obtained from GetCompiledGraphSummary > GetAllFeatureMemoryTypeSize. |
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 for each memory type and cannot be refreshed.
- This API cannot be used together with UpdateGraphFeatureMemoryBase when the memory type is MEMORY_TYPE_DEFAULT.
- This API cannot be used together with SetGraphFixedFeatureMemoryBase. 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.