From e01e544feb136186645625d041c2c8b21852d0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= Date: Tue, 26 Aug 2025 01:05:18 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!6813=20?= =?UTF-8?q?:=20Move=20exe=5Fgraph=20runtime=20to=20base'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/CMakeLists.txt | 185 +----------------- .../context_builder/op_context_builder_impl.h | 2 +- exe_graph/CMakeLists.txt | 169 +++++++++++++++- .../runtime/compute_node_info.cc | 0 .../runtime/op_execute_context.cc | 0 {base => exe_graph}/runtime/runtime_attrs.cc | 0 .../runtime/runtime_attrs_def.h | 0 {base => exe_graph}/runtime/tiling_data.cc | 60 +++--- inc/base/attr/attrs_to_buffer.h | 2 +- inc/external/base/runtime/runtime_attrs_def.h | 25 --- register/CMakeLists.txt | 1 + tests/run_test.sh | 2 +- ...bi_compatibility_for_exe_graph_unittest.cc | 2 +- 13 files changed, 212 insertions(+), 236 deletions(-) rename {base => exe_graph}/runtime/compute_node_info.cc (100%) rename {base => exe_graph}/runtime/op_execute_context.cc (100%) rename {base => exe_graph}/runtime/runtime_attrs.cc (100%) rename {base => exe_graph}/runtime/runtime_attrs_def.h (100%) rename {base => exe_graph}/runtime/tiling_data.cc (97%) delete mode 100644 inc/external/base/runtime/runtime_attrs_def.h diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 06147b9f30..3c741f83a2 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -138,10 +138,10 @@ set(SRC_LIST "attr/attr_store.cc" "any_value.cc" "common/plugin/plugin_manager.cc" - "runtime/compute_node_info.cc" - "runtime/op_execute_context.cc" - "runtime/runtime_attrs.cc" - "runtime/tiling_data.cc" + "../exe_graph/runtime/compute_node_info.cc" + "../exe_graph/runtime/op_execute_context.cc" + "../exe_graph/runtime/runtime_attrs.cc" + "../exe_graph/runtime/tiling_data.cc" context_builder/op_context_builder_impl.cc context_builder/context_holder.cc context_builder/op_info.cc @@ -318,179 +318,4 @@ endif () ############ install ############ install(TARGETS stub_metadef OPTIONAL LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub -) - -######### 因为兼容性需要保留原有的libexe_graph.so ############# -set(EXE_GRAPH_SRCS - runtime/compute_node_info.cc - runtime/op_execute_context.cc - runtime/runtime_attrs.cc - runtime/tiling_data.cc - ) - -add_library(exe_graph SHARED ${EXE_GRAPH_SRCS}) - -target_include_directories(exe_graph PRIVATE - ${METADEF_DIR} - ) - -target_include_directories(exe_graph PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}/proto/metadef_protos - ) - -target_link_libraries(exe_graph PRIVATE - intf_pub - mmpa_headers - metadef_headers - error_manager - c_sec - slog - $<$>:-lrt> - -ldl - ) - -target_compile_definitions(exe_graph PRIVATE - google=ascend_private - $<$:ONLY_COMPILE_OPEN_SRC> - $,OS_TYPE=WIN,OS_TYPE=0> - $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> - ) - -target_compile_options(exe_graph PRIVATE - $<$:-O2 -fPIC -Wextra -Wfloat-equal -fno-common> - $<$,$>:/MTd> - $<$,$>:/MT> - ) - -if (NOT ENABLE_OPEN_SRC) - ######### libexe_graph_static.a ############# - target_clone(exe_graph exe_graph_static STATIC) - target_compile_options(exe_graph_static PRIVATE $<$:-O2 -fPIC -Wextra -Wfloat-equal>) - set_target_properties(exe_graph_static PROPERTIES OUTPUT_NAME exe_graph) - - ############ install ############ - install(TARGETS exe_graph_static OPTIONAL - ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} - ) -endif() - -############################################################## -set(STUB_HEADER_LIST_EXE_GRAPH - ${METADEF_DIR}/inc/external/exe_graph/runtime/compute_node_info.h - ${METADEF_DIR}/inc/external/exe_graph/runtime/runtime_attrs.h - ${METADEF_DIR}/inc/external/exe_graph/runtime/tiling_data.h - ) - -list(TRANSFORM STUB_HEADER_LIST_EXE_GRAPH - REPLACE "^.*/([^/]+)\\.h$" "${CMAKE_CURRENT_BINARY_DIR}/stub_\\1.cc" - OUTPUT_VARIABLE STUB_SRC_LIST_EXE_GRAPH - ) - -add_custom_command( - OUTPUT ${STUB_SRC_LIST_EXE_GRAPH} - COMMAND echo "Generating stub files." - && ${HI_PYTHON} ${METADEF_DIR}/tests/stub/gen_stubapi.py ${CMAKE_CURRENT_BINARY_DIR} ${STUB_HEADER_LIST_EXE_GRAPH} - && echo "Generating stub files end." -) - -add_custom_target(exe_graph_stub DEPENDS ${STUB_SRC_LIST_EXE_GRAPH}) - -############ exe_meta_device ############ -set(STUB_ERROR_MANAGER_SRC - ${CMAKE_CURRENT_BINARY_DIR}/stub_error_manager.cc - ${CMAKE_CURRENT_BINARY_DIR}/stub_err_msg.cc - ) -add_custom_command( - OUTPUT ${STUB_ERROR_MANAGER_SRC} - COMMAND echo "Generating stub files." - && ${HI_PYTHON} ${CMAKE_CURRENT_LIST_DIR}/../error_manager/stub/gen_stubapi.py ${METADEF_DIR}/inc/common/util ${CMAKE_CURRENT_BINARY_DIR} - && ${HI_PYTHON} ${CMAKE_CURRENT_LIST_DIR}/../error_manager/stub/gen_stubapi.py ${METADEF_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR} - && echo "Generating stub files end." -) -add_library(exe_meta_device STATIC - "${METADEF_DIR}/base/runtime/tiling_data.cc" - "${METADEF_DIR}/base/runtime/runtime_attrs.cc" - "${METADEF_DIR}/base/runtime/compute_node_info.cc" - "${STUB_ERROR_MANAGER_SRC}") -target_include_directories(exe_meta_device PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${METADEF_DIR}/inc/common/util - ${METADEF_DIR}/inc/external - ) -add_library(exe_meta_device_headers INTERFACE) -target_include_directories(exe_meta_device_headers INTERFACE - $ - $ - ) -target_link_libraries(exe_meta_device PRIVATE intf_pub slog_headers c_sec_headers) -target_link_libraries(exe_meta_device PUBLIC exe_meta_device_headers) -target_compile_options(exe_meta_device PRIVATE - -O2 - -fPIC - -Wextra - -Wfloat-equal - -D_FORTIFY_SOURCE=2 - ) - -install(TARGETS exe_meta_device OPTIONAL - ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} - ) - -############ stub/libexe_graph.so ############ -add_library(stub_exe_graph SHARED ${STUB_SRC_LIST_EXE_GRAPH}) - -add_dependencies(stub_exe_graph exe_graph_stub) - -target_include_directories(stub_exe_graph PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}/proto/metadef_protos - ) - -target_compile_options(stub_exe_graph PRIVATE - -Wfloat-equal - -fno-common - -Os - -Werror=return-type - ) - -target_link_libraries(stub_exe_graph - PRIVATE - intf_pub - c_sec_headers - PUBLIC - metadef_headers - ) - -set_target_properties(stub_exe_graph PROPERTIES - OUTPUT_NAME exe_graph - LIBRARY_OUTPUT_DIRECTORY stub - ) - -############ stub/libexe_graph.a ############ -if (NOT ENABLE_OPEN_SRC) - target_clone(stub_exe_graph stub_exe_graph_static STATIC) - - add_dependencies(stub_exe_graph_static exe_graph_stub) - - target_compile_options(stub_exe_graph_static PRIVATE - -ffunction-sections - -fdata-sections - ) - set_target_properties(stub_exe_graph_static PROPERTIES - OUTPUT_NAME exe_graph - ARCHIVE_OUTPUT_DIRECTORY stub - ) - - ############ install ############ - install(TARGETS stub_exe_graph_static OPTIONAL - ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub - ) -endif () - -############ install ############ -install(TARGETS stub_exe_graph OPTIONAL - LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub - ) \ No newline at end of file +) \ No newline at end of file diff --git a/base/context_builder/op_context_builder_impl.h b/base/context_builder/op_context_builder_impl.h index 5f9bd76f52..e98e02261b 100644 --- a/base/context_builder/op_context_builder_impl.h +++ b/base/context_builder/op_context_builder_impl.h @@ -18,7 +18,7 @@ #include "graph/debug/ge_log.h" #include "common/checker.h" #include "base/context_builder/op_info_impl.h" -#include "base/runtime/runtime_attrs_def.h" +#include "exe_graph/runtime/runtime_attrs_def.h" #include "graph/debug/ge_util.h" namespace gert { struct TilingInfo { diff --git a/exe_graph/CMakeLists.txt b/exe_graph/CMakeLists.txt index 2674314518..e08f1c0b74 100644 --- a/exe_graph/CMakeLists.txt +++ b/exe_graph/CMakeLists.txt @@ -9,6 +9,13 @@ include(${METADEF_DIR}/cmake/build_type.cmake) +set(EXE_GRAPH_SRCS + runtime/compute_node_info.cc + runtime/op_execute_context.cc + runtime/runtime_attrs.cc + runtime/tiling_data.cc +) + set(LOWERING_SRCS lowering/data_dependent_interpreter.cc lowering/device_tiling_context_builder.cc @@ -28,6 +35,43 @@ set(LOWERING_SRCS lowering/value_holder_utils.cc ) +######### libexe_graph.so ############# +add_library(exe_graph SHARED ${EXE_GRAPH_SRCS}) + +target_include_directories(exe_graph PRIVATE + ${METADEF_DIR} +) + +target_include_directories(exe_graph PRIVATE + ${CMAKE_CURRENT_LIST_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/proto/metadef_protos +) + +target_link_libraries(exe_graph PRIVATE + intf_pub + mmpa_headers + metadef_headers + error_manager + c_sec + slog + $<$>:-lrt> + -ldl +) + +target_compile_definitions(exe_graph PRIVATE + google=ascend_private + $<$:ONLY_COMPILE_OPEN_SRC> + $,OS_TYPE=WIN,OS_TYPE=0> + $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> +) + +target_compile_options(exe_graph PRIVATE + $<$:-O2 -fPIC -Wextra -Wfloat-equal -fno-common> + $<$,$>:/MTd> + $<$,$>:/MT> +) + ######### liblowering.so ############# add_library(lowering SHARED ${LOWERING_SRCS}) @@ -71,6 +115,11 @@ target_link_libraries(lowering PRIVATE ) if (NOT ENABLE_OPEN_SRC) + ######### libexe_graph_static.a ############# + target_clone(exe_graph exe_graph_static STATIC) + target_compile_options(exe_graph_static PRIVATE $<$:-O2 -fPIC -Wextra -Wfloat-equal>) + set_target_properties(exe_graph_static PROPERTIES OUTPUT_NAME exe_graph) + ######### liblowering_static.a ############# target_clone(lowering lowering_static STATIC) target_link_libraries(lowering_static PRIVATE @@ -82,15 +131,77 @@ if (NOT ENABLE_OPEN_SRC) set_target_properties(lowering_static PROPERTIES OUTPUT_NAME lowering) ############ install ############ - install(TARGETS lowering_static OPTIONAL + install(TARGETS exe_graph_static lowering_static OPTIONAL ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} ) endif() +############ exe_meta_device ############ +set(STUB_ERROR_MANAGER_SRC + ${CMAKE_CURRENT_BINARY_DIR}/stub_error_manager.cc + ${CMAKE_CURRENT_BINARY_DIR}/stub_err_msg.cc +) +add_custom_command( + OUTPUT ${STUB_ERROR_MANAGER_SRC} + COMMAND echo "Generating stub files." + && ${HI_PYTHON} ${CMAKE_CURRENT_LIST_DIR}/../error_manager/stub/gen_stubapi.py ${METADEF_DIR}/inc/common/util ${CMAKE_CURRENT_BINARY_DIR} + && ${HI_PYTHON} ${CMAKE_CURRENT_LIST_DIR}/../error_manager/stub/gen_stubapi.py ${METADEF_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR} + && echo "Generating stub files end." +) +add_library(exe_meta_device STATIC + "${METADEF_DIR}/exe_graph/runtime/tiling_data.cc" + "${METADEF_DIR}/exe_graph/runtime/runtime_attrs.cc" + "${METADEF_DIR}/exe_graph/runtime/compute_node_info.cc" + "${STUB_ERROR_MANAGER_SRC}") +target_include_directories(exe_meta_device PRIVATE + ${CMAKE_CURRENT_LIST_DIR} + ${METADEF_DIR}/inc/common/util + ${METADEF_DIR}/inc/external +) +add_library(exe_meta_device_headers INTERFACE) +target_include_directories(exe_meta_device_headers INTERFACE + $ + $ +) +target_link_libraries(exe_meta_device PRIVATE intf_pub slog_headers c_sec_headers) +target_link_libraries(exe_meta_device PUBLIC exe_meta_device_headers) +target_compile_options(exe_meta_device PRIVATE + -O2 + -fPIC + -Wextra + -Wfloat-equal + -D_FORTIFY_SOURCE=2 +) + +install(TARGETS exe_meta_device OPTIONAL + ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR} +) + +############################################################## +set(STUB_HEADER_LIST_EXE_GRAPH + ${METADEF_DIR}/inc/external/exe_graph/runtime/compute_node_info.h + ${METADEF_DIR}/inc/external/exe_graph/runtime/runtime_attrs.h + ${METADEF_DIR}/inc/external/exe_graph/runtime/tiling_data.h + ${METADEF_DIR}/inc/exe_graph/lowering/device_tiling_context_builder.h +) + +list(TRANSFORM STUB_HEADER_LIST_EXE_GRAPH + REPLACE "^.*/([^/]+)\\.h$" "${CMAKE_CURRENT_BINARY_DIR}/stub_\\1.cc" + OUTPUT_VARIABLE STUB_SRC_LIST_EXE_GRAPH +) + +add_custom_command( + OUTPUT ${STUB_SRC_LIST_EXE_GRAPH} + COMMAND echo "Generating stub files." + && ${HI_PYTHON} ${METADEF_DIR}/tests/stub/gen_stubapi.py ${CMAKE_CURRENT_BINARY_DIR} ${STUB_HEADER_LIST_EXE_GRAPH} + && echo "Generating stub files end." +) + +add_custom_target(exe_graph_stub DEPENDS ${STUB_SRC_LIST_EXE_GRAPH}) + ############################################################## set(STUB_HEADER_LIST_LOWERING ${METADEF_DIR}/inc/exe_graph/lowering/bg_kernel_context_extend.h - ${METADEF_DIR}/inc/exe_graph/lowering/device_tiling_context_builder.h ) list(TRANSFORM STUB_HEADER_LIST_LOWERING @@ -107,6 +218,58 @@ add_custom_command( add_custom_target(lowering_stub DEPENDS ${STUB_SRC_LIST_LOWERING}) +############ stub/libexe_graph.so ############ +add_library(stub_exe_graph SHARED ${STUB_SRC_LIST_EXE_GRAPH}) + +add_dependencies(stub_exe_graph exe_graph_stub) + +target_include_directories(stub_exe_graph PRIVATE + ${CMAKE_CURRENT_LIST_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/proto/metadef_protos +) + +target_compile_options(stub_exe_graph PRIVATE + -Wfloat-equal + -fno-common + -Os + -Werror=return-type +) + +target_link_libraries(stub_exe_graph + PRIVATE + intf_pub + c_sec_headers + PUBLIC + metadef_headers +) + +set_target_properties(stub_exe_graph PROPERTIES + OUTPUT_NAME exe_graph + LIBRARY_OUTPUT_DIRECTORY stub +) + +############ stub/libexe_graph.a ############ +if (NOT ENABLE_OPEN_SRC) + target_clone(stub_exe_graph stub_exe_graph_static STATIC) + + add_dependencies(stub_exe_graph_static exe_graph_stub) + + target_compile_options(stub_exe_graph_static PRIVATE + -ffunction-sections + -fdata-sections + ) + set_target_properties(stub_exe_graph_static PROPERTIES + OUTPUT_NAME exe_graph + ARCHIVE_OUTPUT_DIRECTORY stub + ) + + ############ install ############ + install(TARGETS stub_exe_graph_static OPTIONAL + ARCHIVE DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub + ) +endif () + ############ stub/liblowering.so ############ add_library(stub_lowering SHARED ${STUB_SRC_LIST_LOWERING}) @@ -160,6 +323,6 @@ if (NOT ENABLE_OPEN_SRC) endif () ############ install ############ -install(TARGETS stub_lowering OPTIONAL +install(TARGETS stub_exe_graph stub_lowering OPTIONAL LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/${CMAKE_SYSTEM_PROCESSOR}/stub ) diff --git a/base/runtime/compute_node_info.cc b/exe_graph/runtime/compute_node_info.cc similarity index 100% rename from base/runtime/compute_node_info.cc rename to exe_graph/runtime/compute_node_info.cc diff --git a/base/runtime/op_execute_context.cc b/exe_graph/runtime/op_execute_context.cc similarity index 100% rename from base/runtime/op_execute_context.cc rename to exe_graph/runtime/op_execute_context.cc diff --git a/base/runtime/runtime_attrs.cc b/exe_graph/runtime/runtime_attrs.cc similarity index 100% rename from base/runtime/runtime_attrs.cc rename to exe_graph/runtime/runtime_attrs.cc diff --git a/base/runtime/runtime_attrs_def.h b/exe_graph/runtime/runtime_attrs_def.h similarity index 100% rename from base/runtime/runtime_attrs_def.h rename to exe_graph/runtime/runtime_attrs_def.h diff --git a/base/runtime/tiling_data.cc b/exe_graph/runtime/tiling_data.cc similarity index 97% rename from base/runtime/tiling_data.cc rename to exe_graph/runtime/tiling_data.cc index 473dcc3393..7e3b61a8b3 100644 --- a/base/runtime/tiling_data.cc +++ b/exe_graph/runtime/tiling_data.cc @@ -16,16 +16,6 @@ namespace gert { namespace { using AppendAttrFunc = std::function; -template -T2 GetValue(const T1 attr) { - return static_cast(attr); -} - -template<> -bool GetValue(const float attr) { - return (std::abs(attr) > std::numeric_limits::epsilon()); -} - template ge::graphStatus CheckOverFlow(const size_t attr_size, const size_t tiling_data_size, const size_t capacity) { size_t append_size; @@ -75,7 +65,9 @@ ge::graphStatus AppendListListAttr(TilingData *tiling_data, const RuntimeAttrs * GE_CHECK_NOTNULL(attr_data); const auto ret = tiling_data->Append(ge::PtrToPtr(attr_data->GetData()), attr_data->GetSize()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } } return ge::GRAPH_SUCCESS; } @@ -89,7 +81,7 @@ ge::graphStatus AppendConvertedAttr(TilingData *tiling_data, const RuntimeAttrs if (!ge::IntegerChecker::Compat(*attr)) { GELOGW("[Check][Param] attr[%zu] overflow, large than max dst type", attr_index); } - T2 attr_data = GetValue(*attr); + T2 attr_data = static_cast(*attr); return tiling_data->Append(attr_data); } @@ -100,7 +92,9 @@ ge::graphStatus AppendConvertedListAttr(TilingData *tiling_data, const RuntimeAt const ContinuousVector *attr = attrs->GetAttrPointer(attr_index); GE_CHECK_NOTNULL(attr); const auto ret = CheckOverFlow(attr->GetSize(), tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); const T1 *attr_data = ge::PtrToPtr(attr->GetData()); @@ -108,7 +102,7 @@ ge::graphStatus AppendConvertedListAttr(TilingData *tiling_data, const RuntimeAt T2 *tiling_data_ptr = ge::PtrToPtr(ge::PtrToPtr(tiling_data->GetData()) + data_size); GE_CHECK_NOTNULL(tiling_data_ptr); for (size_t i = 0UL; i < attr->GetSize(); ++i) { - tiling_data_ptr[i] = GetValue(attr_data[i]); + tiling_data_ptr[i] = static_cast(attr_data[i]); } data_size += attr->GetSize() * sizeof(T2); tiling_data->SetDataSize(data_size); @@ -127,7 +121,9 @@ ge::graphStatus AppendConvertedListListAttr(TilingData *tiling_data, const Runti attr_size += attr->Get(i)->GetSize(); } const auto ret = CheckOverFlow(attr_size, tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); for (size_t i = 0UL; i < attr->GetSize(); ++i) { @@ -138,7 +134,7 @@ ge::graphStatus AppendConvertedListListAttr(TilingData *tiling_data, const Runti T2 *tiling_data_ptr = ge::PtrToPtr(ge::PtrToPtr(tiling_data->GetData()) + data_size); GE_CHECK_NOTNULL(tiling_data_ptr); for (size_t j = 0UL; j < attr_data->GetSize(); ++j) { - tiling_data_ptr[j] = GetValue(attr_data_data[j]); + tiling_data_ptr[j] = static_cast(attr_data_data[j]); } data_size += attr_data->GetSize() * sizeof(T2); } @@ -171,7 +167,9 @@ ge::graphStatus AppendConvertedListF32AttrToF16(TilingData *tiling_data, const R const ContinuousVector *attr = attrs->GetAttrPointer(attr_index); GE_CHECK_NOTNULL(attr); const auto ret = CheckOverFlow(attr->GetSize(), tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); const float *attr_data = ge::PtrToPtr(attr->GetData()); @@ -198,7 +196,9 @@ ge::graphStatus AppendConvertedListListF32AttrToF16(TilingData *tiling_data, con attr_size += attr->Get(i)->GetSize(); } const auto ret = CheckOverFlow(attr_size, tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); for (size_t i = 0UL; i < attr->GetSize(); ++i) { @@ -235,7 +235,9 @@ ge::graphStatus AppendConvertedListF32AttrToBf16(TilingData *tiling_data, const const ContinuousVector *attr = attrs->GetAttrPointer(attr_index); GE_CHECK_NOTNULL(attr); const auto ret = CheckOverFlow(attr->GetSize(), tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); const float *attr_data = ge::PtrToPtr(attr->GetData()); @@ -262,7 +264,9 @@ ge::graphStatus AppendConvertedListListF32AttrToBf16(TilingData *tiling_data, co attr_size += attr->Get(i)->GetSize(); } const auto ret = CheckOverFlow(attr_size, tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); for (size_t i = 0UL; i < attr->GetSize(); ++i) { @@ -301,7 +305,9 @@ ge::graphStatus AppendConvertedListAttrToF16(TilingData *tiling_data, const Runt const ContinuousVector *attr = attrs->GetAttrPointer(attr_index); GE_CHECK_NOTNULL(attr); const auto ret = CheckOverFlow(attr->GetSize(), tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); const T *attr_data = ge::PtrToPtr(attr->GetData()); @@ -329,7 +335,9 @@ ge::graphStatus AppendConvertedListListAttrToF16(TilingData *tiling_data, const attr_size += attr->Get(i)->GetSize(); } const auto ret = CheckOverFlow(attr_size, tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); for (size_t i = 0UL; i < attr->GetSize(); ++i) { @@ -368,7 +376,9 @@ ge::graphStatus AppendConvertedListAttrToBf16(TilingData *tiling_data, const Run const ContinuousVector *attr = attrs->GetAttrPointer(attr_index); GE_CHECK_NOTNULL(attr); const auto ret = CheckOverFlow(attr->GetSize(), tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); const T *attr_data = ge::PtrToPtr(attr->GetData()); @@ -396,7 +406,9 @@ ge::graphStatus AppendConvertedListListAttrToBf16(TilingData *tiling_data, const attr_size += attr->Get(i)->GetSize(); } const auto ret = CheckOverFlow(attr_size, tiling_data->GetDataSize(), tiling_data->GetCapacity()); - GE_RETURN_IF_ERROR(ret); + if (ret != ge::GRAPH_SUCCESS) { + return ret; + } auto data_size = tiling_data->GetDataSize(); for (size_t i = 0UL; i < attr->GetSize(); ++i) { diff --git a/inc/base/attr/attrs_to_buffer.h b/inc/base/attr/attrs_to_buffer.h index 357ad7e490..96c30dd451 100644 --- a/inc/base/attr/attrs_to_buffer.h +++ b/inc/base/attr/attrs_to_buffer.h @@ -11,7 +11,7 @@ #define METADEF_INC_BASE_ATTR_ATTRS_TO_BUFFER_H_ #include "exe_graph/runtime/runtime_attrs.h" #include "exe_graph/runtime/continuous_vector.h" -#include "base/runtime/runtime_attrs_def.h" +#include "exe_graph/runtime/runtime_attrs_def.h" #include #include #include "common/ge_common/debug/ge_log.h" diff --git a/inc/external/base/runtime/runtime_attrs_def.h b/inc/external/base/runtime/runtime_attrs_def.h deleted file mode 100644 index 231dc6abfe..0000000000 --- a/inc/external/base/runtime/runtime_attrs_def.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (c) 2024 Huawei Technologies Co., Ltd. - * This file is a part of the CANN Open Software. - * Licensed under CANN Open Software License Agreement Version 1.0 (the "License"). - * Please refer to the License for details. You may not use this file except in compliance with the License. - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. - * See LICENSE in the root of the software repository for the full text of the License. - * ===================================================================================================================*/ - -#ifndef INC_EXTERNAL_BASE_RUNTIME_RUNTIME_ATTRS_DEF_H_ -#define INC_EXTERNAL_BASE_RUNTIME_RUNTIME_ATTRS_DEF_H_ -#include -#ifdef __cplusplus -extern "C" { -#endif -typedef struct { - size_t attr_num; - uint8_t reserved_[40]; // Reserved field, 32+8, do not directly use when only 8-byte left - size_t offset[0]; -} RuntimeAttrsDef; -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_BASE_RUNTIME_RUNTIME_ATTRS_DEF_H_ diff --git a/register/CMakeLists.txt b/register/CMakeLists.txt index da058c1698..fdc5540b9d 100644 --- a/register/CMakeLists.txt +++ b/register/CMakeLists.txt @@ -78,6 +78,7 @@ set(SRC_LIST "${METADEF_DIR}/exe_graph/lowering/kernel_run_context_builder.cc" "${METADEF_DIR}/exe_graph/lowering/bg_kernel_context_extend.cc" "${METADEF_DIR}/exe_graph/lowering/buffer_pool.cc" + "${METADEF_DIR}/exe_graph/runtime/compute_node_info.cc" "${METADEF_DIR}/exe_graph/lowering/bg_ir_attrs.cc" ) diff --git a/tests/run_test.sh b/tests/run_test.sh index 91b5e2b08a..9280b5a2ad 100755 --- a/tests/run_test.sh +++ b/tests/run_test.sh @@ -227,7 +227,7 @@ main() { -d ${BUILD_RELATIVE_PATH}/register/CMakeFiles/register.dir \ -d ${BUILD_RELATIVE_PATH}/register/CMakeFiles/rt2_registry_objects.dir \ -d ${BUILD_RELATIVE_PATH}/error_manager/CMakeFiles/error_manager.dir \ - -d ${BUILD_RELATIVE_PATH}/base/CMakeFiles/exe_graph.dir \ + -d ${BUILD_RELATIVE_PATH}/exe_graph/CMakeFiles/exe_graph.dir \ -d ${BUILD_RELATIVE_PATH}/exe_graph/CMakeFiles/lowering.dir \ -d ${BUILD_RELATIVE_PATH}/tests/ut/exe_graph/CMakeFiles/ut_exe_graph.dir \ -o cov/tmp.info diff --git a/tests/ut/exe_graph/abi_compatibility_for_exe_graph_unittest.cc b/tests/ut/exe_graph/abi_compatibility_for_exe_graph_unittest.cc index 0a6f153a82..dd411be063 100644 --- a/tests/ut/exe_graph/abi_compatibility_for_exe_graph_unittest.cc +++ b/tests/ut/exe_graph/abi_compatibility_for_exe_graph_unittest.cc @@ -12,7 +12,7 @@ #define private public #include "exe_graph/runtime/tensor.h" #include "exe_graph/runtime/compute_node_info.h" -#include "base/runtime/runtime_attrs_def.h" +#include "exe_graph/runtime/runtime_attrs_def.h" #include "exe_graph/runtime/infer_shape_range_context.h" #include "exe_graph/runtime/infer_shape_context.h" #include "exe_graph/runtime/infer_datatype_context.h" -- Gitee