REGIST_MATMUL_OBJ
Function
Initializes the Matmul object.
Prototype
1
|
REGIST_MATMUL_OBJ(tpipe, workspace, ...) |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
tpipe |
Input |
Tpipe object. |
|
workspace |
Input |
Pointer to the system workspace. |
|
... |
Input |
Variable parameter. If the Matmul object and the corresponding Tiling structure are passed, the data type of the Tiling structure must be TCubeTiling. Tiling parameters can be obtained through GetTiling on the host and passed to the kernel for use. |
Returns
None
Restrictions
- In separation mode, this API must be called prior to the InitBuffer API.
- A maximum of four Matmul objects can be defined in the program.
- When the code contains one Matmul object, the tiling parameters can be passed using the Init API instead of this API.
- When the code contains multiple Matmul objects, the Matmul objects must be one-to-one corresponding to the tiling parameters and be passed in sequence. For details, see the example.
Example
1 2 3 4 5 6 7 8 |
Tpipe pipe; // Recommendation: Initialize a single Matmul object and pass tiling parameters. REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); // Recommendation: Initialize multiple Matmul objects and pass the corresponding tiling parameters. REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm1, mm1tiling, mm2, mm2tiling, mm3, mm3tiling, mm4, mm4tiling); // Initialize a single Matmul object without passing tiling parameters. Note that in this scenario, the Init API needs to be used to pass tiling parameters. In this way, operations for the initialization of the Matmul object and setting for tiling parameters are separated. It is applicable to scenarios where tiling is variable and needs to be reset for multiple times. REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm); mm.Init(&tiling); |
Parent topic: Matmul Kernel APIs