Browse Source

fix 1951 ts 4g memory failed

tags/v1.3.0
wxl 3 years ago
parent
commit
224a11549a
4 changed files with 35 additions and 11 deletions
  1. +22
    -11
      ge/graph/load/model_manager/davinci_model.cc
  2. +1
    -0
      ge/graph/load/model_manager/davinci_model.h
  3. +6
    -0
      tests/ut/ge/graph/load/davinci_model_unittest.cc
  4. +6
    -0
      third_party/fwkacllib/inc/runtime/dev.h

+ 22
- 11
ge/graph/load/model_manager/davinci_model.cc View File

@@ -3068,6 +3068,14 @@ Status DavinciModel::InitTaskInfo(domi::ModelTaskDef &model_task_def) {
return SUCCESS;
}

Status DavinciModel::CheckCapability(rtFeatureType_t featureType, int32_t featureInfo, bool &is_support) const {
int64_t value = RT_CAPABILITY_SUPPORT;
auto rt_ret = rtGetRtCapability(featureType, featureInfo, &value);
GE_CHK_BOOL_RET_STATUS(rt_ret == RT_ERROR_NONE, FAILED, "call rtGetRtCapability failed!");
is_support = (value == RT_CAPABILITY_SUPPORT) ? true : false;
return SUCCESS;
}

Status DavinciModel::MallocKnownArgs() {
GELOGI("DavinciModel::MallocKnownArgs in");
const auto &model_task_def = ge_model_->GetModelTaskDefPtr();
@@ -3086,20 +3094,23 @@ Status DavinciModel::MallocKnownArgs() {
return ret;
}
}
rtError_t rt_ret;
bool is_support = false;
GE_CHK_STATUS_RET_NOLOG(CheckCapability(FEATURE_TYPE_MEMORY, MEMORY_INFO_TS_4G_LIMITED, is_support));
auto mem_type = is_support ? RT_MEMORY_TS_4G : RT_MEMORY_HBM;
// malloc args memory
if (total_args_size_ != 0) {
rt_ret = rtMalloc(&args_, total_args_size_, RT_MEMORY_HBM);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, size:%u, ret: 0x%X when DavinciModel %s",
total_args_size_, rt_ret, __FUNCTION__);
GELOGE(RT_FAILED, "Call rtMalloc failed, ret: 0x%X", rt_ret);
return RT_ERROR_TO_GE_STATUS(rt_ret);
}
if (total_args_size_ == 0) {
GELOGW("DavinciModel::MallocKnownArgs total_args_size_ equals to zero.");
return SUCCESS;
}

rtError_t rt_ret = rtMalloc(&args_, total_args_size_, mem_type);
if (rt_ret != RT_ERROR_NONE) {
GELOGE(RT_FAILED, "Call rtMalloc failed, ret: 0x%X", rt_ret);
return RT_ERROR_TO_GE_STATUS(rt_ret);
}
// malloc dynamic and static hybrid memory
if (total_hybrid_args_size_ != 0) {
rt_ret = rtMalloc(&hybrid_addrs_, total_hybrid_args_size_, RT_MEMORY_HBM);
rt_ret = rtMalloc(&hybrid_addrs_, total_hybrid_args_size_, mem_type);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, size:%u, ret: 0x%X when DavinciModel %s",
total_hybrid_args_size_, rt_ret, __FUNCTION__);
@@ -3110,7 +3121,7 @@ Status DavinciModel::MallocKnownArgs() {
// malloc fixed addr memory, eg: rts op
if (total_fixed_addr_size_ != 0) {
GELOGI("Begin to allocate fixed addr.");
rt_ret = rtMalloc(&fixed_addrs_, total_fixed_addr_size_, RT_MEMORY_HBM);
rt_ret = rtMalloc(&fixed_addrs_, total_fixed_addr_size_, mem_type);
if (rt_ret != RT_ERROR_NONE) {
REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, size:%u, ret: 0x%X when DavinciModel %s",
total_hybrid_args_size_, rt_ret, __FUNCTION__);


+ 1
- 0
ge/graph/load/model_manager/davinci_model.h View File

@@ -531,6 +531,7 @@ class DavinciModel {
void SetKnownNode(bool known_node) { known_node_ = known_node; }
bool IsKnownNode() { return known_node_; }
Status MallocKnownArgs();
Status CheckCapability(rtFeatureType_t featureType, int32_t featureInfo, bool &is_support) const;
Status UpdateKnownNodeArgs(const vector<void *> &inputs, const vector<void *> &outputs);
Status CreateKnownZeroCopyMap(const vector<void *> &inputs, const vector<void *> &outputs);
Status UpdateKnownZeroCopyAddr(vector<void *> &total_io_addrs, bool update_args = true);


+ 6
- 0
tests/ut/ge/graph/load/davinci_model_unittest.cc View File

@@ -146,6 +146,12 @@ TEST_F(UtestDavinciModel, init_success) {
ProfilingManager::Instance().is_load_profiling_ = false;
}

TEST_F(UtestDavinciModel, CheckCapability) {
DavinciModel model(0, nullptr);
bool is_support = false;
(void)model.CheckCapability(FEATURE_TYPE_MEMORY, MEMORY_INFO_TS_4G_LIMITED, is_support);
}

TEST_F(UtestDavinciModel, init_data_op) {
DavinciModel model(0, nullptr);
model.ge_model_ = make_shared<GeModel>();


+ 6
- 0
third_party/fwkacllib/inc/runtime/dev.h View File

@@ -59,6 +59,7 @@ typedef enum tagRtAicpuDeployType {

typedef enum tagRtFeatureType {
FEATURE_TYPE_MEMCPY = 0,
FEATURE_TYPE_MEMORY = 1,
FEATURE_TYPE_RSV
} rtFeatureType_t;

@@ -67,6 +68,11 @@ typedef enum tagMemcpyInfo {
MEMCPY_INFO_RSV
} rtMemcpyInfo_t;

typedef enum tagMemoryInfo {
MEMORY_INFO_TS_4G_LIMITED = 0,
MEMORY_INFO_RSV
} rtMemoryInfo_t;

/**
* @ingroup dvrt_dev
* @brief get total device number.


Loading…
Cancel
Save