diff --git a/third_party/acl/inc/acl/acl_op_compiler.h b/third_party/acl/inc/acl/acl_op_compiler.h index 338ec40e4c8bf0c71cb49b018eb1e95bf8e0fc82..0807efbd8ed85ed77531ee78904e6ba9515f4103 100644 --- a/third_party/acl/inc/acl/acl_op_compiler.h +++ b/third_party/acl/inc/acl/acl_op_compiler.h @@ -93,12 +93,6 @@ ACL_FUNC_VISIBILITY aclError aclopCompileAndExecute(const char *opType, const aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag, const char *opPath, aclrtStream stream); -ACL_FUNC_VISIBILITY aclError aclopCompileAndExecuteV2(const char *opType, - int numInputs, aclTensorDesc *inputDesc[], aclDataBuffer *inputs[], - int numOutputs, aclTensorDesc *outputDesc[], aclDataBuffer *outputs[], - aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag, - const char *opPath, aclrtStream stream); - /** * @ingroup AscendCL * @brief set compile option diff --git a/third_party/acl/libs/acl_op_compiler.cpp b/third_party/acl/libs/acl_op_compiler.cpp index aaa4886cd7194625e27fb10f96f694e6e8f24516..ea5feee96822a19c6482e48e9a57c5a0d05a2385 100644 --- a/third_party/acl/libs/acl_op_compiler.cpp +++ b/third_party/acl/libs/acl_op_compiler.cpp @@ -43,22 +43,6 @@ aclError aclopCompileAndExecute( return 0; } -aclError aclopCompileAndExecuteV2( - const char* opType, - int numInputs, - aclTensorDesc *inputDesc[], - aclDataBuffer *inputs[], - int numOutputs, - aclTensorDesc *outputDesc[], - aclDataBuffer *outputs[], - aclopAttr* attr, - aclopEngineType engineType, - aclopCompileType compileFlag, - const char* opPath, - aclrtStream stream) { - return 0; -} - void GeGeneratorFinalize() { return; } diff --git a/torch_npu/csrc/framework/OpParamMaker.cpp b/torch_npu/csrc/framework/OpParamMaker.cpp index 710b6d0508f8d344c336d8e1215695e67f2ccba4..b573ba30e453006402aefa0cfd16f5991ed28750 100644 --- a/torch_npu/csrc/framework/OpParamMaker.cpp +++ b/torch_npu/csrc/framework/OpParamMaker.cpp @@ -177,7 +177,7 @@ namespace at_npu stream); } else { int64_t dimSize; - ret = aclopCompileAndExecuteV2( + ret = at_npu::native::AclopCompileAndExecuteV2( name.c_str(), inputSize, const_cast(params.inDesc.data()), diff --git a/torch_npu/csrc/framework/interface/AclOpCompileInterface.cpp b/torch_npu/csrc/framework/interface/AclOpCompileInterface.cpp index dd464b3a68c873e4a0d7b97a0aaa2b9e16aec45b..0c1b7f1d44680430fc3aa0b0e494932930c9146f 100644 --- a/torch_npu/csrc/framework/interface/AclOpCompileInterface.cpp +++ b/torch_npu/csrc/framework/interface/AclOpCompileInterface.cpp @@ -33,6 +33,7 @@ namespace at_npu REGISTER_LIBRARY(libacl_op_compiler) LOAD_FUNCTION(aclopSetCompileFlag) LOAD_FUNCTION(aclGenGraphAndDumpForOp) + LOAD_FUNCTION(aclopCompileAndExecuteV2) LOAD_FUNCTION(aclCreateGraphDumpOpt) LOAD_FUNCTION(aclDestroyGraphDumpOpt) @@ -67,6 +68,26 @@ aclError AclGenGraphAndDumpForOp(const char *opType, return ret; } +aclError AclopCompileAndExecuteV2(const char *opType, + int numInputs, aclTensorDesc *inputDesc[], aclDataBuffer *inputs[], + int numOutputs, aclTensorDesc *outputDesc[], aclDataBuffer *outputs[], + aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag, + const char *opPath, aclrtStream stream) { + typedef aclError(*AclopCompileAndExecuteV2Func)(const char *, + int, aclTensorDesc * [], aclDataBuffer * [], + int, aclTensorDesc * [], aclDataBuffer * [], + aclopAttr *, aclopEngineType, aclopCompileType, + const char *, aclrtStream); + static AclopCompileAndExecuteV2Func func = nullptr; + if (func == nullptr) { + func = (AclopCompileAndExecuteV2Func)GET_FUNC(aclGenGraphAndDumpForOp); + } + TORCH_CHECK(func, "Failed to find function ", "aclGenGraphAndDumpForOp"); + auto ret = func(opType, numInputs, inputDesc, inputs, numOutputs, + outputDesc, outputs, attr, engineType, compileFlag, opPath, stream); + return ret; +} + aclGraphDumpOption* AclCreateGraphDumpOpt() { typedef aclGraphDumpOption*(*AclCreateGraphDumpOptFunc)(); static AclCreateGraphDumpOptFunc func = nullptr; diff --git a/torch_npu/csrc/framework/interface/AclOpCompileInterface.h b/torch_npu/csrc/framework/interface/AclOpCompileInterface.h index f59f7fe841cf652a82b50755a34378e2b7c730e4..911a8b5578991ad754e5e9c30ed092936dfdacb1 100644 --- a/torch_npu/csrc/framework/interface/AclOpCompileInterface.h +++ b/torch_npu/csrc/framework/interface/AclOpCompileInterface.h @@ -58,6 +58,12 @@ aclError AclGenGraphAndDumpForOp(const char *opType, const aclopAttr *attr, aclopEngineType engineType, const char *graphDumpPath, aclGraphDumpOption* graphdumpOpt); +aclError AclopCompileAndExecuteV2(const char *opType, + int numInputs, aclTensorDesc *inputDesc[], aclDataBuffer *inputs[], + int numOutputs, aclTensorDesc *outputDesc[], aclDataBuffer *outputs[], + aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag, + const char *opPath, aclrtStream stream); + /** * @brief create the dump option for AclGenGraphAndDumpForOp API, used for AOE * @retval created aclGraphDumpOption