Pack
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Extracts the even bits from the input MaskReg into the lower or upper half of the output MaskReg based on the selected least significant bit or most significant bit mode.
Prototype
template <HighLowPart part = HighLowPart::LOWEST> __simd_callee__ inline void Pack(MaskReg& dst, MaskReg& src)
Parameters
Parameter |
Description |
|---|---|
part |
Enum, including:
|
Parameter |
Description |
|---|---|
dst |
Destination operand. |
src |
Source operand. |
Returns
None
Restrictions
None
Examples
template <typename T>
__simd_vf__ inline void PackVF(__ubuf__ T* dstAddr, __ubuf__ T* srcAddr, uint32_t count, uint32_t oneRepeatSize, uint16_t repeatTimes)
{
AscendC::Reg::RegTensor<T> srcReg;
AscendC::Reg::MaskReg maskFull = AscendC::Reg::CreateMask<T, AscendC::Reg::MaskPattern::ALL>();
AscendC::Reg::MaskReg mask0;
AscendC::Reg::MaskReg mask1;
AscendC::Reg::Pack<AscendC::Reg::HighLowPart::LOWEST>(mask0, maskFull);
for (uint16_t i = 0; i < repeatTimes; ++i) {
mask1 = AscendC::Reg::UpdateMask<T>(count);
AscendC::Reg::LoadAlign(srcReg, srcAddr + i * oneRepeatSize);
AscendC::Reg::Adds(srcReg, srcReg, 0, mask0);
AscendC::Reg::StoreAlign(dstAddr + i * oneRepeatSize, srcReg, mask1);
}
}
Parent topic: MaskReg Computation