Browse Source

!518 cpplint cast fix

From: @chenmai1102
Reviewed-by: @youui,@liujunzhu
Signed-off-by: @youui
tags/v1.2.0
mindspore-ci-bot Gitee 3 years ago
parent
commit
a973743a27
6 changed files with 17 additions and 16 deletions
  1. +1
    -1
      ge/graph/load/new_model_manager/davinci_model.cc
  2. +5
    -4
      ge/graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc
  3. +6
    -6
      ge/graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc
  4. +1
    -1
      ge/graph/load/new_model_manager/zero_copy_task.cc
  5. +1
    -1
      ge/omm/csa_interact.cc
  6. +3
    -3
      ge/session/omg.cc

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

@@ -2780,7 +2780,7 @@ void *DavinciModel::Run(DavinciModel *model) {
reinterpret_cast<int64_t *>(shape_data_buffer_data) +
shape_data_buffer_length / sizeof(int64_t));
GELOGD("Data: cur dynamic dims is %s", formats::JoinToString(model->cur_dynamic_dims_).c_str());
delete[] (int64_t *)current_data.blobs.back().data;
delete[] reinterpret_cast<int64_t *>(current_data.blobs.back().data);
current_data.blobs.pop_back();
}
GE_IF_BOOL_EXEC(ProfilingManager::Instance().ProfilingModelExecuteOn(), model->SetProfileTime(MODEL_PRE_PROC_END));


+ 5
- 4
ge/graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc View File

@@ -25,10 +25,11 @@ Status SuperKernel::Launch(rtStream_t stream, uint32_t dump_flag) {
const void *args[] = {this->GetNavTablePtr(),
reinterpret_cast<const void *>(static_cast<uintptr_t>(this->GetNavTableSize()))};

rtError_t rt_ret = rtMalloc((void **)&(device_args_addr_), sizeof(args), RT_MEMORY_HBM);
GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(RT_FAILED, "rtMalloc failied. error: 0x%X", rt_ret); return
RT_ERROR_TO_GE_STATUS(rt_ret);)
rt_ret = rtMemcpy((void *)device_args_addr_, sizeof(args), (void *)args, sizeof(args), RT_MEMCPY_HOST_TO_DEVICE);
rtError_t rt_ret = rtMalloc(reinterpret_cast<void **>(device_args_addr_), sizeof(args), RT_MEMORY_HBM);
GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(RT_FAILED, "rtMalloc failied. error: 0x%X", rt_ret);
return RT_ERROR_TO_GE_STATUS(rt_ret);)
rt_ret = rtMemcpy(reinterpret_cast<void *>(device_args_addr_), sizeof(args), (void *)args, sizeof(args),
RT_MEMCPY_HOST_TO_DEVICE);
GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(RT_FAILED, "rtMemcpy failied. error: 0x%X", rt_ret);
return RT_ERROR_TO_GE_STATUS(rt_ret);)
rt_ret = rtKernelLaunchWithFlag((void *const)func_stub_, block_dim_, device_args_addr_, sizeof(args), NULL, stream,


+ 6
- 6
ge/graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc View File

@@ -87,7 +87,7 @@ Status SuperKernelFactory::FuseKernels(const std::vector<void *> &stub_func_list
}
GELOGI("SKT: superkernel start fuse, superkernel size %zu.", stub_func_list.size());
const size_t nav_table_len = 2 * stub_func_list.size();
std::unique_ptr<uint64_t[]> nav_table(new(std::nothrow) uint64_t[nav_table_len]);
std::unique_ptr<uint64_t[]> nav_table(new (std::nothrow) uint64_t[nav_table_len]);
GE_CHECK_NOTNULL(nav_table);
uint64_t nav_table_size = 2 * stub_func_list.size() * sizeof(int64_t);

@@ -106,16 +106,16 @@ Status SuperKernelFactory::FuseKernels(const std::vector<void *> &stub_func_list
nav_table[i * 2 + 1] = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(args_addr_list[i]));
GELOGD("SKT: fuseKernels args base address %lu", nav_table[i * 2 + 1]);
}
rt_ret = rtMalloc((void **)&hbm_nav_table_addr, nav_table_size, RT_MEMORY_HBM);
rt_ret = rtMalloc(reinterpret_cast<void **>(&hbm_nav_table_addr), nav_table_size, RT_MEMORY_HBM);
GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(RT_FAILED, "rtMalloc failed. error: 0x%X", rt_ret);
return RT_ERROR_TO_GE_STATUS(rt_ret);)
rt_ret =
rtMemcpy((void *)hbm_nav_table_addr, nav_table_size, (void *)nav_table.get(), nav_table_size, RT_MEMCPY_HOST_TO_DEVICE);
rt_ret = rtMemcpy(reinterpret_cast<void *>(hbm_nav_table_addr), nav_table_size,
reinterpret_cast<void *>(nav_table.get()), nav_table_size, RT_MEMCPY_HOST_TO_DEVICE);
GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(RT_FAILED, "rtMemcpy failed. error: 0x%X", rt_ret);
GE_CHK_RT(rtFree(hbm_nav_table_addr)); return RT_ERROR_TO_GE_STATUS(rt_ret);)
// Create the necessary metadata for the super kernel
h = std::unique_ptr<skt::SuperKernel>(
new SuperKernel(this->func_stub_, hbm_nav_table_addr, nav_table_size, block_dim));
h =
std::unique_ptr<skt::SuperKernel>(new SuperKernel(this->func_stub_, hbm_nav_table_addr, nav_table_size, block_dim));
return SUCCESS;
}
} // namespace skt


