|
|
@@ -22,6 +22,7 @@ |
|
|
|
#include "graph/load/graph_loader.h" |
|
|
|
#include "init/gelib.h" |
|
|
|
#include "framework/common/ge_inner_error_codes.h" |
|
|
|
#include "model/ge_model.h" |
|
|
|
|
|
|
|
namespace { |
|
|
|
const uint32_t kDeviceListIndex = 3; |
|
|
@@ -42,6 +43,10 @@ const std::map<ProfCommandHandleType, std::string> kProfCommandTypeMap = { |
|
|
|
{kProfCommandhandleFinalize, kProfilingFinalize}, |
|
|
|
{kProfCommandhandleModelSubscribe, kProfModelSubscribe}, |
|
|
|
{kProfCommandhandleModelUnsubscribe, kProfModelUnsubscribe}}; |
|
|
|
|
|
|
|
const uint64_t kModelId = ge::INVALID_MODEL_ID; |
|
|
|
const uint16_t kStepStart = 0; |
|
|
|
const uint16_t kStepEnd = 1; |
|
|
|
} // namespace |
|
|
|
|
|
|
|
bool TransProfConfigToParam(const ProfCommandHandleData &profCommand, vector<string> &prof_config_params) { |
|
|
@@ -216,6 +221,36 @@ ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t le |
|
|
|
return ge::SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
GE_FUNC_VISIBILITY ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t stream) { |
|
|
|
return ge::SUCCESS; |
|
|
|
ge::Status ProfSetStepInfo(uint64_t index_id, uint16_t tag_id, rtStream_t stream) { |
|
|
|
static bool is_first_run = true; |
|
|
|
int32_t device_id = 0; |
|
|
|
rtError_t rt_ret = rtGetDevice(&device_id); |
|
|
|
if (rt_ret != RT_ERROR_NONE) { |
|
|
|
GELOGE(rt_ret, "[Get][LogicDeviceId]Failed, ret 0x%X", rt_ret); |
|
|
|
REPORT_CALL_ERROR("E19999", "Get logic device id failed, ret 0x%X", rt_ret); |
|
|
|
return ge::FAILED; |
|
|
|
} |
|
|
|
if (is_first_run && tag_id == kStepStart) { |
|
|
|
GE_CHK_STATUS_RET_NOLOG(ge::ProfilingManager::Instance().ProfileStepInfo(index_id, |
|
|
|
kModelId, |
|
|
|
tag_id, |
|
|
|
stream, |
|
|
|
device_id)); |
|
|
|
is_first_run = false; |
|
|
|
return ge::SUCCESS; |
|
|
|
} |
|
|
|
if (!is_first_run && tag_id == kStepEnd) { |
|
|
|
GE_CHK_STATUS_RET_NOLOG(ge::ProfilingManager::Instance().ProfileStepInfo(index_id, |
|
|
|
kModelId, |
|
|
|
tag_id, |
|
|
|
stream, |
|
|
|
device_id)); |
|
|
|
is_first_run = true; |
|
|
|
return ge::SUCCESS; |
|
|
|
} |
|
|
|
GELOGE(ge::FAILED, "Param tag_id:%u invalid when is_first_run is %d", tag_id, is_first_run); |
|
|
|
REPORT_INPUT_ERROR("E10001", std::vector<std::string>({"value", "parameter", "reason"}), |
|
|
|
std::vector<std::string>({std::to_string(tag_id), "tag_id", |
|
|
|
"tag id must be 0 when first run, must be 1 when second run"})); |
|
|
|
return ge::FAILED; |
|
|
|
} |