
EnQue产品支持情况产品是否支持Ascend 950PR/Ascend 950DT√Atlas A3 训练系列产品 / Atlas A3 推理系列产品√Atlas A2 训练系列产品 / Atlas A2 推理系列产品√Atlas 200I/500 A2 推理产品√Atlas 推理系列产品 AI Core√Atlas 推理系列产品 Vector CorexAtlas 训练系列产品√Kirin X90√Kirin 9030√功能说明将Tensor push到队列。函数原型无需指定源和目的位置template typename T __aicore__ inline bool EnQue(const LocalTensorT tensor)需要指定源和目的位置通过TQueBind绑定VECIN和VECOUT可实现VECIN和VECOUT内存复用如下接口用于存在Vector计算的场景下实现复用在入队时需要指定源和目的位置不存在Vector计算的场景下可直接调用bool EnQue(LocalTensorT tensor)入队接口。template TPosition srcUserPos, TPosition dstUserPos, typename T __aicore__ inline bool EnQue(const LocalTensorT tensor)参数说明表 1模板参数说明参数名说明TTensor的数据类型。srcUserPos用户指定队列的src position当前只支持如下通路GM-VECIN/VECOUT-GM。dstUserPos用户指定队列的dst position当前只支持如下通路GM-VECIN/VECOUT-GM。表 2参数说明参数名称输入/输出含义tensor输入指定的Tensor。约束说明无返回值说明true - 表示Tensor加入Queue成功false - 表示Queue已满入队失败调用示例// 接口: EnQue Tensor AscendC::TPipe pipe; AscendC::TQueAscendC::TPosition::VECOUT, 4 que; int num 4; int len 1024; pipe.InitBuffer(que, num, len); AscendC::LocalTensorhalf tensor1 que.AllocTensorhalf(); que.EnQue(tensor1);// 将tensor加入VECOUT的Queue中 // 接口EnQue指定特定的src/dst position加入相应的队列 // template TPosition srcUserPos, TPosition dstUserPos bool EnQue(LocalTensorT tensor) AscendC::TPipe pipe; AscendC::TQueBindAscendC::TPosition::VECIN, AscendC::TPosition::VECOUT, 1 que; int num 4; int len 1024; pipe.InitBuffer(que, num, len); AscendC::LocalTensorhalf tensor1 que.AllocTensorhalf(); que.EnQueAscendC::TPosition::GM, AscendC::TPosition::VECIN, half(tensor1);// 将tensor加入VECIN的Queue中实现内存复用创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考