MatmulGetTmpBufSize
Function Usage
Obtains the used L1 Buffer, Unified Buffer, or L0C Buffer size based on the tiling structure information after the GetTiling API is called to obtain the tiling parameters.
Prototype
1 | int32_t MatmulGetTmpBufSize(optiling::TCubeTiling &tiling, matmul_tiling::SysTilingTempBufSize &bufSize) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
tiling |
Input |
Single-core Matmul tiling structure, which is the TCubeTiling structure obtained by the MatmulTiling object. |
bufSize |
Output |
Size of the L1 Buffer, Unified Buffer, or L0C Buffer used in the tiling. The SysTilingTempBufSize structure is defined in the code below. |
1 2 3 4 5 | struct SysTilingTempBufSize { int32_t ubSize = 0; // Size of the unified buffer int32_t l1Size = 0; // Size of the L1 buffer int32_t l0cSize = 0; // Size of the L0C buffer }; |
Returns
-1: obtaining failed; 0: obtaining succeeded.
Restrictions
None
Examples
1 2 3 4 5 6 7 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo()); matmul_tiling::MatmulApiTiling tiling(ascendcPlatform); optiling::TCubeTiling tilingData; ... // Initialize tilingData. For details, see the usage description of MatmulTiling APIs. int ret = tiling.GetTiling(tilingData); // Obtain tiling parameters. SysTilingTempBufSize bufSize; MatmulGetTmpBufSize(tilingData, bufSize); |
Parent topic: Obtaining Space Required for Matmul Computation