Browse Source

!2030 fix error code and add complex128 support

Merge pull request !2030 from lichun/master
tags/v1.5.1
i-robot Gitee 3 years ago
parent
commit
460406cbd6
8 changed files with 101 additions and 9 deletions
  1. +0
    -1
      ge/generator/ge_generator.cc
  2. +1
    -1
      ge/graph/build/memory/graph_mem_assigner.cc
  3. +3
    -2
      ge/graph/build/memory/memory_assigner.cc
  4. +2
    -2
      ge/graph/manager/graph_manager.cc
  5. +2
    -1
      ge/offline/single_op_parser.cc
  6. +1
    -0
      tests/ut/ge/CMakeLists.txt
  7. +90
    -0
      tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc
  8. +2
    -2
      tests/ut/ge/graph_ir/ge_ir_build_unittest.cc

+ 0
- 1
ge/generator/ge_generator.cc View File

@@ -1158,7 +1158,6 @@ Status GeGenerator::Impl::BuildModel(const Graph &graph, const vector<GeTensor>
if (ret != SUCCESS) {
REPORT_CALL_ERROR("E19999", "build graph failed, graph id:%u, ret:%d", graph_id, ret);
GELOGE(GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED, "[Build][Graph] fail, graph id: %u", graph_id);
ret = GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED;
}

RtContextUtil::GetInstance().DestroyRtContexts(session_id);


+ 1
- 1
ge/graph/build/memory/graph_mem_assigner.cc View File

@@ -275,7 +275,7 @@ Status GraphMemoryAssigner::ReAssignMemory(bool is_loop_graph, map<uint64_t, siz
"E19022", std::vector<std::string>({"size", "item", "maxsize"}),
std::vector<std::string>({std::to_string(total_mem_offset), "featuremap",
std::to_string(VarManager::Instance(session_id)->GetGraphMemoryMaxSize())}));
return ge::FAILED;
return ACL_ERROR_GE_MEMORY_ALLOCATION;
}
return SUCCESS;
}


+ 3
- 2
ge/graph/build/memory/memory_assigner.cc View File

@@ -29,9 +29,10 @@ Status MemoryAssigner::AssignMemory(bool is_loop_graph, map<uint64_t, size_t> &m
}

