目录

GetTensorC

Function Description

After iteration is performed, a C matrix slice is obtained and can be directly output to the GM tensor.

This API is used together with the Iterate API to obtain a matrix slice with the size of baseM x baseN after iterative computation executed by the Iterate call is complete.

There are synchronous and asynchronous modes to iteratively obtaining the slices of matrix C.

Function Prototype

Parameters

Table 1 Template parameters

Parameter Description
sync Sets the synchronous or asynchronous mode. Setting it to true enables the synchronous mode; while setting it to false enables the asynchronous mode.

Table 2 API parameters

Parameter Input/Output Description
gm Output

Extracts matrix C to GM. The data format can be ND or NZ.

For Kirin 9020 and Kirin 9030 series processors, the supported data type is half.

enAtomic Input

Whether to enable the atomic operation. The default value is 0.

Values:

0: disables the Atomic operation.

1: enables the AtomicAdd (accumulation) operation.

2: enables the AtomicMax (maximum value calculation) operation.

3: enables the AtomicMin (minimum value calculation) operation.

enSequentialWrite Input

Whether to enable the continuous write mode (continuous write: write to [baseM, baseN]; non-continuous write: write to the corresponding position in [singleCoreM, singleCoreN]). The default value is false (non-continuous write mode).

Note: In non-continuous write mode, the offset is calculated internally based on the iteration sequence, and you do not need to pay attention to it. If you need to decide the layout sequence, you can select the continuous write mode and perform the movement operation based on the offset you set.

Figure 1 Non-continuous write mode

Figure 2 Continuous write mode

Return Value

None

Supported Models

Kirin 9020 series processors

Kirin 9030 series processors

Precautions

Ensure that the size of the input matrix C address space is greater than or equal to baseM x baseN.

Calling Example