文档
注册
评分
提单
论坛
小AI

HasIdleBuffer

功能说明

查询Que中是否有空闲的内存块。

定义原型

__aicore__ inline bool HasIdleBuffer();

参数说明

支持的型号

Atlas 训练系列产品

Atlas推理系列产品(Ascend 310P处理器)AI Core

Atlas A2训练系列产品/Atlas 800I A2推理产品

注意事项

返回值

  • true - 表示Queue中存在空闲内存
  • false - 表示Queue中不存在空闲内存

调用示例

// 当前Que中已经分配了4块内存
TPipe pipe;
TQue<TPosition::VECOUT, 1> que;
int num = 4;
int len = 1024;
pipe.InitBuffer(que, num, len);
bool ret = que.HasIdleBuffer(); // 没有AllocTensor的操作,返回值为true
LocalTensor<half> tensor1 = que.AllocTensor();
bool ret = que.HasIdleBuffer(); // AllocTensor了一块内存,返回值为true
LocalTensor<half> tensor2 = que.AllocTensor();
LocalTensor<half> tensor3 = que.AllocTensor();
LocalTensor<half> tensor4 = que.AllocTensor();
bool ret = que.HasIdleBuffer(); // AllocTensor了四块内存,当前无空闲内存,返回值为false,继续AllocTensor会报错
搜索结果
找到“0”个结果

当前产品无相关内容

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