GetCmpMask (ISASI)

Function Usage

Obtains the comparison result of the Compare (Result Stored in a Register) instruction.

The Compare (Result Stored in a Register) instruction writes the comparison result to the CmpMask register. You can obtain the value of the CmpMask register by using GetCmpMask to obtain the comparison result.

Prototype

1
2
template<typename T>
__aicore__ inline void GetCmpMask(const LocalTensor<T>& dst)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

dst

Output

Comparison result of Compare (Result Stored in a Register).

The type is LocalTensor, and the supported TPosition is VECIN, VECCALC, or VECOUT.

The start address of the LocalTensor must be 16-byte aligned.

Returns

None

Availability

Constraints

None

Example

The result of the Compare (Result Stored in a Register) instruction is stored using data of the uint8_t type. Therefore, dstLocal uses the uint8_t type.

1
2
3
4
5
6
7
AscendC::LocalTensor<float> src0Local;
AscendC::LocalTensor<float> src1Local;
AscendC::LocalTensor<uint8_t> dstLocal;
uint64_t mask = 256 / sizeof(float); // 256 indicates the number of bytes processed in each iteration. The result is 64.
AscendC::BinaryRepeatParams repeatParams = { 1, 1, 1, 8, 8, 8 };
AscendC::Compare(src0Local, src1Local, AscendC::CMPMODE::LT, mask, repeatParams);
AscendC::GetCmpMask(dstLocal);