Moving Data from MaskReg
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Indicates the Reg vector computation data movement interface, and is used to move data from MaskReg to UB.
Prototype
// Use AddrReg to store the offset when data is moved from MaskReg. template <typename T, MaskDist dist = MaskDist::DIST_NORM> __simd_callee__ inline void StoreAlign(__ubuf__ T* dstAddr, MaskReg& mask, AddrReg offset); // Move data from MaskReg in the POST_MODE_NORMAL scenario. template <typename T, MaskDist dist = MaskDist::DIST_NORM> __simd_callee__ inline void StoreAlign(__ubuf__ T* dstAddr, MaskReg& mask); // Move data from MaskReg in the POST_MODE_UPDATE scenario. template <typename T, PostLiteral postMode, MaskDist dist = MaskDist::DIST_NORM> __simd_callee__ inline void StoreAlign(__ubuf__ T*& dstAddr, MaskReg& mask, int32_t offset); // Move data from MaskReg in non-aligned mode. template <typename T> __simd_callee__ inline void StoreUnAlign(__ubuf__ T*& dstAddr, MaskReg& mask, UnalignRegForStore& ureg);
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
T |
Input |
The supported data types are b8, b16, and b32. |
dist |
Input |
Movement mode. Use the MaskDist type. The values are as follows:
|
mask |
Input |
Source operand, which is of the MaskTensor type. |
dstAddr |
Output |
Start address of the destination operand in the UB. |
offset |
Input |
The actual UB start address for the movement is computed as: dstAddr + offset. |
Parameter |
Input/Output |
Description |
|---|---|---|
T |
Input |
The supported data types are b8, b16, b32, or b64. |
dist |
Input |
Movement mode. Use the MaskDist type. The values are as follows:
|
mask |
Input |
Source operand, which is of the MaskReg type. |
dstAddr |
Output |
Start address of the destination operand in the UB. |
Parameter |
Input/Output |
Description |
|---|---|---|
T |
Input |
The supported data types are b8, b16, b32, or b64. |
dist |
Input |
Movement mode. Use the MaskDist type. The values are as follows:
|
postMode |
Input |
This parameter controls whether to enable post update.
|
mask |
Input |
Source operand, which is of the MaskTensor type. |
dstAddr |
Output |
Start address of the destination operand in the UB. |
offset |
Input |
When the offset is of the int32_t type, the meanings of POST_MODE_NORMAL and POST_MODE_UPDATE are different.
|
Parameter |
Input/Output |
Description |
|---|---|---|
T |
Input |
The supported data types are b16 and b32. |
mask |
Input |
Source operand, which is of the MaskTensor type. |
dstAddr |
Output |
Start address of the destination operand in the UB. |
ureg |
Output |
UnalignRegForStore: non-aligned register, which is used to store non-aligned data. The length is 32 bytes. After StoreUnAlign (MaskReg non-aligned store interface) is called, the StoreUnAlignPost API needs to be called to pass the non-aligned register and write the remaining data to the destination address. |
Returns
None
Restrictions
None
Examples
template <typename T>
__simd_vf__ inline void StoreAlignVF(__ubuf__ T* dstAddr, __ubuf__ T* srcAddr, uint32_t count, uint32_t oneRepeatSize, uint16_t repeatTimes)
{
AscendC::Reg::MaskReg mask;
for (uint16_t i = 0; i < repeatTimes; ++i) {
mask = AscendC::Reg::UpdateMask<T>(count);
AscendC::Reg::AddrReg offset = AscendC::Reg::CreateAddrReg<T>(i, oneRepeatSize);
AscendC::Reg::LoadAlign(mask, srcAddr, offset);
AscendC::Reg::StoreAlign(dstAddr, mask, offset);
}
}