CANN/asc-devkit Not逻辑非API文档

发布时间:2026/5/20 11:46:02

CANN/asc-devkit Not逻辑非API文档 Not【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit产品支持情况产品是否支持Ascend 950PR/Ascend 950DT√Atlas A3 训练系列产品 / Atlas A3 推理系列产品xAtlas A2 训练系列产品 / Atlas A2 推理系列产品xAtlas 200I/500 A2 推理产品xAtlas 推理系列产品 AI CorexAtlas 推理系列产品 Vector CorexAtlas 训练系列产品x功能说明本节介绍两种接口分别用于对RegTensor和MaskReg进行操作对RegTensor操作对输入srcReg中的每个有效数据按位取反将结果写入dstReg。对MaskReg操作对输入src中的每个有效位bit取反将结果写入dst。函数原型对RegTensor进行操作template typename T DefaultType, MaskMergeMode mode MaskMergeMode::ZEROING, typename U __simd_callee__ inline void Not(U dstReg, U srcReg, MaskReg mask)对MaskReg进行操作__simd_callee__ inline void Not(MaskReg dst, MaskReg src, MaskReg mask)参数说明对RegTensor进行操作表 1模板参数说明参数名描述T操作数数据类型。Ascend 950PR/Ascend 950DT支持的数据类型为int8_t/uint8_t/int16_t/uint16_t/int32_t/uint32_t/int64_t/uint64_t/half/floatmode选择MERGING模式或ZEROING模式。ZEROINGmask未筛选的元素在dst中置零。MERGING当前不支持。U目的操作数的RegTensor类型例如RegTensorhalf由编译器自动推导用户不需要填写。表 2参数说明参数名输入/输出描述dstReg输出目的操作数。类型为RegTensor。srcReg输入源操作数。类型为RegTensor。源操作数的数据类型需要与目的操作数保持一致。mask输入源操作数元素操作的有效指示详细说明请参考MaskReg。对MaskReg进行操作表 3参数说明参数名描述dst目的操作数。src源操作数。mask指示在计算过程中哪些bit有效。返回值说明无约束说明无调用示例对RegTensor进行操作template typename T __simd_vf__ inline void NotVF(__ubuf__ T* dstAddr, __ubuf__ T* srcAddr, uint32_t count, uint32_t oneRepeatSize, uint16_t repeatTimes) { AscendC::Reg::RegTensorT srcReg; AscendC::Reg::RegTensorT dstReg; AscendC::Reg::MaskReg mask; for (uint16_t i 0; i repeatTimes; i) { mask AscendC::Reg::UpdateMaskT(count); AscendC::Reg::LoadAlign(srcReg, srcAddr i * oneRepeatSize); AscendC::Reg::Not(dstReg, srcReg, mask); AscendC::Reg::StoreAlign(dstAddr i * oneRepeatSize, dstReg, mask); } }对MaskReg进行操作template typename T __simd_vf__ inline void NotVF(__ubuf__ T* dstAddr, __ubuf__ T* srcAddr, uint32_t count, uint32_t oneRepeatSize, uint16_t repeatTimes) { AscendC::Reg::RegTensorT srcReg; AscendC::Reg::MaskReg src AscendC::Reg::CreateMaskT, AscendC::Reg::MaskPattern::ALLF(); AscendC::Reg::MaskReg dst; AscendC::Reg::MaskReg mask; for (uint16_t i 0; i repeatTimes; i) { mask AscendC::Reg::UpdateMaskT(count); AscendC::Reg::LoadAlign(srcReg, srcAddr i * oneRepeatSize); AscendC::Reg::Not(dst, src, mask); AscendC::Reg::Adds(srcReg, srcReg, 0, dst); AscendC::Reg::StoreAlign(dstAddr i * oneRepeatSize, srcReg, mask); } }【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

相关新闻