| @@ -174,8 +174,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status SingleOp::ExecuteAsync(c | |||||
| std::lock_guard<std::mutex> lk(*stream_mutex_); | std::lock_guard<std::mutex> lk(*stream_mutex_); | ||||
| auto current_mem_base = stream_resource_->GetMemoryBase(); | auto current_mem_base = stream_resource_->GetMemoryBase(); | ||||
| if (running_param_->mem_base != current_mem_base) { | if (running_param_->mem_base != current_mem_base) { | ||||
| running_param_->mem_base = current_mem_base; | |||||
| GELOGD("Memory base changed, new memory base =%lu", current_mem_base); | |||||
| running_param_->mem_base = const_cast<uint8_t *>(current_mem_base); | |||||
| GELOGD("Memory base changed, new memory base = %p", current_mem_base); | |||||
| for (auto &task : tasks_) { | for (auto &task : tasks_) { | ||||
| auto new_address = BuildTaskUtils::GetAddresses(task->GetOpdesc(), *running_param_); | auto new_address = BuildTaskUtils::GetAddresses(task->GetOpdesc(), *running_param_); | ||||
| GE_CHK_STATUS_RET(task->UpdateArgTable(*running_param_), | GE_CHK_STATUS_RET(task->UpdateArgTable(*running_param_), | ||||
| @@ -74,7 +74,7 @@ uint8_t *StreamResource::DoMallocMemory(const std::string &purpose, | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| if (size <= max_allocated) { | |||||
| if (size <= max_allocated && !allocated.empty()) { | |||||
| GELOGD("reuse last memory"); | GELOGD("reuse last memory"); | ||||
| return allocated.back(); | return allocated.back(); | ||||
| } | } | ||||
| @@ -190,7 +190,7 @@ Status StreamResource::BuildOperator(const string &model_name, const ModelData & | |||||
| return SUCCESS; | return SUCCESS; | ||||
| } | } | ||||
| uint8_t *StreamResource::GetMemoryBase() const { | |||||
| const uint8_t *StreamResource::GetMemoryBase() const { | |||||
| if (memory_list_.empty()) { | if (memory_list_.empty()) { | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| @@ -47,7 +47,7 @@ class StreamResource { | |||||
| uint8_t *MallocMemory(const std::string &purpose, size_t size, bool holding_lock = true); | uint8_t *MallocMemory(const std::string &purpose, size_t size, bool holding_lock = true); | ||||
| uint8_t *MallocWeight(const std::string &purpose, size_t size); | uint8_t *MallocWeight(const std::string &purpose, size_t size); | ||||
| uint8_t *GetMemoryBase() const; | |||||
| const uint8_t *GetMemoryBase() const; | |||||
| private: | private: | ||||
| uint8_t *DoMallocMemory(const std::string &purpose, | uint8_t *DoMallocMemory(const std::string &purpose, | ||||