SetGraphFixedFeatureMemoryBase

Applicability

Product

Supported or Not

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference products

Atlas training products

Header File/Library File

  • Header file: #include <ge/ge_api.h>
  • Library file: libge_runner.so

Function Usage

Sets the memory base address of the fixed feature 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 memories 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

1
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 updated.
  • 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.
  • When ge.exec.staticMemoryPolicy in Command-Line Options is set to 4 or the GE_USE_STATIC_MEMORY environment variable is set to 4, memory reuse is supported for dynamic and static graphs. However, this API does not support address update. Therefore, in the memory reuse scenario of dynamic and static graphs, the default fixed memory allocation cannot be disabled by setting the address to nullptr and size to 0.