cann/asc-devkit:SetSelfDefineData矩阵乘法接口
SetSelfDefineData【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit产品支持情况Ascend 950PR/Ascend 950DT支持Atlas A3 训练系列产品/Atlas A3 推理系列产品支持Atlas A2 训练系列产品/Atlas A2 推理系列产品支持Atlas 200I/500 A2 推理产品不支持Atlas 推理系列产品AI Core不支持Atlas 推理系列产品Vector Core不支持Atlas 训练系列产品不支持Kirin X90支持功能说明启用模板参数MatmulCallBackFunc自定义回调函数时设置需要的计算数据或在GM上存储的数据地址等信息用于回调函数使用。复用同一个Matmul对象时可以多次调用本接口重新设置对应数据信息。函数原型__aicore__ inline void SetSelfDefineData(const uint64_t dataPtr)__aicore__ inline void SetSelfDefineData(T dataPtr)Atlas A3 训练系列产品/Atlas A3 推理系列产品不支持SetSelfDefineData(T dataPtr)接口原型。Atlas A2 训练系列产品/Atlas A2 推理系列产品不支持SetSelfDefineData(T dataPtr)接口原型。Kirin X90产品不支持SetSelfDefineData(T dataPtr)接口原型。参数说明表1参数说明参数名输入/输出描述dataPtr输入设置的算子回调函数需要的计算数据或在GM上存储的数据地址等信息。其中类型T支持用户自定义基础结构体。返回值说明无约束说明若回调函数中需要使用dataPtr参数时必须调用此接口若回调函数不使用dataPtr参数无需调用此接口。当开启MixDualMaster双主模式场景时即模板参数enableMixDualMaster设置为true不支持使用该接口。本接口必须在SetTensorA接口、SetTensorB接口之前调用。调用示例// 用户自定义回调函数 void DataCopyOut( const __gm__ void* gm, const LocalTensorint8_t co1Local, const void* dataCopyOutParams, const uint64_t tilingPtr, const uint64_t dataPtr); void CopyA1( const LocalTensorint8_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 LocalTensorint8_t bMatrix, const __gm__ void* gm, int row, int col, int useK, int useN, const uint64_t tilingPtr, const uint64_t dataPtr); typedef AscendC::MatmulTypeAscendC::TPosition::GM, CubeFormat::ND, half aType; typedef AscendC::MatmulTypeAscendC::TPosition::GM, CubeFormat::ND, half bType; typedef AscendC::MatmulTypeAscendC::TPosition::GM, CubeFormat::ND, float cType; typedef AscendC::MatmulTypeAscendC::TPosition::GM, CubeFormat::ND, float biasType; AscendC::MatmulaType, bType, cType, biasType, CFG_NORM, MatmulCallBackFuncDataCopyOut, CopyA1, CopyB1 mm; REGIST_MATMUL_OBJ(pipe, GetSysWorkSpacePtr(), mm, tiling); GlobalTensorSrcT dataGM; // 保存有回调函数需使用的计算数据的GM uint64_t dataGMPtr reinterpret_castuint64_t(dataGM.address_); // 回调函数中需要使用dataPtr参数时必须调用此接口 mm.SetSelfDefineData(dataGMPtr); mm.SetTensorA(gmA); mm.SetTensorB(gmB); mm.IterateAll();【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考