GetMrgSortResult

Function Usage

Obtains the number of Region Proposals in the queue processed by MrgSort and stores the number in the four List input parameters in sequence.

This API works with MrgSort as follows:

  • It is used together with MrgSort4 to obtain the number of Region Proposals in the queue processed by MrgSort4. To use this API, you need to set the MrgSort4Info.ifExhaustedSuspension parameter in MrgSort4 to true. In this configuration mode, after a queue is exhausted, the MrgSort4 instruction stops.

    The preceding description applies to the following models:

    Atlas inference product's AI Core

  • It is used together with MrgSort to obtain the number of Region Proposals in the queue processed by MrgSort. To use this API, you need to set the MrgSort4Info.ifExhaustedSuspension parameter in MrgSort to true. In this configuration mode, after a queue is exhausted, the MrgSort instruction stops.

    The preceding description applies to the following models:

    Atlas A2 training products/Atlas A2 inference products

    Atlas A3 training products/Atlas A3 inference products

    Atlas 200I/500 A2 inference products

Prototype

1
__aicore__ inline void GetMrgSortResult(uint16_t &mrgSortList1, uint16_t &mrgSortList2, uint16_t &mrgSortList3, uint16_t &mrgSortList4)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

mrgSortList1

Input/Output

The type is uint16_t, indicating the number of Region Proposals that have been processed in the first queue of MrgSort.

mrgSortList2

Input/Output

The type is uint16_t, indicating the number of Region Proposals that have been processed in the second queue of MrgSort.

mrgSortList3

Input/Output

The type is uint16_t, indicating the number of Region Proposals that have been processed in the third queue of MrgSort.

mrgSortList4

Input/Output

The type is uint16_t, indicating the number of Region Proposals that have been processed in the fourth queue of MrgSort.

Returns

Number of Region Proposals in the queue processed by MrgSort.

Availability

Atlas inference product's AI Core

Atlas A2 training products/Atlas A2 inference products

Atlas A3 training products/Atlas A3 inference products

Atlas 200I/500 A2 inference products

Constraints

None

Examples

  • Used together with MrgSort.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    AscendC::LocalTensor<float> dstLocal;
    AscendC::LocalTensor<float> workLocal;
    AscendC::LocalTensor<float> src0Local;
    AscendC::LocalTensor<uint32_t> src1Local;
    
    AscendC::Sort32(workLocal, src0Local, src1Local, 1);
    
    uint16_t elementLengths[4] = { 0 };
    uint32_t sortedNum[4] = { 0 };
    elementLengths[0] = 32;
    elementLengths[1] = 32;
    elementLengths[2] = 32;
    elementLengths[3] = 32;
    uint16_t validBit = 0b1111;
    
    AscendC::MrgSortSrcList<float> srcList;
    srcList.src1 = workLocal[0];
    srcList.src2 = workLocal[32 * 1 * 2];
    srcList.src3 = workLocal[32 * 2 * 2];
    srcList.src4 = workLocal[32 * 3 * 2];
    
    AscendC::MrgSort4Info mrgSortInfo(elementLengths, true, validBit, 1);
    AscendC::MrgSort(dstLocal, srcList, mrgSortInfo);
    
    uint16_t mrgRes1 = 0;
    uint16_t mrgRes2 = 0;
    uint16_t mrgRes3 = 0;
    uint16_t mrgRes4 = 0;
    AscendC::GetMrgSortResult(mrgRes1, mrgRes2, mrgRes3, mrgRes4);
    
  • Used together with MrgSort4.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    AscendC::LocalTensor<float> dstLocal;
    AscendC::LocalTensor<float> workLocal;
    AscendC::LocalTensor<float> src0Local;
    
    AscendC::RpSort16(workLocal, src0Local, 1);
    
    uint16_t elementLengths[4] = { 0 };
    uint32_t sortedNum[4] = { 0 };
    elementLengths[0] = 32;
    elementLengths[1] = 32;
    elementLengths[2] = 32;
    elementLengths[3] = 32;
    uint16_t validBit = 0b1111;
    
    AscendC::MrgSortSrcList<float> srcList;
    srcList.src1 = workLocal[0];
    srcList.src2 = workLocal[32 * 1 * 2];
    srcList.src3 = workLocal[32 * 2 * 2];
    srcList.src4 = workLocal[32 * 3 * 2];
    
    AscendC::MrgSort4Info mrgSortInfo(elementLengths, true, validBit, 1);
    AscendC::MrgSort4(dstLocal, srcList, mrgSortInfo);
    
    uint16_t mrgRes1 = 0;
    uint16_t mrgRes2 = 0;
    uint16_t mrgRes3 = 0;
    uint16_t mrgRes4 = 0;
    AscendC::GetMrgSortResult(mrgRes1, mrgRes2, mrgRes3, mrgRes4);