SetBufferSpace
Function
Sets the size of the available L1 Buffer/L0C Buffer/Unified Buffer/BiasTable buffer space during Matmul computation. The unit is byte.
Prototype
1 | int32_t SetBufferSpace(int32_t l1Size = -1, int32_t l0CSize = -1, int32_t ubSize = -1, int32_t btSize = -1) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
l1Size |
Input |
Sets the size of the L1 buffer that can be used during Matmul computation. The unit is byte. The default value is -1, indicating the size of the AI Processor L1 buffer in use. |
l0CSize |
Input |
Sets the size of the L0C buffer that can be used during Matmul computation. The unit is byte. The default value is -1, indicating the size of the AI Processor L0C buffer in use. |
ubSize |
Input |
Sets the size of the UB buffer that can be used during Matmul computation. The unit is byte. The default value is -1, indicating the size of the AI Processor UB buffer in use. |
btSize |
Input |
Sets the size of the BiasTable buffer that can be used during Matmul computation. The unit is byte. The default value is -1, indicating the size of the AI Processor BiasTable buffer in use. |
Returns
-1: setting failed; 0: setting succeeded.
Restrictions
None
Example
1 2 3 4 5 6 7 8 9 10 11 12 | 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); tiling.SetBType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT16); tiling.SetCType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT); tiling.SetBiasType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT); tiling.SetShape(1024, 1024, 1024); tiling.SetOrgShape(1024, 1024, 1024); tiling.SetBias(true); tiling.SetBufferSpace(-1, -1, -1, -1); // Set the size of the available L1, L0C, UB, or BiasTable buffer space during computation. optiling::TCubeTiling tilingData; int ret = tiling.GetTiling(tilingData); |