SetGraphFixedFeatureMemoryBase

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product

Atlas training product

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.
  • This setting can only be set once for each graph 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 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. This API does not support address update. Therefore, in the memory reuse scenario of dynamic and static graphs, you cannot disable the default fixed memory allocation by setting the address to nullptr and size to 0.