MoveMask
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Reads the mask value from the special register SPR{MASK1, MASK0} and writes the value to the function return value MaskReg based on the data type format.
Prototype
template <typename T> __simd_callee__ inline MaskReg MoveMask()
Parameters
Parameter |
Description |
|---|---|
T |
Data type, which determines the format of the mask value to be written.
|
Returns
MaskReg read from the special register.
Restrictions
None
Examples
template <typename T>
__simd_vf__ inline void MoveMaskVF(__ubuf__ T* dstAddr, __ubuf__ T* srcAddr, uint32_t count, uint32_t oneRepeatSize, uint16_t repeatTimes)
{
AscendC::Reg::RegTensor<T> srcReg;
AscendC::Reg::MaskReg addMask = AscendC::Reg::MoveMask<T>();
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::Adds(srcReg, srcReg, 0, addMask);
AscendC::Reg::StoreAlign(dstAddr + i * oneRepeatSize, srcReg, mask);
}
}
Parent topic: MaskReg Computation