Browse Source

errorcode smoke

tags/v1.2.0
weiyang 3 years ago
parent
commit
1c2d1d7f35
2 changed files with 24 additions and 6 deletions
  1. +4
    -4
      ge/graph/load/new_model_manager/davinci_model.cc
  2. +20
    -2
      tests/ut/ge/graph/ge_executor_unittest.cc

+ 4
- 4
ge/graph/load/new_model_manager/davinci_model.cc View File

@@ -307,8 +307,8 @@ Status DavinciModel::InitWeightMem(void *dev_ptr, void *weight_ptr, size_t weigh

Status DavinciModel::InitFeatureMapAndP2PMem(void *dev_ptr, size_t mem_size) {
if (is_feature_map_mem_has_inited_) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "call InitFeatureMapMem more than once .");
return ACL_ERROR_GE_MEMORY_ALLOCATION;
GELOGE(PARAM_INVALID, "call InitFeatureMapMem more than once.");
return PARAM_INVALID;
}
is_feature_map_mem_has_inited_ = true;

@@ -316,8 +316,8 @@ Status DavinciModel::InitFeatureMapAndP2PMem(void *dev_ptr, size_t mem_size) {
std::size_t p2p_data_size = P2PMemInfos().at(RT_MEMORY_P2P_DDR).memory_size;

if ((dev_ptr != nullptr) && (mem_size < TotalMemSize())) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Invalid mem param: mem_size=%zu totalsize=%zu.", mem_size, TotalMemSize());
return ACL_ERROR_GE_MEMORY_ALLOCATION;
GELOGE(PARAM_INVALID, "Invalid mem param: mem_size=%zu totalsize=%zu.", mem_size, TotalMemSize());
return PARAM_INVALID;
}

mem_base_ = static_cast<uint8_t *>(dev_ptr);


+ 20
- 2
tests/ut/ge/graph/ge_executor_unittest.cc View File

@@ -43,8 +43,7 @@
#undef protected

using namespace std;
using namespace ge;

namespace ge {
class UtestGeExecutor : public testing::Test {
protected:
static void InitModelDefault(ge::Model &model) {
@@ -67,6 +66,19 @@ class UtestGeExecutor : public testing::Test {
}
};

class DModelListener : public ge::ModelListener {
public:
DModelListener() {
};
Status OnComputeDone(uint32_t model_id, uint32_t data_index, uint32_t resultCode,
std::vector<ge::OutputTensorInfo> &outputs) {
GELOGI("In Call back. OnComputeDone");
return SUCCESS;
}
};

shared_ptr<ge::ModelListener> g_label_call_back(new DModelListener());

/*
TEST_F(UtestGeExecutor, fail_UnloadModel_model_manager_stop_unload_error) {
uint32_t model_id = 1;
@@ -87,3 +99,9 @@ TEST_F(UtestGeExecutor, fail_CommandHandle_model_manager_HandleCommand_error) {
EXPECT_EQ(ge::PARAM_INVALID, ret);
}
*/
TEST_F(UtestGeExecutor, InitFeatureMapAndP2PMem_failed) {
DavinciModel model(0, g_label_call_back);
model.is_feature_map_mem_has_inited_ = true;
EXPECT_EQ(model.InitFeatureMapAndP2PMem(nullptr, 0), PARAM_INVALID);
}
}

Loading…
Cancel
Save