HasIdleBuffer产品支持情况产品是否支持Ascend 950PR/Ascend 950DT√Atlas A3 训练系列产品 / Atlas A3 推理系列产品√Atlas A2 训练系列产品 / Atlas A2 推理系列产品√Atlas 200I/500 A2 推理产品√Atlas 推理系列产品 AI Core√Atlas 推理系列产品 Vector CorexAtlas 训练系列产品√功能说明查询Que中是否有空闲的内存块。函数原型__aicore__ inline bool HasIdleBuffer()参数说明无约束说明该接口不支持Tensor原地操作即TQue的depth设置为0的场景。返回值说明true - 表示Queue中存在空闲内存false - 表示Queue中不存在空闲内存调用示例// 当前Que中已经分配了4块内存 AscendC::TPipe pipe; AscendC::TQueBindAscendC::TPosition::VECOUT, AscendC::TPosition::GM, 4 que; int num 4; int len 1024; pipe.InitBuffer(que, num, len); bool ret que.HasIdleBuffer(); // 没有AllocTensor的操作返回值为true AscendC::LocalTensorhalf tensor1 que.AllocTensorhalf(); ret que.HasIdleBuffer(); // AllocTensor了一块内存返回值为true AscendC::LocalTensorhalf tensor2 que.AllocTensorhalf(); AscendC::LocalTensorhalf tensor3 que.AllocTensorhalf(); AscendC::LocalTensorhalf tensor4 que.AllocTensorhalf(); ret que.HasIdleBuffer(); // AllocTensor了四块内存当前无空闲内存返回值为false继续AllocTensor会报错创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
CANN/asc-devkit队列空闲缓冲区检查
发布时间:2026/7/15 14:57:08
HasIdleBuffer产品支持情况产品是否支持Ascend 950PR/Ascend 950DT√Atlas A3 训练系列产品 / Atlas A3 推理系列产品√Atlas A2 训练系列产品 / Atlas A2 推理系列产品√Atlas 200I/500 A2 推理产品√Atlas 推理系列产品 AI Core√Atlas 推理系列产品 Vector CorexAtlas 训练系列产品√功能说明查询Que中是否有空闲的内存块。函数原型__aicore__ inline bool HasIdleBuffer()参数说明无约束说明该接口不支持Tensor原地操作即TQue的depth设置为0的场景。返回值说明true - 表示Queue中存在空闲内存false - 表示Queue中不存在空闲内存调用示例// 当前Que中已经分配了4块内存 AscendC::TPipe pipe; AscendC::TQueBindAscendC::TPosition::VECOUT, AscendC::TPosition::GM, 4 que; int num 4; int len 1024; pipe.InitBuffer(que, num, len); bool ret que.HasIdleBuffer(); // 没有AllocTensor的操作返回值为true AscendC::LocalTensorhalf tensor1 que.AllocTensorhalf(); ret que.HasIdleBuffer(); // AllocTensor了一块内存返回值为true AscendC::LocalTensorhalf tensor2 que.AllocTensorhalf(); AscendC::LocalTensorhalf tensor3 que.AllocTensorhalf(); AscendC::LocalTensorhalf tensor4 que.AllocTensorhalf(); ret que.HasIdleBuffer(); // AllocTensor了四块内存当前无空闲内存返回值为false继续AllocTensor会报错创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考