SetBufferSpace

Function Usage

Size of the available L1/L0C/UB/BT 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

Table 1 Parameters

Parameter

Input/Output

Description

L1Size

Input

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

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

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

Size of the Bt buffer that can be used during Matmul computation. The unit is byte. The default value is -1, indicating the size of the AI Processor Bt buffer in use.

Returns

-1: setting failed; 0: setting succeeded.

Precautions

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);  // Set the size of the available L1/L0C/UB/BT space during computation.
optiling::TCubeTiling tilingData;   
int ret = tiling.GetTiling(tilingData);