Skip to content

PopStackBuffer

产品支持情况​

  • Ascend 950PR&950DT系列产品:支持
  • Atlas A3系列产品:支持
  • Atlas A2系列产品:支持
  • Atlas 200I/500 A2推理产品:支持
  • Atlas推理系列产品AI Core:支持
  • Atlas推理系列产品Vector Core:支持
  • Atlas训练系列产品:支持
  • KirinX90处理器系列产品:支持
  • Kirin9030处理器系列产品:支持

功能说明​

在指定position(逻辑位置)申请临时空间,空间大小为指定position的全部剩余空间。

函数原型​

Text
template <typename T, TPosition pos>
__aicore__ inline bool PopStackBuffer(LocalTensor<T>& popLocal)

参数说明​

表1 模板参数说明

参数名

描述

T

popLocal的数据类型,支持的数据类型如下:uint8_t、int8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t、float、half。

pos

需要申请临时空间的position,数据类型为TPosition。

表2 参数说明

参数名

输入/输出

描述

popLocal

输出

申请临时空间对应的Tensor,Tensor大小为对应position的剩余全部空间。

返回值说明​

表示函数执行的结果,true表示成功,false表示失败。

约束说明​

  • 该接口不支持嵌套使用,比如函数A中调用了PopStackBuffer,那么调用函数A的其他函数中则不可以再调用PopStackBuffer。
  • 因为当前高阶API内部实现中会使用到本接口,所以算子实现中调用了高阶API的场景,不支持调用该接口。

调用示例​

Text
AscendC::LocalTensor<int16_t> popBuffer;
bool ret = AscendC::PopStackBuffer<int16_t, AscendC::TPosition::VECCALC>(popBuffer);

免责声明:本站内容由 asc-devkit 仓 master 分支自动编译生成,属于持续开发版本,可能存在缺陷,仅供预览与参考。如需稳定及商用资料,请查阅官方 昇腾社区。