文档
注册

SetGraphFixedFeatureMemoryBaseWithType

函数功能

用于指定图的不同内存类型的Fixed Feature内存基地址,内存大小从GetCompiledGraphSummary>GetAllFeatureMemoryTypeSize接口中获取。Feature内存指的是模型执行过程中所需要的中间内存(比如中间节点的输入输出等内存)。

  • 当图中包含Fixed内存,但是用户未指定时,默认申请Fixed内存。
  • 用户可以通过将地址设置为nullptr,size设置为0的方式,关闭默认申请Fixed内存的行为(内存类型为MEMORY_TYPE_P2P不支持该场景)。

函数原型

Status SetGraphFixedFeatureMemoryBaseWithType(uint32_t graph_id, MemoryType type, const void *const memory, size_t size);

参数说明

参数名

输入/输出

描述

graph_id

输入

子图对应的id。

type

输入

内存类型,包含 MemoryType::MEMORY_TYPE_DEFAULT、MemoryType::MEMORY_TYPE_P2P。

memory

输入

设置的Fixed Feature内存基地址。

size

输入

设置的Fixed Feature内存大小。一定要大于等于从GetCompiledGraphSummary>GetAllFeatureMemoryTypeSize接口中获取的。

返回值

参数名

类型

描述

-

Status

SUCCESS:设置成功。

FAILED:设置失败。

约束说明

  • 在调用本接口前,必须先调用CompileGraph接口进行图编译。
  • 每个graph每种内存类型只支持设置一次,不支持刷新。
  • 设置内存类型为MEMORY_TYPE_DEFAULT的Fixed内存地址,不能与UpdateGraphFeatureMemoryBase接口同时使用。
  • 不能与SetGraphFixedFeatureMemoryBase接口同时使用,SetGraphFixedFeatureMemoryBase用来设置Fixed内存基址和大小;而SetGraphFixedFeatureMemoryBaseWithType用来设置不同内存类型的Fixed内存基址。
  • 当Fixed内存长度为0时,调用该接口不生效,且会生成warning日志提示用户。
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词