DisableDmaAtomic

产品支持情况

产品 是否支持
Ascend 950PR/Ascend 950DT
Atlas A3 训练系列产品/Atlas A3 推理系列产品
Atlas A2 训练系列产品/Atlas A2 推理系列产品
Atlas 200I/500 A2 推理产品
Atlas 推理系列产品AI Core
Atlas 推理系列产品Vector Core x
Atlas 训练系列产品

功能说明

头文件路径为:"basic_api/kernel_operator_set_atomic_intf.h"

关闭数据搬运随路原子操作功能,后续执行数据搬运时,GM中原始数据将被新搬运数据完全覆盖。

函数原型

__aicore__ inline void DisableDmaAtomic()

参数说明

返回值说明

约束说明

SetAtomicAddSetAtomicMaxSetAtomicMin使用完成后,通过DisableDmaAtomic清空原子操作的状态,以免影响后续相关指令功能。

调用示例

AscendC::LocalMemAllocator<AscendC::Hardware::UB> ubAllocator;
AscendC::LocalTensor<T> srcLocal = ubAllocator.Alloc<T, SIZE>();

AscendC::DisableDmaAtomic();
AscendC::DataCopy(srcLocal, srcGlobal, SIZE);
AscendC::SetFlag<AscendC::HardEvent::MTE2_MTE3>(EVENT_ID0);
AscendC::WaitFlag<AscendC::HardEvent::MTE2_MTE3>(EVENT_ID0);
AscendC::SyncAll();

// 开启原子累加,将UB数据原子累加到GM
AscendC::SetAtomicAdd<T>();
AscendC::DataCopy(dstGlobal, srcLocal, SIZE);

// 关闭原子累加
AscendC::DisableDmaAtomic();

完整样例请参考DataMovementWithAtomicOperations样例