// Reassign memory for special nodes
if (graph_mem_assigner.ReAssignMemory(is_loop_graph, mem_offset) != ge::SUCCESS) {
Status ret = graph_mem_assigner.ReAssignMemory(is_loop_graph, mem_offset);
if (ret != ge::SUCCESS) {
GELOGE(ge::FAILED, "[ReAssign][Memory] failed, graph:%s", compute_graph_->GetName().c_str());
return ge::FAILED;
return ret;
}

// Assign memory (block and offset) for zero copy nodes


+ 2
- 2
ge/graph/manager/graph_manager.cc View File

@@ -1381,8 +1381,8 @@ Status GraphManager::BuildGraph(const GraphId &graph_id, const std::vector<GeTen
ret = StartForRunGraph(graph_node, inputs, ge_root_model, session_id);
graph_node->SetRunFlag(false);
if (ret != SUCCESS) {
GELOGE(GE_GRAPH_PRERUN_FAILED, "[Call][StartForRunGraph] failed! graph_id:%u.", graph_id);
return GE_GRAPH_PRERUN_FAILED;
GELOGE(ret, "[Call][StartForRunGraph] failed! graph_id:%u.", graph_id);
return ret;
}

GELOGI("[BuildGraph] build graph success, graph_id=%u.", graph_id);


+ 2
- 1
ge/offline/single_op_parser.cc View File

@@ -89,7 +89,8 @@ map<string, DataType> kDataTypeDict = {
{"float", DT_FLOAT},
{"float32", DT_FLOAT},
{"double", DT_DOUBLE},
{"complex64", DT_COMPLEX64}
{"complex64", DT_COMPLEX64},
{"complex128", DT_COMPLEX128}
};

map<string, Format> kFormatDict = {


+ 1
- 0
tests/ut/ge/CMakeLists.txt View File

@@ -670,6 +670,7 @@ set(MULTI_PARTS_TEST_FILES
"graph/build/stream_allocator_unittest.cc"
"graph/build/model_builder_unittest.cc"
"graph/build/mem_assigner_unittest.cc"
"graph/build/graph_mem_assigner_unittest.cc"
"graph/build/task_generator_unittest.cc"
"graph/build/buffer_pool_mem_assigner_unittest.cc"
"graph/execute/graph_execute_unittest.cc"


+ 90
- 0
tests/ut/ge/graph/build/graph_mem_assigner_unittest.cc View File

@@ -0,0 +1,90 @@
/**
* Copyright 2019-2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <gtest/gtest.h>
#include <memory>

#include "graph/anchor.h"
#include "graph/attr_value.h"
#include "graph/debug/ge_attr_define.h"
#include "graph/utils/graph_utils.h"
#include "graph/utils/node_utils.h"
#include "graph/utils/op_desc_utils.h"
#include "graph/utils/tensor_utils.h"
#include "omg/omg_inner_types.h"
#include "../passes/graph_builder_utils.h"

#define protected public
#define private public
#include "graph/build/memory/binary_block_mem_assigner.h"
#include "graph/build/memory/graph_mem_assigner.h"
#include "graph/build/memory/hybrid_mem_assigner.h"
#include "graph/build/memory/max_block_mem_assigner.h"
#include "graph/manager/graph_var_manager.h"
#include "graph/manager/graph_mem_manager.h"
#undef protected
#undef private

using namespace std;
using namespace testing;
using namespace ge;
using domi::GetContext;

class UtestGraphMemAssigner : public testing::Test {
public:
ge::ComputeGraphPtr BuildGraphWithVar(int64_t session_id) {
// init
MemManager::Instance().Initialize(std::vector<rtMemType_t>({RT_MEMORY_HBM}));
VarManager::Instance(session_id)->Init(0, 0, 0, 0);
ge::ut::GraphBuilder builder("graph");
auto var_input = builder.AddNode("var", "Variable", 1, 1);
auto const_input = builder.AddNode("const", "Const", 1, 1);
auto assign = builder.AddNode("assgin", "Assign", 2, 1);
// add link
builder.AddDataEdge(var_input, 0, assign, 0);
builder.AddDataEdge(const_input, 0, assign, 1);
// set offset
var_input->GetOpDesc()->SetOutputOffset({10000});
const_input->GetOpDesc()->SetOutputOffset({1000});
assign->GetOpDesc()->SetInputOffset({10100, 1000});
assign->GetOpDesc()->SetOutputOffset({10100});
// set inner offset
int64_t inner_offset = 100;
ge::AttrUtils::SetInt(assign->GetOpDesc()->MutableInputDesc(0), ATTR_NAME_INNER_OFFSET, inner_offset);
ge::AttrUtils::SetInt(assign->GetOpDesc()->MutableOutputDesc(0), ATTR_NAME_INNER_OFFSET, inner_offset);
// add var addr
VarManager::Instance(session_id)->var_resource_->var_offset_map_.emplace(10000, RT_MEMORY_HBM);

return builder.GetGraph();
}

protected:
void SetUp() {}
void TearDown() {}
};

TEST_F(UtestGraphMemAssigner, graph_memory_assign_fail_case) {
ge::ComputeGraphPtr compute_graph = make_shared<ge::ComputeGraph>("");
GraphMemoryAssigner graph_mem_assigner(compute_graph);
MemoryOffset mem_offset(2, 10000);
graph_mem_assigner.memory_offset_.insert({2, mem_offset});
VarManager::Instance(0)->graph_mem_max_size_ = 0;

map<uint64_t, size_t> mem_type_to_offset = {};
Status ret = graph_mem_assigner.ReAssignMemory(false, mem_type_to_offset);
EXPECT_EQ(ret, ACL_ERROR_GE_MEMORY_ALLOCATION);
}


+ 2
- 2
tests/ut/ge/graph_ir/ge_ir_build_unittest.cc View File

@@ -367,7 +367,7 @@ TEST(UtestIrBuild, check_data_op_attr_index_valid) {
};
ModelBufferData model;
graphStatus ret = aclgrphBuildModel(graph, build_options, model);
EXPECT_EQ(ret, GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED);
EXPECT_EQ(ret, ge::FAILED);
}

// set attr index invalid, when not set input shape range
@@ -377,7 +377,7 @@ TEST(UtestIrBuild, check_data_attr_index_succ_no_input_range) {
const map<string, string> build_options;
ModelBufferData model;
graphStatus ret = aclgrphBuildModel(graph, build_options, model);
EXPECT_EQ(ret, GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED);
EXPECT_EQ(ret, ge::FAILED);
}

TEST(UtestIrBuild, check_modify_mixlist_param) {


Loading…
Cancel
Save