Init

Function Description

Initializes the tiling data in the Matmul object. Resources are divided based on the tiling parameters. For details about the tiling parameters, see Matmul Tiling.

You can use REGIST_MATMUL_OBJ to initialize a single Matmul object without passing the tiling parameters. Later, you can use the Init API to pass the tiling parameters to adjust the tiling data. For example, in scenarios where tiling is variable, you can call Init to reset the tiling parameters for multiple times.

If no tiling change is required, you are advised to use REGIST_MATMUL_OBJ to pass tiling parameters for initialization.

Prototype

1
__aicore__ inline void Init(const TCubeTiling* __restrict cubeTiling, TPipe* tpipe = nullptr)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

cubeTiling

Input

Matmul tiling parameter. For details about the definition of the TCubeTiling structure, see Table 2 TCubeTiling structure description.

Tiling parameters can be obtained through GetTiling on the host and passed to the kernel for use.

tpipe

Input

Tpipe object.

Returns

None

Availability

Precautions

None

Example

1
2
3
// You can use REGIST_MATMUL_OBJ to initialize a single Matmul object without passes the tiling parameters. Later, you can use the Init API to pass the tiling parameters to adjust the tiling data.
REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm);
mm.Init(&tiling);