EnableMultiCoreSplitK

Function Usage

In the multi-core scenario, this API is used to enable K-axis splitting. If this API is not called, the K axis is not split by default. This API is used before the GetTiling API is called.

Prototype

1
void EnableMultiCoreSplitK(bool flag)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

flag

Input

Whether to enable K-axis splitting.

  • true: K-axis splitting is enabled.
  • false: K-axis splitting is disabled.

Returns

None

Restrictions

  • When this API is used in an operator, the result of matrix C can be output only to Global Memory.
  • When using this API in an operator, you need to clear Global Memory before writing the matrix C slice result to Global Memory for the first time in the kernel code. Then, enable AtomicAdd accumulation when obtaining the matrix C slice result. If the Global Memory is not cleared in advance, precision problems may occur due to original invalid data in Global Memory during accumulation.
  • When this API is used in an operator, bias cannot be used for matrix multiplication.

Examples

For a complete operator sample, see operator sample for multi-core K splitting.

1
2
3
4
auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
matmul_tiling::MultiCoreMatmulTiling tiling(ascendcPlatform);  

tiling.EnableMultiCoreSplitK(true);  // Enable K-axis splitting.