SetFixSplit

Function Usage

This API has the same functions as the recommended EnableMultiCoreSplitK.

Sets the fixed baseM, baseN, and baseK. The unit is the number of elements.

Prototype

1
int32_t SetFixSplit(int32_t baseM = -1, int32_t baseN = -1, int32_t baseK = -1)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

baseM

Input

Fixed size of baseM. The default value is -1, indicating that no fixed baseM is set and it is computed by the tiling function.

baseN

Input

Fixed size of baseN. The default value is -1, indicating that no fixed baseN is set and it is computed by the tiling function.

baseK

Input

Setting a fixed baseK is not supported. The default value is -1.

Returns

-1: setting failed; 0: setting succeeded.

Precautions

  • The size of the storage space occupied by baseM × baseN output elements cannot exceed the size of the L0C buffer, that is, baseM × baseN × sizeof(outputType) ≤ L0CSize.
  • The value of baseM must be less than or equal to the value of singleM that is 16-element aligned upwards. The value of baseN must be less than or equal to the value of singleN that is 16-element aligned upwards. For example, if singleM is 12, the value of baseM must be less than or equal to 16. In addition, it must be fractal-aligned. Therefore, baseM can only be 16. Otherwise, tiling information fails to be obtained.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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.SetFixSplit(16, 16, 16);  // Set the fixed baseM, baseN, and baseK.
tiling.SetBufferSpace(-1, -1, -1);
optiling::TCubeTiling tilingData;   
int ret = tiling.GetTiling(tilingData);