!10249 npu add concat&add pass

From: @yeyunpeng2020
Reviewed-by: @hangangqiang,@zhang_xue_tong
Signed-off-by: @zhang_xue_tong
This commit is contained in:
mindspore-ci-bot 2020-12-21 09:01:43 +08:00 committed by Gitee
commit 4567d510af
4 changed files with 18 additions and 20 deletions

View File

@ -61,10 +61,6 @@ class NPUManager {
private:
int index_ = 0;
bool is_npu_check_executor = false;
bool is_support_npu = false;
std::vector<std::shared_ptr<hiai::AiModelMngerClient>> clients_;
std::vector<std::shared_ptr<hiai::AiModelDescription>> model_desc_;

View File

@ -159,20 +159,25 @@ int SubGraphNpuKernel::BuildNPUOutputOp() {
std::string SubGraphNpuKernel::GetOMModelName() { return this->name_ + ".om"; }
int SubGraphNpuKernel::Init() {
model_buffer_data_ = BuildIRModel();
if (model_buffer_data_ == nullptr) {
MS_LOG(ERROR) << "Build IR model failed.";
return RET_ERROR;
}
if (!isCompiled_) {
model_buffer_data_ = BuildIRModel();
if (model_buffer_data_ == nullptr) {
MS_LOG(ERROR) << "Build IR model failed.";
return RET_ERROR;
}
mindspore::lite::NPUManager::GetInstance()->AddModel(model_buffer_data_->data, model_buffer_data_->length,
GetOMModelName(), context_->GetNpuInfo().frequency_);
name_ = "kNpuSubGraph" + std::to_string(mindspore::lite::NPUManager::GetInstance()->index());
executor_ = new (std::nothrow) mindspore::lite::NPUExecutor(GetOMModelName());
mindspore::lite::NPUManager::GetInstance()->AddModel(model_buffer_data_->data, model_buffer_data_->length,
GetOMModelName(), context_->GetNpuInfo().frequency_);
if (executor_ == nullptr) {
MS_LOG(ERROR) << "Create NPUExecutor failed.";
return RET_ERROR;
executor_ = new (std::nothrow) mindspore::lite::NPUExecutor(GetOMModelName());
if (executor_ == nullptr) {
MS_LOG(ERROR) << "Create NPUExecutor failed.";
return RET_ERROR;
}
isCompiled_ = true;
}
return RET_OK;
}

View File

@ -69,6 +69,8 @@ class SubGraphNpuKernel : public SubGraphKernel {
std::string GetOMModelName();
private:
bool isCompiled_ = false;
domi::ModelBufferData *model_buffer_data_;
std::vector<ge::Operator> subgraph_input_op_;

View File

@ -468,11 +468,6 @@ kernel::SubGraphKernel *Scheduler::CreateSubGraphKernel(const std::vector<kernel
MS_LOG(ERROR) << "NPU subgraph new failed.";
return nullptr;
}
sub_kernel->set_name("NPUSubgraph" + std::to_string(NPUManager::GetInstance()->index()));
if (sub_kernel->Init() != RET_OK) {
MS_LOG(ERROR) << "NPU subgraph init failed.";
return nullptr;
}
return sub_kernel;
#else
return nullptr;