@@ -0,0 +1,91 @@ | |||
/** | |||
* Copyright 2019-2020 Huawei Technologies Co., Ltd | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
#ifndef __INC_EXTERNEL_RT_ERROR_CODES_H__ | |||
#define __INC_EXTERNEL_RT_ERROR_CODES_H__ | |||
#include <stddef.h> | |||
#ifdef __cplusplus | |||
extern "C" { | |||
#endif | |||
static const int32_t ACL_RT_SUCCESS = 0; // success | |||
static const int32_t ACL_ERROR_RT_PARAM_INVALID = 107000; // param invalid | |||
static const int32_t ACL_ERROR_RT_INVALID_DEVICEID = 107001; // invalid device id | |||
static const int32_t ACL_ERROR_RT_CONTEXT_NULL = 107002; // current context null | |||
static const int32_t ACL_ERROR_RT_STREAM_CONTEXT = 107003; // stream not in current context | |||
static const int32_t ACL_ERROR_RT_MODEL_CONTEXT = 107004; // model not in current context | |||
static const int32_t ACL_ERROR_RT_STREAM_MODEL = 107005; // stream not in model | |||
static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID = 107006; // event timestamp invalid | |||
static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL = 107007; // event timestamp reversal | |||
static const int32_t ACL_ERROR_RT_ADDR_UNALIGNED = 107008; // memory address unaligned | |||
static const int32_t ACL_ERROR_RT_FILE_OPEN = 107009; // open file failed | |||
static const int32_t ACL_ERROR_RT_FILE_WRITE = 107010; // write file failed | |||
static const int32_t ACL_ERROR_RT_STREAM_SUBSCRIBE = 107011; // error subscribe stream | |||
static const int32_t ACL_ERROR_RT_THREAD_SUBSCRIBE = 107012; // error subscribe thread | |||
static const int32_t ACL_ERROR_RT_GROUP_NOT_SET = 107013; // group not set | |||
static const int32_t ACL_ERROR_RT_GROUP_NOT_CREATE = 107014; // group not create | |||
static const int32_t ACL_ERROR_RT_STREAM_NO_CB_REG = 107015; // callback not register to stream | |||
static const int32_t ACL_ERROR_RT_INVALID_MEMORY_TYPE = 107016; // invalid memory type | |||
static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPROT = 207000; // feature not support | |||
static const int32_t ACL_ERROR_RT_MEMORY_ALLOCATION = 207001; // memory allocation error | |||
static const int32_t ACL_ERROR_RT_MEMORY_FREE = 207002; // memory free error | |||
static const int32_t ACL_ERROR_RT_INTERNEL_ERROR = 507000; // runtime internel error | |||
static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error | |||
static const int32_t ACL_ERROR_RT_STREAM_TASK_FULL = 507002; // task full in stream | |||
static const int32_t ACL_ERROR_RT_STREAM_TASK_EMPTY = 507003; // task empty in stream | |||
static const int32_t ACL_ERROR_RT_STREAM_NOT_COMPLETE = 507004; // stream not complete | |||
static const int32_t ACL_ERROR_RT_END_OF_SEQUENCE = 507005; // end of sequence | |||
static const int32_t ACL_ERROR_RT_EVENT_NOT_COMPLETE = 507006; // event not complete | |||
static const int32_t ACL_ERROR_RT_CONTEXT_RELEASE_ERROR = 507007; // context release error | |||
static const int32_t ACL_ERROR_RT_SOC_VERSION = 507008; // soc version error | |||
static const int32_t ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT = 507009; // task type not support | |||
static const int32_t ACL_ERROR_RT_LOST_HEARTBEAT = 507010; // ts lost heartbeat | |||
static const int32_t ACL_ERROR_RT_MODEL_EXECUTE = 507011; // model execute failed | |||
static const int32_t ACL_ERROR_RT_REPORT_TIMEOUT = 507012; // report timeout | |||
static const int32_t ACL_ERROR_RT_SYS_DMA = 507013; // sys dma error | |||
static const int32_t ACL_ERROR_RT_AICORE_TIMEOUT = 507014; // aicore timeout | |||
static const int32_t ACL_ERROR_RT_AICORE_EXCEPTION = 507015; // aicore exception | |||
static const int32_t ACL_ERROR_RT_AICORE_TRAP_EXCEPTION = 507016; // aicore trap exception | |||
static const int32_t ACL_ERROR_RT_AICPU_TIMEOUT = 507017; // aicpu timeout | |||
static const int32_t ACL_ERROR_RT_AICPU_EXCEPTION = 507018; // aicpu exception | |||
static const int32_t ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR = 507019; // aicpu datadump response error | |||
static const int32_t ACL_ERROR_RT_AICPU_MODEL_RSP_ERR = 507020; // aicpu model operate response error | |||
static const int32_t ACL_ERROR_RT_PROFILING_ERROR = 507021; // profiling error | |||
static const int32_t ACL_ERROR_RT_IPC_ERROR = 507022; // ipc error | |||
static const int32_t ACL_ERROR_RT_MODEL_ABORT_NORMAL = 507023; // model abort normal | |||
static const int32_t ACL_ERROR_RT_KERNEL_UNREGISTERING = 507024; // kernel unregistering | |||
static const int32_t ACL_ERROR_RT_RINGBUFFER_NOT_INIT = 507025; // ringbuffer not init | |||
static const int32_t ACL_ERROR_RT_RINGBUFFER_NO_DATA = 507026; // ringbuffer no data | |||
static const int32_t ACL_ERROR_RT_KERNEL_LOOKUP = 507027; // kernel lookup error | |||
static const int32_t ACL_ERROR_RT_KERNEL_DUPLICATE = 507028; // kernel register duplicate | |||
static const int32_t ACL_ERROR_RT_DEBUG_REGISTER_FAIL = 507029; // debug register failed | |||
static const int32_t ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL = 507030; // debug unregister failed | |||
static const int32_t ACL_ERROR_RT_LABEL_CONTEXT = 507031; // label not in current context | |||
static const int32_t ACL_ERROR_RT_PROGRAM_USE_OUT = 507032; // program register num use out | |||
static const int32_t ACL_ERROR_RT_DEV_SETUP_ERROR = 507033; // device setup error | |||
static const int32_t ACL_ERROR_RT_DRV_INTERNEL_ERROR = 507899; // drv internel error | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
#endif // __INC_EXTERNEL_RT_ERROR_CODES_H__ |
@@ -78,7 +78,7 @@ bool RuntimeModel::InitStream(std::shared_ptr<DavinciModel> &davinci_model) { | |||
: (RT_STREAM_PERSISTENT); | |||
rtError_t rt_ret = rtStreamCreateWithFlags(&stream, davinci_model->GetPriority(), flag); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtStreamCreate failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -91,7 +91,7 @@ bool RuntimeModel::InitStream(std::shared_ptr<DavinciModel> &davinci_model) { | |||
flag = (wait_active_streams.find(i) != wait_active_streams.end()) ? (static_cast<uint32_t>(RT_INVALID_FLAG)) | |||
: (static_cast<uint32_t>(RT_HEAD_STREAM)); | |||
rt_ret = rtModelBindStream(rt_model_handle_, stream, flag); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtModelBindStream failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -106,7 +106,7 @@ bool RuntimeModel::InitEvent(uint32_t event_num) { | |||
for (uint32_t i = 0; i < event_num; ++i) { | |||
rtEvent_t rt_event; | |||
rtError_t rt_ret = rtEventCreate(&rt_event); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtEventCreate failed, i; %u; ret: 0x%X", i, rt_ret); | |||
return false; | |||
} | |||
@@ -136,7 +136,7 @@ bool RuntimeModel::InitLabel(std::shared_ptr<DavinciModel> &davinci_model) { | |||
rtLabel_t rt_label = nullptr; | |||
rtError_t rt_ret = rtLabelCreateEx(&rt_label, stream_list_[label_set_task_info->stream_id()]); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtLabelCreate failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -153,14 +153,14 @@ bool RuntimeModel::InitResource(std::shared_ptr<DavinciModel> &davinci_model) { | |||
return false; | |||
} | |||
rtError_t rt_ret = rtModelCreate(&rt_model_handle_, 0); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtModelCreate failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
// Create rtStream for rt_model_handle_ | |||
rt_ret = rtStreamCreate(&rt_model_stream_, davinci_model->GetPriority()); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtStreamCreate failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -214,7 +214,7 @@ bool RuntimeModel::LoadTask() { | |||
uint32_t task_id = 0; | |||
uint32_t stream_id = 0; | |||
rtError_t rt_ret = rtModelGetTaskId(rt_model_handle_, &task_id, &stream_id); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X.", rt_ret); | |||
return false; | |||
} | |||
@@ -242,7 +242,7 @@ bool RuntimeModel::LoadComplete() { | |||
uint32_t task_id = 0; | |||
uint32_t stream_id = 0; | |||
auto rt_ret = rtModelGetTaskId(rt_model_handle_, &task_id, &stream_id); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rtModelGetTaskId failed, ret:0x%X", rt_ret); | |||
return RT_FAILED; | |||
} | |||
@@ -250,7 +250,7 @@ bool RuntimeModel::LoadComplete() { | |||
stream_id_list_.push_back(stream_id); | |||
rt_ret = rtModelLoadComplete(rt_model_handle_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtModelLoadComplete failed, ret: 0x%X.", rt_ret); | |||
return false; | |||
} | |||
@@ -298,7 +298,7 @@ bool RuntimeModel::DistributeTask() { | |||
bool RuntimeModel::Run() { | |||
GELOGI("Davinci task run start"); | |||
rtError_t ret = rtModelExecute(rt_model_handle_, rt_model_stream_, 0); | |||
if (ret != RT_ERROR_NONE) { | |||
if (ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Model execute failed, ret = 0x%X", ret); | |||
return false; | |||
} | |||
@@ -306,8 +306,8 @@ bool RuntimeModel::Run() { | |||
GELOGI("Run rtModelExecute success, ret = 0x%X", ret); | |||
ret = rtStreamSynchronize(rt_model_stream_); | |||
if (ret != RT_ERROR_NONE) { | |||
if (ret == RT_ERROR_END_OF_SEQUENCE) { | |||
if (ret != ACL_RT_SUCCESS) { | |||
if (ret == ACL_ERROR_RT_END_OF_SEQUENCE) { | |||
GELOGI("Model stream RT_ERROR_END_OF_SEQUENCE signal received, ret = 0x%X", ret); | |||
return true; | |||
} | |||
@@ -321,7 +321,7 @@ bool RuntimeModel::Run() { | |||
void RuntimeModel::RtModelUnbindStream() noexcept { | |||
for (size_t i = 0; i < stream_list_.size(); i++) { | |||
if (rtModelUnbindStream(rt_model_handle_, stream_list_[i]) != RT_ERROR_NONE) { | |||
if (rtModelUnbindStream(rt_model_handle_, stream_list_[i]) != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Unbind stream from model failed! Index: %zu", i); | |||
return; | |||
} | |||
@@ -329,13 +329,13 @@ void RuntimeModel::RtModelUnbindStream() noexcept { | |||
} | |||
void RuntimeModel::RtStreamDestory() noexcept { | |||
if (rtStreamDestroy(rt_model_stream_) != RT_ERROR_NONE) { | |||
if (rtStreamDestroy(rt_model_stream_) != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Destroy stream for rt_model failed!"); | |||
return; | |||
} | |||
for (size_t i = 0; i < stream_list_.size(); i++) { | |||
if (rtStreamDestroy(stream_list_[i]) != RT_ERROR_NONE) { | |||
if (rtStreamDestroy(stream_list_[i]) != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Destroy stream failed! Index: %zu", i); | |||
return; | |||
} | |||
@@ -347,7 +347,7 @@ void RuntimeModel::RtLabelDestory() noexcept { | |||
if (label_list_[i] == nullptr) { | |||
continue; | |||
} | |||
if (rtLabelDestroy(label_list_[i]) != RT_ERROR_NONE) { | |||
if (rtLabelDestroy(label_list_[i]) != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Destroy label failed! Index: %zu.", i); | |||
return; | |||
} | |||
@@ -356,7 +356,7 @@ void RuntimeModel::RtLabelDestory() noexcept { | |||
void RuntimeModel::RtModelDestory() noexcept { | |||
rtError_t ret = rtModelDestroy(rt_model_handle_); | |||
if (ret != RT_ERROR_NONE) { | |||
if (ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", ret); | |||
return; | |||
} | |||
@@ -364,7 +364,7 @@ void RuntimeModel::RtModelDestory() noexcept { | |||
void RuntimeModel::RtEventDestory() noexcept { | |||
for (size_t i = 0; i < event_list_.size(); i++) { | |||
if (rtEventDestroy(event_list_[i]) != RT_ERROR_NONE) { | |||
if (rtEventDestroy(event_list_[i]) != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Destroy event failed! Index: %zu", i); | |||
return; | |||
} | |||
@@ -436,7 +436,7 @@ bool RuntimeModel::CopyHostData(const std::vector<DataBuffer> &data, const std:: | |||
void *data_out_addr = reinterpret_cast<void *>(outputs[0]); | |||
rtError_t rt_ret = rtMemcpy(data_out_addr, copy_size, host_data_addr, copy_size, RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -504,7 +504,7 @@ bool RuntimeModel::InitConstantInfo(std::shared_ptr<DavinciModel> &davinci_model | |||
rtError_t rt_ret = rtMemcpy(reinterpret_cast<void *>(constant->output_addrs[0]), constant->output_tensors[0].size, | |||
constant->weight_data.data(), constant->weight_data.size(), RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "rtGetFunctionByName failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -70,14 +70,14 @@ bool AicpuTask::Distribute() { | |||
aicpu_param_head.extInfoAddr = 0; | |||
} else { | |||
rtError_t flag = rtMalloc(&ext_info_, ext_size, RT_MEMORY_HBM); | |||
if (flag != RT_ERROR_NONE) { | |||
if (flag != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api(rtMalloc) failed, ret: 0x%X.", flag); | |||
return false; | |||
} | |||
flag = rtMemcpy(ext_info_, ext_size, const_cast<void *>(reinterpret_cast<const void *>(ext_info.data())), ext_size, | |||
RT_MEMCPY_HOST_TO_DEVICE); | |||
if (flag != RT_ERROR_NONE) { | |||
if (flag != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api(rtMemCpy) failed, ret: 0x%X.", flag); | |||
return false; | |||
} | |||
@@ -89,7 +89,7 @@ bool AicpuTask::Distribute() { | |||
// Malloc device memory for args | |||
rtError_t rt_ret = rtMalloc(&args_, args_size, RT_MEMORY_HBM); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api(rtMalloc) failed, ret: 0x%X.", rt_ret); | |||
return false; | |||
} | |||
@@ -97,7 +97,7 @@ bool AicpuTask::Distribute() { | |||
// Memcpy AicpuParamHead | |||
rt_ret = rtMemcpy(args_, sizeof(aicpu::AicpuParamHead), reinterpret_cast<void *>(&aicpu_param_head), | |||
sizeof(aicpu::AicpuParamHead), RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api(rtMemcpy) failed, ret: 0x%X.", rt_ret); | |||
return false; | |||
} | |||
@@ -106,7 +106,7 @@ bool AicpuTask::Distribute() { | |||
if (io_addrs_num != 0) { | |||
rt_ret = rtMemcpy(reinterpret_cast<void *>(reinterpret_cast<uint8_t *>(args_) + io_addr_offset), io_addrs_size, | |||
reinterpret_cast<void *>(io_addrs.data()), io_addrs_size, RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api(rtMemcpy) failed, ret: 0x%X.", rt_ret); | |||
return false; | |||
} | |||
@@ -117,7 +117,7 @@ bool AicpuTask::Distribute() { | |||
rt_ret = | |||
rtMemcpy(reinterpret_cast<void *>(reinterpret_cast<uint8_t *>(args_) + node_def_len_offset), sizeof(uint32_t), | |||
reinterpret_cast<const void *>(&size), sizeof(uint32_t), RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api(rtMemcpy) failed, ret: 0x%X.", rt_ret); | |||
return false; | |||
} | |||
@@ -126,7 +126,7 @@ bool AicpuTask::Distribute() { | |||
rt_ret = rtMemcpy(reinterpret_cast<void *>(reinterpret_cast<uint8_t *>(args_) + node_def_addr_offset), | |||
task_info_->node_def().size(), reinterpret_cast<const void *>(task_info_->node_def().data()), | |||
task_info_->node_def().size(), RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api(rtMemcpy) failed, ret: 0x%X.", rt_ret); | |||
return false; | |||
} | |||
@@ -140,7 +140,7 @@ bool AicpuTask::Distribute() { | |||
rt_ret = rtCpuKernelLaunchWithFlag(reinterpret_cast<const void *>(task_info_->so_name().data()), | |||
reinterpret_cast<const void *>(task_info_->kernel_name().data()), 1, args_, | |||
args_size, nullptr, stream_, dump_flag); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -155,7 +155,7 @@ void AicpuTask::ReleaseRtMem(void **ptr) noexcept { | |||
} | |||
rtError_t rt_ret = rtFree(*ptr); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "ReleaseRtMem failed, ret: 0x%X", rt_ret); | |||
return; | |||
} | |||
@@ -45,8 +45,8 @@ CceTask::CceTask(const ModelContext &model_context, const std::shared_ptr<CceTas | |||
CceTask::~CceTask() { | |||
FreeRtMem(&args_); | |||
FreeRtMem(&flowtable_); | |||
rtError_t ret = (sm_desc_ != nullptr) ? rtMemFreeManaged(sm_desc_) : RT_ERROR_NONE; | |||
if (ret != RT_ERROR_NONE) { | |||
rtError_t ret = (sm_desc_ != nullptr) ? rtMemFreeManaged(sm_desc_) : ACL_RT_SUCCESS; | |||
if (ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", ret); | |||
} | |||
sm_desc_ = nullptr; | |||
@@ -57,7 +57,7 @@ void CceTask::FreeRtMem(void **ptr) noexcept { | |||
return; | |||
} | |||
rtError_t ret = rtFree(*ptr); | |||
if (ret != RT_ERROR_NONE) { | |||
if (ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", ret); | |||
} | |||
@@ -77,7 +77,7 @@ bool CceTask::Distribute() { | |||
} | |||
rtError_t rt_ret = rtGetFunctionByName(const_cast<char *>(task_info_->stub_func().c_str()), &stub_func_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "rtGetFunctionByName failed, ret: 0x%X", rt_ret); | |||
stub_func_ = nullptr; | |||
return false; | |||
@@ -87,7 +87,7 @@ bool CceTask::Distribute() { | |||
// Flowtable | |||
if (is_flowtable_) { | |||
rt_ret = rtMalloc(&flowtable_, task_info_->flow_table().size(), RT_MEMORY_HBM); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -95,7 +95,7 @@ bool CceTask::Distribute() { | |||
rt_ret = rtMemcpy(flowtable_, task_info_->flow_table().size(), task_info_->flow_table().data(), | |||
task_info_->flow_table().size(), RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -115,7 +115,7 @@ bool CceTask::Distribute() { | |||
// Args | |||
rt_ret = rtMalloc(&args_, task_info_->args_size(), RT_MEMORY_HBM); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -123,7 +123,7 @@ bool CceTask::Distribute() { | |||
rt_ret = rtMemcpy(args_, task_info_->args_size(), task_info_->args().data(), task_info_->args_size(), | |||
RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -131,14 +131,14 @@ bool CceTask::Distribute() { | |||
// L2 sm_desc | |||
if (!task_info_->sm_desc().empty()) { | |||
rt_ret = rtMemAllocManaged(&sm_desc_, task_info_->sm_desc().size(), RT_MEMORY_SPM); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
rt_ret = rtMemcpy(sm_desc_, task_info_->sm_desc().size(), task_info_->sm_desc().data(), | |||
task_info_->sm_desc().size(), RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -147,7 +147,7 @@ bool CceTask::Distribute() { | |||
// Kernel launch | |||
rt_ret = rtKernelLaunch(stub_func_, task_info_->block_dim(), args_, task_info_->args_size(), | |||
static_cast<rtSmDesc_t *>(sm_desc_), stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -46,7 +46,7 @@ bool EventRecordTask::Distribute() { | |||
GELOGI("EventRecordTask Distribute start, stream: %p, event: %p, stream_id: %u, event_id: %u.", stream_, event_, | |||
task_info_->stream_id(), task_info_->event_id()); | |||
rtError_t rt_ret = rtEventRecord(event_, stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -46,13 +46,13 @@ bool EventWaitTask::Distribute() { | |||
task_info_->stream_id(), task_info_->event_id()); | |||
rtError_t rt_ret = rtStreamWaitEvent(stream_, event_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtStreamWaitEvent failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
rt_ret = rtEventReset(event_, stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtEventReset failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -54,7 +54,7 @@ HcclTask::HcclTask(const ModelContext &model_context, const std::shared_ptr<Hccl | |||
HcclTask::~HcclTask() { | |||
if (workspace_mem_ != nullptr) { | |||
rtError_t rt_ret = rtFree(workspace_mem_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "rtFree workspace_mem_ failed! ret: 0x%X.", rt_ret); | |||
} | |||
workspace_mem_ = nullptr; | |||
@@ -79,7 +79,7 @@ bool HcclTask::Distribute() { | |||
if (task_info_->workspace_size() > 0) { | |||
rtError_t rt_ret = rtMalloc(&workspace_mem_, task_info_->workspace_size(), RT_MEMORYINFO_HBM); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -229,13 +229,13 @@ bool HcclTask::CreateStream(rtModel_t model, rtStream_t *stream) const { | |||
} | |||
rtError_t rt_ret = rtStreamCreateWithFlags(stream, priority_, RT_STREAM_PERSISTENT | RT_STREAM_FORCE_COPY); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
// Create secondary stream, inactive by default, activated by hccl | |||
rt_ret = rtModelBindStream(model, *stream, RT_MODEL_WAIT_ACTIVE_STREAM); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -253,13 +253,13 @@ void HcclTask::SaveHcclSecondaryStream(int64_t master_stream_id, const std::shar | |||
HcclTask::StreamGuard::~StreamGuard() { | |||
rtError_t rt_ret = rtModelUnbindStream(model_, stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Unbind stream from model failed!"); | |||
return; | |||
} | |||
rt_ret = rtStreamDestroy(stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Destroy stream failed!"); | |||
return; | |||
} | |||
@@ -55,7 +55,7 @@ bool LabelGotoTask::Distribute() { | |||
return false; | |||
} | |||
rtError_t rt_ret = rtLabelGotoEx(label_, stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -55,7 +55,7 @@ bool LabelSetTask::Distribute() { | |||
return false; | |||
} | |||
rtError_t rt_ret = rtLabelSet(label_, stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -45,7 +45,7 @@ LabelSwitchTask::LabelSwitchTask(const ModelContext &model_context, | |||
LabelSwitchTask::~LabelSwitchTask() { | |||
if (label_info_ != nullptr) { | |||
rtError_t rt_ret = rtFree(label_info_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "rtFree fwkOpBuf failed! ret: 0x%X.", rt_ret); | |||
} | |||
label_info_ = nullptr; | |||
@@ -74,19 +74,19 @@ bool LabelSwitchTask::Distribute() { | |||
uint32_t label_info_size = sizeof(rtLabelDevInfo) * task_info_->label_size(); | |||
rtError_t rt_ret = rtMalloc(&label_info_, label_info_size, RT_MEMORY_HBM); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
rt_ret = rtLabelListCpy(label_list.data(), label_list.size(), label_info_, label_info_size); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
rt_ret = rtLabelSwitchByIndex(task_info_->cond(), label_list.size(), label_info_, stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -42,7 +42,7 @@ bool MemcpyAsyncTask::Distribute() { | |||
GELOGI("dst_max:%lu, count:%lu, kind:%u.", task_info_->dst_max(), task_info_->count(), task_info_->kind()); | |||
rtError_t rt_ret = rtMemcpyAsync(task_info_->dst(), task_info_->dst_max(), task_info_->src(), task_info_->count(), | |||
static_cast<rtMemcpyKind_t>(task_info_->kind()), stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -39,7 +39,7 @@ bool ProfilerTask::Distribute() { | |||
GELOGI("ProfilerTask Distribute start."); | |||
GELOGI("logid = %lu, notify = %d, flat = %u.", task_info_->log_id(), task_info_->notify(), task_info_->flat()); | |||
rtError_t rt_ret = rtProfilerTrace(task_info_->log_id(), task_info_->notify(), task_info_->flat(), stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -45,7 +45,7 @@ bool StreamActiveTask::Distribute() { | |||
GELOGI("Distribute start"); | |||
GELOGI("Stream %u active %u.", task_info_->stream_id(), task_info_->active_stream_id()); | |||
rtError_t rt_ret = rtStreamActive(active_stream_, stream_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -67,7 +67,7 @@ bool StreamSwitchTask::Distribute() { | |||
GELOGI("StreamSwitchTask Distribute Start."); | |||
rtError_t rt_ret = rtStreamSwitchEx(input, cond, value, true_stream, stream_, data_type); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -24,6 +24,7 @@ | |||
#include "runtime/rt_model.h" | |||
#include "ge_runtime/model_context.h" | |||
#include "ge_runtime/task_info.h" | |||
#include "external/runtime/rt_error_codes.h" | |||
namespace ge { | |||
namespace model_runner { | |||
@@ -44,7 +44,7 @@ TbeTask::TbeTask(const ModelContext &model_context, const std::shared_ptr<TbeTas | |||
TbeTask::~TbeTask() { | |||
if (args_ != nullptr) { | |||
rtError_t rt_ret = rtFree(args_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "rtFree fwkOpBuf failed! ret: 0x%X.", rt_ret); | |||
} | |||
args_ = nullptr; | |||
@@ -64,7 +64,7 @@ bool TbeTask::Distribute() { | |||
} | |||
rtError_t rt_ret = rtGetFunctionByName(const_cast<char *>(task_info_->stub_func().c_str()), &stub_func_); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "rtGetFunctionByName failed, ret: %d", static_cast<int32_t>(rt_ret)); | |||
stub_func_ = nullptr; | |||
return false; | |||
@@ -82,7 +82,7 @@ bool TbeTask::Distribute() { | |||
auto args_size = static_cast<uint32_t>(tensor_device_addrs.size() * sizeof(void *)); | |||
rt_ret = rtMalloc(&args_, args_size, RT_MEMORY_HBM); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "rtMalloc failed, ret: %d", static_cast<int32_t>(rt_ret)); | |||
return false; | |||
} | |||
@@ -90,7 +90,7 @@ bool TbeTask::Distribute() { | |||
rt_ret = rtMemcpy(args_, args_size, reinterpret_cast<void *>(tensor_device_addrs.data()), args_size, | |||
RT_MEMCPY_HOST_TO_DEVICE); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "rtMemcpy fail, ret 0x%X.", rt_ret); | |||
return false; | |||
} | |||
@@ -98,7 +98,7 @@ bool TbeTask::Distribute() { | |||
GELOGI("DistributeTbeTask start."); | |||
auto dump_flag = task_info_->dump_flag() ? RT_KERNEL_DUMPFLAG : RT_KERNEL_DEFAULT; | |||
rt_ret = rtKernelLaunchWithFlag(stub_func_, task_info_->block_dim(), args_, args_size, nullptr, stream_, dump_flag); | |||
if (rt_ret != RT_ERROR_NONE) { | |||
if (rt_ret != ACL_RT_SUCCESS) { | |||
GELOGE(RT_FAILED, "Call rt api rtKernelLaunch failed, ret: 0x%X", rt_ret); | |||
return false; | |||
} | |||
@@ -20,29 +20,12 @@ | |||
#include "graph/debug/ge_attr_define.h" | |||
#include "graph/node.h" | |||
#include "register/op_tiling_registry.h" | |||
#include <nlohmann/json.hpp> | |||
namespace optiling { | |||
#define REGISTER_OP_TILING_FUNC(optype, opfunc) REGISTER_OP_TILING_FUNC_UNIQ_HELPER(optype, opfunc, __COUNTER__) | |||
#define REGISTER_OP_TILING_FUNC_UNIQ_HELPER(optype, opfunc, counter) \ | |||
REGISTER_OP_TILING_FUNC_UNIQ(optype, opfunc, counter) | |||
#define REGISTER_OP_TILING_FUNC_UNIQ(optype, opfunc, counter) \ | |||
static OpTilingInterf g_##optype##TilingInterf##counter(#optype, opfunc) | |||
using OpTilingFuncOld = | |||
std::function<bool(const std::string &, const TeOpParas &, const nlohmann::json &, OpRunInfo &)>; | |||
class FMK_FUNC_HOST_VISIBILITY OpTilingInterf { | |||
public: | |||
OpTilingInterf(std::string op_type, OpTilingFuncOld func); | |||
~OpTilingInterf() = default; | |||
static std::string OpTilingUuid; | |||
}; | |||
extern "C" ge::graphStatus OpParaCalculate(const ge::Node &node, OpRunInfo &run_info); | |||
extern "C" ge::graphStatus OpAtomicCalculate(const ge::Node &node, OpRunInfo &run_info); | |||
} // namespace optiling | |||
} | |||
#endif // INC_REGISTER_OP_TILING_H_ | |||
#endif // INC_REGISTER_OP_TILING_H_ |
@@ -19,93 +19,135 @@ | |||
#include <functional> | |||
#include <map> | |||
#include <nlohmann/json.hpp> | |||
#include <sstream> | |||
#include <string> | |||
#include <vector> | |||
#include "external/register/register_types.h" | |||
#include "external/graph/tensor.h" | |||
#define REGISTER_OP_TILING(optype, opfunc) REGISTER_OP_TILING_UNIQ_HELPER(optype, opfunc, __COUNTER__) | |||
#define REGISTER_OP_TILING_FUNC(optype, opfunc) \ | |||
REGISTER_OP_TILING_FUNC_UNIQ_HELPER(optype, opfunc, __COUNTER__) | |||
#define REGISTER_OP_TILING_FUNC_NEW(optype, opfunc) REGISTER_OP_TILING_UNIQ_HELPER(optype, opfunc, __COUNTER__) | |||
#define REGISTER_OP_TILING_FUNC_UNIQ_HELPER(optype, opfunc, counter) \ | |||
REGISTER_OP_TILING_FUNC_UNIQ(optype, opfunc, counter) | |||
#define REGISTER_OP_TILING_UNIQ_HELPER(optype, opfunc, counter) REGISTER_OP_TILING_UNIQ(optype, opfunc, counter) | |||
#define REGISTER_OP_TILING_FUNC_UNIQ(optype, opfunc, counter) \ | |||
static OpTilingInterf g_##optype##TilingInterf##counter(#optype, opfunc) | |||
#define REGISTER_OP_TILING_UNIQ(optype, opfunc, counter) \ | |||
static OpTilingRegistryInterf g_##optype##TilingRegistryInterf##counter(#optype, opfunc) | |||
#define REGISTER_OP_TILING_FUNC_NEW(optype, opfunc) \ | |||
REGISTER_OP_TILING_UNIQ_HELPER(optype, opfunc, __COUNTER__) | |||
#define REGISTER_OP_TILING(optype, opfunc) \ | |||
REGISTER_OP_TILING_UNIQ_HELPER(optype, opfunc, __COUNTER__) | |||
#define REGISTER_OP_TILING_UNIQ_HELPER(optype, opfunc, counter) \ | |||
REGISTER_OP_TILING_UNIQ(optype, opfunc, counter) | |||
#define REGISTER_OP_TILING_UNIQ(optype, opfunc, counter) \ | |||
static OpTilingRegistryInterf g_##optype##TilingRegistryInterf##counter(#optype, opfunc) | |||
namespace optiling { | |||
enum TensorArgType { | |||
TA_NONE, | |||
TA_SINGLE, | |||
TA_LIST, | |||
TA_NONE, | |||
TA_SINGLE, | |||
TA_LIST, | |||
}; | |||
using ByteBuffer = std::stringstream; | |||
struct TeOpTensor { | |||
std::vector<int64_t> shape; | |||
std::vector<int64_t> ori_shape; | |||
std::string format; | |||
std::string ori_format; | |||
std::string dtype; | |||
std::map<std::string, std::string> attrs; | |||
std::vector<int64_t> shape; | |||
std::vector<int64_t> ori_shape; | |||
std::string format; | |||
std::string ori_format; | |||
std::string dtype; | |||
std::map<std::string, std::string> attrs; | |||
}; | |||
struct TeOpTensorArg { | |||
TensorArgType arg_type; | |||
std::vector<TeOpTensor> tensor; | |||
TensorArgType arg_type; | |||
std::vector<TeOpTensor> tensor; | |||
}; | |||
struct OpRunInfo { | |||
uint32_t block_dim; | |||
std::vector<int64_t> workspaces; | |||
ByteBuffer tiling_data; | |||
bool clear_atomic; | |||
uint32_t block_dim; | |||
std::vector<int64_t> workspaces; | |||
ByteBuffer tiling_data; | |||
bool clear_atomic; | |||
}; | |||
using TeOpAttrArgs = std::vector<std::string>; | |||
using TeConstTensorData = std::tuple<const uint8_t *, size_t, ge::Tensor>; | |||
using TeConstTensorData = std::tuple<const uint8_t*, size_t, ge::Tensor>; | |||
struct TeOpParas { | |||
std::vector<TeOpTensorArg> inputs; | |||
std::vector<TeOpTensorArg> outputs; | |||
std::map<std::string, TeConstTensorData> const_inputs; | |||
TeOpAttrArgs attrs; | |||
std::string op_type; | |||
std::vector<TeOpTensorArg> inputs; | |||
std::vector<TeOpTensorArg> outputs; | |||
std::map<std::string, TeConstTensorData> const_inputs; | |||
TeOpAttrArgs attrs; | |||
std::string op_type; | |||
}; | |||
using OpTilingFunc = std::function<bool(const std::string&, const TeOpParas&, | |||
const nlohmann::json& , OpRunInfo&)>; | |||
using OpTilingFuncPtr = bool(*)(const std::string&, const TeOpParas&, const nlohmann::json& , OpRunInfo&); | |||
class FMK_FUNC_HOST_VISIBILITY OpTilingInterf | |||
{ | |||
public: | |||
OpTilingInterf(std::string op_type, OpTilingFunc func); | |||
~OpTilingInterf() = default; | |||
static std::map<std::string, OpTilingFunc> &RegisteredOpInterf(); | |||
static std::string OpTilingUuid; | |||
}; | |||
struct OpCompileInfo { | |||
std::string str; | |||
std::string key; | |||
std::string str; | |||
std::string key; | |||
}; | |||
using OpTilingFunc = std::function<bool(const TeOpParas &, const OpCompileInfo &, OpRunInfo &)>; | |||
using OpTilingFuncNew = std::function<bool(const TeOpParas&, const OpCompileInfo& , OpRunInfo&)>; | |||
using OpTilingFuncPtr = bool (*)(const TeOpParas &, const OpCompileInfo &, OpRunInfo &); | |||
using OpTilingFuncPtrNew = bool(*)(const TeOpParas&, const OpCompileInfo& , OpRunInfo&); | |||
class FMK_FUNC_HOST_VISIBILITY OpTilingRegistryInterf { | |||
public: | |||
OpTilingRegistryInterf(std::string op_type, OpTilingFunc func); | |||
~OpTilingRegistryInterf() = default; | |||
static std::map<std::string, OpTilingFunc> &RegisteredOpInterf(); | |||
public: | |||
OpTilingRegistryInterf(std::string op_type, OpTilingFuncNew func); | |||
~OpTilingRegistryInterf() = default; | |||
static std::map<std::string, OpTilingFuncNew> &RegisteredOpInterf(); | |||
}; | |||
template <class T> | |||
ByteBuffer &ByteBufferPut(ByteBuffer &buf, const T &value) { | |||
buf.write(reinterpret_cast<const char *>(&value), sizeof(value)); | |||
buf.flush(); | |||
return buf; | |||
ByteBuffer& ByteBufferPut(ByteBuffer &buf, const T &value) | |||
{ | |||
buf.write(reinterpret_cast<const char*>(&value), sizeof(value)); | |||
buf.flush(); | |||
return buf; | |||
} | |||
template <class T> | |||
ByteBuffer &ByteBufferGet(ByteBuffer &buf, T &value) { | |||
buf.read(reinterpret_cast<char *>(&value), sizeof(value)); | |||
return buf; | |||
ByteBuffer& ByteBufferGet(ByteBuffer &buf, T &value) | |||
{ | |||
buf.read(reinterpret_cast<char*>(&value), sizeof(value)); | |||
return buf; | |||
} | |||
size_t ByteBufferGetAll(ByteBuffer &buf, char *dest, size_t dest_len); | |||
} // namespace optiling | |||
inline size_t ByteBufferGetAll(ByteBuffer &buf, char *dest, size_t dest_len) | |||
{ | |||
size_t nread = 0; | |||
size_t rn = 0; | |||
do { | |||
rn = buf.readsome(dest + nread, dest_len - nread); | |||
nread += rn; | |||
} while (rn > 0 && dest_len > nread); | |||
return nread; | |||
} | |||
} | |||
#endif // INC_REGISTER_OP_TILING_REGISTRY_H_ | |||
#endif // INC_REGISTER_OP_TILING_REGISTRY_H_ |
@@ -32,309 +32,8 @@ extern "C" { | |||
#endif | |||
#endif | |||
/** | |||
* @ingroup dvrt_base | |||
* @brief runtime error numbers. | |||
*/ | |||
typedef enum tagRtError { | |||
RT_ERROR_NONE = 0x0, // success | |||
RT_ERROR_DEVICE_BASE = 0x07010000, | |||
RT_ERROR_DEVICE_NULL, | |||
RT_ERROR_DEVICE_NEW, | |||
RT_ERROR_DEVICE_ID, | |||
RT_ERROR_DEVICE_CHIPTYPE, | |||
RT_ERROR_DEVICE_DEPLOY, | |||
RT_ERROR_DEVICE_RETAIN, | |||
RT_ERROR_DEVICE_PLATFORM, | |||
RT_ERROR_DEVICE_LOADER, | |||
RT_ERROR_DEVICE_LIMIT, | |||
RT_ERROR_DEVICE_PROC_HANG_OUT, | |||
RT_ERROR_DEVICE_POWER_UP_FAIL, | |||
RT_ERROR_DEVICE_POWER_DOWN_FAIL, | |||
RT_ERROR_DEVICE_INVALID, | |||
RT_ERROR_DRV_BASE = 0x07020000, | |||
RT_ERROR_DRV_NULL, | |||
RT_ERROR_DRV_NEW, | |||
RT_ERROR_DRV_MEMORY, | |||
RT_ERROR_DRV_INPUT, | |||
RT_ERROR_DRV_PTRNULL, | |||
RT_ERROR_DRV_OPEN_AICPU, | |||
RT_ERROR_DRV_CLOSE_AICPU, | |||
RT_ERROR_DRV_SYM_AICPU, | |||
RT_ERROR_DRV_OPEN_TSD, | |||
RT_ERROR_DRV_CLOSE_TSD, | |||
RT_ERROR_DRV_SYM_TSD, | |||
RT_ERROR_DRV_SOURCE, | |||
RT_ERROR_DRV_REPORT, | |||
RT_ERROR_DRV_COMMAND, | |||
RT_ERROR_DRV_OCCUPY, | |||
RT_ERROR_DRV_ERR, | |||
RT_ERROR_STREAM_BASE = 0x07030000, | |||
RT_ERROR_STREAM_NULL, | |||
RT_ERROR_STREAM_NEW, | |||
RT_ERROR_STREAM_CONTEXT, | |||
RT_ERROR_STREAM_INVALID, | |||
RT_ERROR_STREAM_MODEL, | |||
RT_ERROR_STREAM_FUSION, | |||
RT_ERROR_STREAM_FULL, | |||
RT_ERROR_STREAM_EMPTY, | |||
RT_ERROR_STREAM_NOT_COMPLETE, | |||
RT_ERROR_STREAM_SYNC, | |||
RT_ERROR_STREAM_NO_CB_REG, | |||
RT_ERROR_STREAM_DUPLICATE, | |||
RT_ERROR_STREAM_NOT_EXIST, | |||
RT_ERROR_SQ_NO_EXIST_SQ_TO_REUSE, | |||
RT_ERROR_SQID_FULL, | |||
RT_ERROR_MODEL_BASE = 0x07040000, | |||
RT_ERROR_MODEL_NULL, | |||
RT_ERROR_MODEL_NEW, | |||
RT_ERROR_MODEL_CONTEXT, | |||
RT_ERROR_MODEL_ENDGRAPH, | |||
RT_ERROR_MODEL_STREAM, | |||
RT_ERROR_MODEL_EXCUTOR, | |||
RT_ERROR_MODEL_SETUP, | |||
RT_ERROR_MODEL_ID, | |||
RT_ERROR_MODEL_EXE_FAILED, | |||
RT_ERROR_END_OF_SEQUENCE, // end of sequence | |||
RT_ERROR_MODEL_EXIT, | |||
RT_ERROR_MODEL_EXIT_STREAM_UNBIND, | |||
RT_ERROR_MODEL_EXIT_ID, | |||
RT_ERROR_MODEL_ABORT_NORMAL, | |||
RT_ERROR_EVENT_BASE = 0x07050000, | |||
RT_ERROR_EVENT_NULL, | |||
RT_ERROR_EVENT_NEW, | |||
RT_ERROR_EVENT_RECORDER_NULL, | |||
RT_ERROR_EVENT_TIMESTAMP_INVALID, | |||
RT_ERROR_EVENT_TIMESTAMP_REVERSAL, | |||
RT_ERROR_EVENT_NOT_COMPLETE, | |||
RT_ERROR_NOTIFY_BASE = 0x07060000, | |||
RT_ERROR_NOTIFY_NULL, | |||
RT_ERROR_NOTIFY_NEW, | |||
RT_ERROR_NOTIFY_TYPE, | |||
RT_ERROR_NOTIFY_NOT_COMPLETE, | |||
RT_ERROR_CONTEXT_BASE = 0x07070000, | |||
RT_ERROR_CONTEXT_NULL, | |||
RT_ERROR_CONTEXT_NEW, | |||
RT_ERROR_CONTEXT_DEL, | |||
RT_ERROR_CONTEXT_DEFAULT_STREAM_NULL, | |||
RT_ERROR_CONTEXT_ONLINE_STREAM_NULL, | |||
RT_ERROR_KERNEL_BASE = 0x07080000, | |||
RT_ERROR_KERNEL_NULL, | |||
RT_ERROR_KERNEL_NEW, | |||
RT_ERROR_KERNEL_LOOKUP, | |||
RT_ERROR_KERNEL_NAME, | |||
RT_ERROR_KERNEL_TYPE, | |||
RT_ERROR_KERNEL_OFFSET, | |||
RT_ERROR_KERNEL_DUPLICATE, | |||
RT_ERROR_KERNEL_UNREGISTERING, | |||
RT_ERROR_PROGRAM_BASE = 0x07090000, | |||
RT_ERROR_PROGRAM_NULL, | |||
RT_ERROR_PROGRAM_NEW, | |||
RT_ERROR_PROGRAM_DATA, | |||
RT_ERROR_PROGRAM_SIZE, | |||
RT_ERROR_PROGRAM_MEM_TYPE, | |||
RT_ERROR_PROGRAM_MACHINE_TYPE, | |||
RT_ERROR_PROGRAM_USEOUT, | |||
RT_ERROR_MODULE_BASE = 0x070a0000, | |||
RT_ERROR_MODULE_NULL, | |||
RT_ERROR_MODULE_NEW, | |||
RT_ERROR_INSTANCE_BASE = 0x070b0000, | |||
RT_ERROR_INSTANCE_NULL, | |||
RT_ERROR_INSTANCE_NEW, | |||
RT_ERROR_INSTANCE_VERSION, | |||
RT_ERROR_API_BASE = 0x070c0000, | |||
RT_ERROR_API_NULL, | |||
RT_ERROR_API_NEW, | |||
RT_ERROR_DATADUMP_BASE = 0x070d0000, | |||
RT_ERROR_DATADUMP_NULL, | |||
RT_ERROR_DATADUMP_NEW, | |||
RT_ERROR_DATADUMP_TIME, | |||
RT_ERROR_DATADUMP_FILE, | |||
RT_ERROR_DATADUMP_ADDRESS, | |||
RT_ERROR_DATADUMP_LOAD_FAILED, | |||
RT_ERROR_DUMP_ADDR_SET_FAILED, | |||
RT_ERROR_PROF_BASE = 0x070e0000, | |||
RT_ERROR_PROF_NULL, | |||
RT_ERROR_PROF_NEW, | |||
RT_ERROR_PROF_START, | |||
RT_ERROR_PROF_DEVICE_MEM, | |||
RT_ERROR_PROF_HOST_MEM, | |||
RT_ERROR_PROF_SET_DIR, | |||
RT_ERROR_PROF_OPER, | |||
RT_ERROR_PROF_FULL, | |||
RT_ERROR_PROF_NAME, | |||
RT_ERROR_PCTRACE_BASE = 0x070f0000, | |||
RT_ERROR_PCTRACE_NULL, | |||
RT_ERROR_PCTRACE_NEW, | |||
RT_ERROR_PCTRACE_TIME, | |||
RT_ERROR_PCTRACE_FILE, | |||
RT_ERROR_TASK_BASE = 0x07100000, | |||
RT_ERROR_TASK_NULL, | |||
RT_ERROR_TASK_NEW, | |||
RT_ERROR_TASK_TYPE, | |||
RT_ERROR_TASK_ALLOCATOR, | |||
RT_ERROR_COMMON_BASE = 0x07110000, | |||
RT_ERROR_INVALID_VALUE, // RT_ERROR_INPUT_INVALID | |||
RT_ERROR_MEMORY_ADDRESS_UNALIGNED, | |||
RT_ERROR_SEC_HANDLE, | |||
RT_ERROR_OS_HANDLE, | |||
RT_ERROR_MUTEX_LOCK, | |||
RT_ERROR_MUTEX_UNLOCK, | |||
RT_ERROR_CALLOC, | |||
RT_ERROR_POOL_RESOURCE, | |||
RT_ERROR_TRANS_ARGS, | |||
RT_ERROR_METADATA, | |||
RT_ERROR_LOST_HEARTBEAT, | |||
RT_ERROR_REPORT_TIMEOUT, | |||
RT_ERROR_FEATURE_NOT_SUPPROT, | |||
RT_ERROR_MEMORY_ALLOCATION, | |||
RT_ERROR_MEMORY_FREE, | |||
RT_ERROR_INVALID_MEMORY_TYPE, | |||
RT_ERROR_DEBUG_BASE = 0x07120000, | |||
RT_ERROR_DEBUG_NULL, | |||
RT_ERROR_DEBUG_NEW, | |||
RT_ERROR_DEBUG_SIGNAL, | |||
RT_ERROR_DEBUG_OPEN, | |||
RT_ERROR_DEBUG_WRITE, | |||
RT_ERROR_DEBUG_REGISTER_FAILED, | |||
RT_ERROR_DEBUG_UNREGISTER_FAILED, | |||
RT_ERROR_ENGINE_BASE = 0x07130000, | |||
RT_ERROR_ENGINE_NULL, | |||
RT_ERROR_ENGINE_NEW, | |||
RT_ERROR_ENGINE_THREAD, | |||
RT_ERROR_LABEL_BASE = 0x07140000, | |||
RT_ERROR_LABEL_NULL, | |||
RT_ERROR_LABEL_NEW, | |||
RT_ERROR_LABEL_CONTEXT, | |||
RT_ERROR_LABEL_STREAM, | |||
RT_ERROR_LABEL_MODEL, | |||
RT_ERROR_LABEL_ALLOCATOR, | |||
RT_ERROR_LABEL_FREE, | |||
RT_ERROR_LABEL_SET, | |||
RT_ERROR_LABEL_ID, | |||
RT_ERROR_TSFW_BASE = 0x07150000, | |||
RT_ERROR_TSFW_UNKNOWN, | |||
RT_ERROR_TSFW_NULL_PTR, | |||
RT_ERROR_TSFW_ILLEGAL_AI_CORE_ID, | |||
RT_ERROR_TSFW_ILLEGAL_PARAM, | |||
RT_ERROR_TSFW_TASK_CMD_QUEUE_FULL, | |||
RT_ERROR_TSFW_TASK_CMD_QUEUE_EMPTY, | |||
RT_ERROR_TSFW_TASK_REPORT_QUEUE_FULL, | |||
RT_ERROR_TSFW_TASK_REPORT_QUEUE_EMPTY, | |||
RT_ERROR_TSFW_TASK_NODE_BUFF_ALL_OCCUPYED, | |||
RT_ERROR_TSFW_TASK_NODE_BUFF_ALL_FREED, | |||
RT_ERROR_TSFW_L2_MEM_INSUFFICIENT_SPACE, | |||
RT_ERROR_TSFW_L2_MALLOC_FAILED, | |||
RT_ERROR_TSFW_DMA_CHANNEL_ALL_OCCUPYED, | |||
RT_ERROR_TSFW_MEMCPY_OP_FAILED, | |||
RT_ERROR_TSFW_BS_SLOT_ALL_OCCUPYED, | |||
RT_ERROR_TSFW_TBS_SLOT_REPEAT_FREE, | |||
RT_ERROR_TSFW_PRIORITY_TASK_LIST_FULL, | |||
RT_ERROR_TSFW_PRIORITY_TASK_LIST_EMPTY, | |||
RT_ERROR_TSFW_NO_STREAM_LIST_NEED_TO_BE_PROCESSED, | |||
RT_ERROR_TSFW_REPEAT_MARK_STREAM_NEED_SERVICE, | |||
RT_ERROR_TSFW_SYS_DMA_CHANNEL_ALL_OCCUPAPYED, | |||
RT_ERROR_TSFW_NO_HBML2TASKNODE_FOUND, | |||
RT_ERROR_TSFW_SQNODE_NODE_SLOT_ALL_OCCUPAPYED, | |||
RT_ERROR_TSFW_CQNODE_NODE_SLOT_ALL_OCCUPAPYED, | |||
RT_ERROR_TSFW_SQNODE_NOT_ENOUGH, | |||
RT_ERROR_TSFW_SQNODE_SLOT_REPEAT_FREE, | |||
RT_ERROR_TSFW_CQNODE_SLOT_REPEAT_FREE, | |||
RT_ERROR_TSFW_CQ_REPORT_FAILED, | |||
RT_ERROR_TSFW_SYS_DMA_RESET_SUCCESS, | |||
RT_ERROR_TSFW_SYS_DMA_RESET_FAILED, | |||
RT_ERROR_TSFW_SYS_DMA_TRNSFER_FAILED, | |||
RT_ERROR_TSFW_SYS_DMA_MEMADDRALIGN_FAILED, | |||
RT_ERROR_TSFW_SYS_DMA_ERROR_QUEUE_FULL, | |||
RT_ERROR_TSFW_SYS_DMA_ERROR_QUEUE_EMPTY, | |||
RT_ERROR_TSFW_TIMER_EVENT_FULL, | |||
RT_ERROR_TSFW_TASK_L2_DESC_ENTRY_NOT_ENOUGH, | |||
RT_ERROR_TSFW_AICORE_TIMEOUT, | |||
RT_ERROR_TSFW_AICORE_EXCEPTION, | |||
RT_ERROR_TSFW_AICORE_TRAP_EXCEPTION, | |||
RT_ERROR_TSFW_AICPU_TIMEOUT, | |||
RT_ERROR_TSFW_SDMA_L2_TO_DDR_MALLOC_FAIL, | |||
RT_ERROR_TSFW_AICPU_EXCEPTION, | |||
RT_ERROR_TSFW_AICPU_DATADUMP_RSP_ERR, | |||
RT_ERROR_TSFW_AICPU_MODEL_RSP_ERR, | |||
RT_ERROR_TSFW_REPEAT_ACTIVE_MODEL_STREAM, | |||
RT_ERROR_TSFW_REPEAT_NOTIFY_WAIT, | |||
RT_ERROR_TSFW_DEBUG_INVALID_SQCQ, | |||
RT_ERROR_TSFW_DEBUG_WRONG_COMMAND_TYPE, | |||
RT_ERROR_TSFW_DEBUG_CMD_PROCESS, | |||
RT_ERROR_TSFW_DEBUG_INVALID_DEVICE_STATUS, | |||
RT_ERROR_TSFW_DEBUG_NOT_IN_DEBUG_STATUS, | |||
RT_ERROR_TSFW_DEBUG_INVALID_TASK_STATUS, | |||
RT_ERROR_TSFW_DEBUG_TASK_EMPTY, | |||
RT_ERROR_TSFW_DEBUG_TASK_FULL, | |||
RT_ERROR_TSFW_DEBUG_TASK_NOT_EXIST, | |||
RT_ERROR_TSFW_DEBUG_AI_CORE_FULL, | |||
RT_ERROR_TSFW_DEBUG_AI_CORE_NOT_EXIST, | |||
RT_ERROR_TSFW_DEBUG_AI_CORE_EXCEPTION, | |||
RT_ERROR_TSFW_DEBUG_AI_CORE_TIMEOUT, | |||
RT_ERROR_TSFW_DEBUG_BREAKPOINT_FULL, | |||
RT_ERROR_TSFW_DEBUG_READ_ERROR, | |||
RT_ERROR_TSFW_DEBUG_WRITE_FAIL, | |||
RT_ERROR_TSFW_QUEUE_FULL, | |||
RT_ERROR_TSFW_QUEUE_EMPTY, | |||
RT_ERROR_TSFW_QUEUE_ALLOC_MEM_FAIL, | |||
RT_ERROR_TSFW_QUEUE_DATA_SIZE_UNMATCH, | |||
RT_ERROR_TSFW_PCIE_DMA_INVLD_CPY_TYPE, | |||
RT_ERROR_TSFW_INVLD_CPY_DIR, | |||
RT_ERROR_TSFW_PCIE_DMA_INVLD_CQ_DES, | |||
RT_ERROR_TSFW_PCIE_DMA_CPY_ERR, | |||
RT_ERROR_TSFW_PCIE_DMA_LNK_CHN_BUSY, | |||
RT_ERROR_TSFW_PROFILE_BUFF_FULL, | |||
RT_ERROR_TSFW_PROFILE_MODE_CONFLICT, | |||
RT_ERROR_TSFW_PROFILE_OTHER_PID_ON, | |||
RT_ERROR_TSFW_SCHD_AIC_TASK_PRELOAD_FAILED, | |||
RT_ERROR_TSFW_TSCPU_CLOSE_FAILED, | |||
RT_ERROR_TSFW_EXPECT_FAIL, | |||
RT_ERROR_TSFW_REPEAT_MODEL_STREAM, | |||
RT_ERROR_TSFW_STREAM_MODEL_UNBIND, | |||
RT_ERROR_TSFW_MODEL_EXE_FAILED, | |||
RT_ERROR_TSFW_IPC_SEND_FAILED, | |||
RT_ERROR_TSFW_IPC_PROC_REG_FAILED, | |||
RT_ERROR_TSFW_STREAM_FULL, | |||
RT_ERROR_TSFW_END_OF_SEQUENCE, | |||
RT_ERROR_TSFW_SWITCH_STREAM_LABEL, | |||
RT_ERROR_TSFW_TRANS_SQE_FAIL, | |||
RT_ERROR_TSFW_RESERVED, | |||
RT_ERROR_SUBSCRIBE_BASE = 0x07160000, | |||
RT_ERROR_SUBSCRIBE_NULL, | |||
RT_ERROR_SUBSCRIBE_NEW, | |||
RT_ERROR_SUBSCRIBE_STREAM, | |||
RT_ERROR_SUBSCRIBE_THREAD, | |||
RT_ERROR_SUBSCRIBE_GROUP, | |||
RT_ERROR_GROUP_BASE = 0x07170000, | |||
RT_ERROR_GROUP_NOT_SET, | |||
RT_ERROR_GROUP_NOT_CREATE, | |||
RT_ERROR_RESERVED = 0x07ff0000, | |||
}rtError_t; | |||
typedef int32_t rtError_t; | |||
static const int32_t RT_ERROR_NONE = 0; // success | |||
/** | |||
* @ingroup dvrt_base | |||