Move
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Replicates elements from src to the corresponding positions in dst. If there is an input mask, only the valid elements selected by the mask are copied, and invalid elements are filled with 0.
Prototype
- There is an input mask.
__simd_callee__ inline void Move(MaskReg& dst, MaskReg& src, MaskReg& mask)
- There are no input masks.
__simd_callee__ inline void Move(MaskReg& dst, MaskReg& src)
Parameters
Parameter |
Description |
|---|---|
dst |
Destination operand. |
src |
Source operand. |
mask |
This parameter indicates which bits are valid during the copy process. |
Returns
None
Restrictions
None
Examples
template <typename T>
__simd_vf__ inline void MoveVF(__ubuf__ T* dstAddr, __ubuf__ T* srcAddr, uint32_t count, uint32_t oneRepeatSize, uint16_t repeatTimes)
{
AscendC::Reg::RegTensor<T> srcReg;
AscendC::Reg::MaskReg src = AscendC::Reg::CreateMask<T, AscendC::Reg::MaskPattern::ALLF>();
AscendC::Reg::MaskReg dst;
AscendC::Reg::MaskReg mask;
for (uint16_t i = 0; i < repeatTimes; ++i) {
mask = AscendC::Reg::UpdateMask<T>(count);
AscendC::Reg::LoadAlign(srcReg, srcAddr + i * oneRepeatSize);
AscendC::Reg::Move(dst, src, mask);
AscendC::Reg::Adds(srcReg, srcReg, 0, dst);
AscendC::Reg::StoreAlign(dstAddr + i * oneRepeatSize, srcReg, mask);
}
}
Parent topic: MaskReg Computation