查询Que中是否有空闲的内存块。
__aicore__ inline bool HasIdleBuffer();
无
Atlas 训练系列产品
Atlas推理系列产品AI Core
Atlas A2训练系列产品
无
// 当前Que中已经分配了4块内存 TPipe pipe; TQue<TPosition::VECOUT, 4> que; int num = 4; int len = 1024; pipe.InitBuffer(que, num, len); bool ret = que.HasIdleBuffer(); // 没有AllocBuffer的操作,返回值为true LocalTensor<half> tensor1 = que.AllocTensor(); bool ret = que.HasIdleBuffer(); // AllocBuffer了一块内存,返回值为true LocalTensor<half> tensor2 = que.AllocTensor(); LocalTensor<half> tensor3 = que.AllocTensor(); LocalTensor<half> tensor4 = que.AllocTensor(); bool ret = que.HasIdleBuffer(); // AllocBuffer了四块内存,当前无空闲内存,返回值为false,继续AllocTensor会报错