SetFixSplit

Function

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

Prototype

1
int32_t SetFixSplit(int32_t baseMIn = -1, int32_t baseNIn = -1, int32_t baseKIn = -1)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

baseMIn

Input

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

baseNIn

Input

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

baseKIn

Input

The value can only be -1.

Returns

-1: setting failed; 0: setting succeeded.

Restrictions

  • 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(C_TYPE) ≤ L0CSize.
  • baseM must be less than or equal to singleM aligned upward to 16 elements (for example, ceil(singleM/16) × 16).

    baseN must be less than or equal to singleN aligned upward to C0_size elements.

    singleM is the length of the M axis within a single core, and singleN is the length of the N axis within a single core.

    C0_size depends on the data type:

    For half or bfloat16_t, C0_size is 16.

    For float, C0_size is 8.

    For int8_t, C0_size is 32.

    For int4b_t, C0_size is 64.

    For example, if singleM is 12, baseM must be ≤ 16. In addition, baseM must meet fractal alignment requirements, so the only valid choice is 16. If baseM is set to any value greater than 16, GetTiling will fail.

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, -1);  // Set the fixed baseM and baseN.
tiling.SetBufferSpace(-1, -1, -1);
optiling::TCubeTiling tilingData;   
int ret = tiling.GetTiling(tilingData);