MatmulGetTmpBufSizeV2

Function Usage

Obtains the used L1/UB/L0C size based on the tiling structure information after single-core Matmul tiling.

Prototype

1
int32_t MatmulGetTmpBufSizeV2(TCubeTiling & tiling, matmul_tiling::SysTilingTempBufSize &bufSize)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

tiling

Input

Single-core Matmul tiling structure TCubeTiling is the Matmul TilingData defined on the kernel. It is used together with the GetTiling API whose input parameter is the TCubeTiling structure without the optiling namespace.

bufSize

Output

Used L1/UB/L0C size obtained based on the tiling structure information.

The SysTilingTempBufSize structure is defined as follows:

1
2
3
4
5
struct SysTilingTempBufSize {
    int32_t ubSize = 0;
    int32_t l1Size = 0;
    int32_t l0cSize = 0;
};

Returns

-1: setting failed; 0: setting succeeded.

Precautions

None

Example

1
2
3
4
5
6
7
8
9
auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
matmul_tiling::MatmulApiTiling tiling(ascendcPlatform); 
tiling.SetAType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16);   
...
TCubeTiling tilingData;   
int ret = tiling.GetTiling(tilingData);    // if ret = -1, gen tiling failed
...
SysTilingTempBufSize bufSize;
MatmulGetTmpBufSizeV2(tilingData, bufSize);