+ 1
- 1
ge/graph/load/new_model_manager/zero_copy_task.cc View File

@@ -131,7 +131,7 @@ Status ZeroCopyTask::UpdateTaskParam(uintptr_t addr, void *buffer_addr, const ma
auto dst_addr = static_cast<uint8_t *>(buffer_addr);
GELOGI("[ZCPY] %s update task, args_addr: %p, size: %zu, offset: %zu, virtual_addr: 0x%lx, user_data_addr: %p",
name_.c_str(), args_addr_, args_size_, offset, addr, buffer_addr);
*(uintptr_t *)(args_info + offset) = reinterpret_cast<uintptr_t>(dst_addr);
*reinterpret_cast<uintptr_t *>(args_info + offset)= reinterpret_cast<uintptr_t>(dst_addr);
is_updated_ = true;
}
}


+ 1
- 1
ge/omm/csa_interact.cc View File

@@ -202,7 +202,7 @@ Status CsaInteract::WriteFile(const std::string &file_name, const std::string &c
}
}

mmSsize_t ret = mmWrite(fd, (void *)content.c_str(), content.length());
mmSsize_t ret = mmWrite(fd, reinterpret_cast<void *>(const_cast<char *>(content.c_str())), content.length());
if (ret == EN_ERROR) {
GELOGE(INTERNAL_ERROR, "write file fail, errno is %d", errno);
ret = mmClose(fd);


+ 3
- 3
ge/session/omg.cc View File

@@ -891,7 +891,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOmModelToJson(const char *model_file, con
if (status != ge::GRAPH_SUCCESS) {
GELOGE(ge::FAILED, "Om file init failed.");
if (model.model_data != nullptr) {
delete[](char *) model.model_data;
delete[] reinterpret_cast<char *>(model.model_data);
model.model_data = nullptr;
}
return status;
@@ -902,7 +902,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOmModelToJson(const char *model_file, con
if (status != ge::GRAPH_SUCCESS) {
GELOGE(ge::FAILED, "Get model part failed.");
if (model.model_data != nullptr) {
delete[](char *) model.model_data;
delete[] reinterpret_cast<char *>(model.model_data);
model.model_data = nullptr;
}
return status;
@@ -928,7 +928,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOmModelToJson(const char *model_file, con
}

if (model.model_data != nullptr) {
delete[](char *) model.model_data;
delete[] reinterpret_cast<char *>(model.model_data);
model.model_data = nullptr;
}
return ret;


Loading…
Cancel
Save