SetUserDefInfo
Function Description
Sets the operator tiling address for the callback function when the template parameter MatmulCallBack (customized callback function) is enabled. This API needs to be called only once.
Prototype
1 | __aicore__ inline void SetUserDefInfo(const uint64_t tilingPtr) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
tilingPtr |
Input |
Tiling address of the operator |
Returns
None
Availability
Precautions
If tilingPtr is required in the callback function, this API must be called. If it is not required, this API does not need to be called.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | // User-defined callback function void DataCopyOut(const __gm__ void *gm, const LocalTensor<int8_t> &co1Local, const void *dataCopyOutParams, const uint64_t tilingPtr, const uint64_t dataPtr); void CopyA1(const LocalTensor<int8_t> &aMatrix, const __gm__ void *gm, int row, int col, int useM, int useK, const uint64_t tilingPtr, const uint64_t dataPtr); void CopyB1(const LocalTensor<int8_t> &bMatrix, const __gm__ void *gm, int row, int col, int useK, int useN, const uint64_t tilingPtr, const uint64_t dataPtr); typedef matmul::MatmulType<AscendC::TPosition::GM, CubeFormat::ND, half> aType; typedef matmul::MatmulType<AscendC::TPosition::GM, CubeFormat::ND, half> bType; typedef matmul::MatmulType<AscendC::TPosition::GM, CubeFormat::ND, float> cType; typedef matmul::MatmulType<AscendC::TPosition::GM, CubeFormat::ND, float> biasType; Matmul<aType, bType, cType, biasType, CFG_NORM, MatmulCallBackFunc<DataCopyOut, CopyA1, CopyB1>> mm; REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); uint64_t tilingPtr = reinterpret_cast<uint64_t>(tiling); mm.SetUserDefInfo(tilingPtr); mm.SetTensorA(gmA); mm.SetTensorB(gmB); mm.IterateAll(); |
Parent topic: Matmul