From: @zhengyuanhua Reviewed-by: @xchu42,@wqtshg,@ji_chen Signed-off-by: @ji_chentags/v1.3.0
@@ -355,6 +355,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportDa | |||||
reporter_data.deviceId = device_id; | reporter_data.deviceId = device_id; | ||||
ret = memcpy_s(reporter_data.tag, MSPROF_ENGINE_MAX_TAG_LEN + 1, tag_name.c_str(), tag_name.size()); | ret = memcpy_s(reporter_data.tag, MSPROF_ENGINE_MAX_TAG_LEN + 1, tag_name.c_str(), tag_name.size()); | ||||
GE_IF_BOOL_EXEC(ret != EOK, GELOGE(ret, "Report data tag [%s] memcpy error!", tag_name.c_str()); return;); | GE_IF_BOOL_EXEC(ret != EOK, GELOGE(ret, "Report data tag [%s] memcpy error!", tag_name.c_str()); return;); | ||||
std::lock_guard<std::mutex> lock(mutex_report_); | |||||
for (size_t i = 0; i < index; ++i) { | for (size_t i = 0; i < index; ++i) { | ||||
reporter_data.data = (unsigned char *)data.c_str() + report_max_len * i; | reporter_data.data = (unsigned char *)data.c_str() + report_max_len * i; | ||||
reporter_data.dataLen = report_max_len; | reporter_data.dataLen = report_max_len; | ||||
@@ -375,7 +376,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::ReportDa | |||||
reporter_data.dataLen = data.size(); | reporter_data.dataLen = data.size(); | ||||
ret = memcpy_s(reporter_data.tag, MSPROF_ENGINE_MAX_TAG_LEN + 1, tag_name.c_str(), tag_name.size()); | ret = memcpy_s(reporter_data.tag, MSPROF_ENGINE_MAX_TAG_LEN + 1, tag_name.c_str(), tag_name.size()); | ||||
GE_IF_BOOL_EXEC(ret != EOK, GELOGE(ret, "Report data tag [%s] memcpy error!", tag_name.c_str()); return;); | GE_IF_BOOL_EXEC(ret != EOK, GELOGE(ret, "Report data tag [%s] memcpy error!", tag_name.c_str()); return;); | ||||
std::lock_guard<std::mutex> lock(mutex_report_); | |||||
cb_ret = CallMsprofReport(reporter_data); | cb_ret = CallMsprofReport(reporter_data); | ||||
GE_IF_BOOL_EXEC(cb_ret != 0, GELOGE(cb_ret, "Reporter data [%s] failed, ret:%d", tag_name.c_str(), cb_ret); | GE_IF_BOOL_EXEC(cb_ret != 0, GELOGE(cb_ret, "Reporter data [%s] failed, ret:%d", tag_name.c_str(), cb_ret); | ||||
return;); | return;); | ||||
@@ -118,6 +118,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ProfilingManager { | |||||
map<uint32_t, DeviceSubsInfo> subs_dev_module_; // key: device_id, value: profiling on module | map<uint32_t, DeviceSubsInfo> subs_dev_module_; // key: device_id, value: profiling on module | ||||
uint32_t subscribe_count_; | uint32_t subscribe_count_; | ||||
std::mutex mutex_; | std::mutex mutex_; | ||||
std::mutex mutex_report_; | |||||
MsprofCallback prof_cb_; | MsprofCallback prof_cb_; | ||||
std::string fp_point_; | std::string fp_point_; | ||||
std::string bp_point_; | std::string bp_point_; | ||||
@@ -523,11 +523,9 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i | |||||
} | } | ||||
if (!dynamic_batch_size.empty()) { | if (!dynamic_batch_size.empty()) { | ||||
if (input_shape_range.find(":") != string::npos) { | |||||
if (!CheckDynamicBatchSizeInputShapeValid(shape_map, dynamic_batch_size)) { | |||||
GELOGE(ge::PARAM_INVALID, "[Check][DynamicBatchSizeInputShape] input_shape: %s invalid.", input_shape.c_str()); | |||||
return ge::PARAM_INVALID; | |||||
} | |||||
if (!CheckDynamicBatchSizeInputShapeValid(shape_map, dynamic_batch_size)) { | |||||
GELOGE(ge::PARAM_INVALID, "[Check][DynamicBatchSizeInputShape] input_shape: %s invalid.", input_shape.c_str()); | |||||
return ge::PARAM_INVALID; | |||||
} | } | ||||
} | } | ||||
@@ -361,6 +361,7 @@ using RunAsyncCallback = std::function<void(Status, std::vector<ge::OutputTensor | |||||
namespace ir_option { | namespace ir_option { | ||||
static const char *const INPUT_FORMAT = "input_format"; | static const char *const INPUT_FORMAT = "input_format"; | ||||
static const char *const INPUT_SHAPE = "input_shape"; | static const char *const INPUT_SHAPE = "input_shape"; | ||||
static const char *const INPUT_SHAPE_RANGE = ge::INPUT_SHAPE_RANGE; | |||||
static const char *const OP_NAME_MAP = "op_name_map"; | static const char *const OP_NAME_MAP = "op_name_map"; | ||||
static const char *const IS_DYNAMIC_INPUT = "is_dynamic_input"; | static const char *const IS_DYNAMIC_INPUT = "is_dynamic_input"; | ||||
static const char *const IS_INPUT_ADJUST_HW_LAYOUT = "is_input_adjust_hw_layout"; | static const char *const IS_INPUT_ADJUST_HW_LAYOUT = "is_input_adjust_hw_layout"; | ||||
@@ -163,7 +163,7 @@ TEST(UtestIrCommon, check_dynamic_input_param_succ) { | |||||
string dynamic_batch_size = "1"; | string dynamic_batch_size = "1"; | ||||
string dynamic_image_size; | string dynamic_image_size; | ||||
string dynamic_dims; | string dynamic_dims; | ||||
string input_shape = "data:1,3,244,244"; | |||||
string input_shape = "data:-1,3,244,244"; | |||||
string input_shape_range; | string input_shape_range; | ||||
string input_format = "NCHW"; | string input_format = "NCHW"; | ||||
bool is_dynamic_input = false; | bool is_dynamic_input = false; | ||||
@@ -173,6 +173,20 @@ TEST(UtestIrCommon, check_dynamic_input_param_succ) { | |||||
EXPECT_EQ(ret, ge::SUCCESS); | EXPECT_EQ(ret, ge::SUCCESS); | ||||
} | } | ||||
TEST(UtestIrCommon, check_dynamic_input_param_failed) { | |||||
string dynamic_batch_size = "1"; | |||||
string dynamic_image_size; | |||||
string dynamic_dims; | |||||
string input_shape = "data:1,3,244,244"; | |||||
string input_shape_range; | |||||
string input_format = "NCHW"; | |||||
bool is_dynamic_input = false; | |||||
Status ret = CheckDynamicInputParamValid(dynamic_batch_size, dynamic_image_size, dynamic_dims, | |||||
input_shape, input_shape_range, input_format,is_dynamic_input); | |||||
EXPECT_EQ(ret, ge::PARAM_INVALID); | |||||
} | |||||
TEST(UtestIrCommon, check_compress_weight) { | TEST(UtestIrCommon, check_compress_weight) { | ||||
std::string enable_compress_weight = "true"; | std::string enable_compress_weight = "true"; | ||||
std::string compress_weight_conf="./"; | std::string compress_weight_conf="./"; | ||||
@@ -78,3 +78,9 @@ TEST_F(UtestGeProfilinganager, plungin_init_) { | |||||
EXPECT_EQ(ret, INTERNAL_ERROR); | EXPECT_EQ(ret, INTERNAL_ERROR); | ||||
ProfilingManager::Instance().prof_cb_.msprofReporterCallback = nullptr; | ProfilingManager::Instance().prof_cb_.msprofReporterCallback = nullptr; | ||||
} | } | ||||
TEST_F(UtestGeProfilinganager, report_data_) { | |||||
std::string data = "ge is better than tensorflow."; | |||||
std::string tag_name = "fmk"; | |||||
ProfilingManager::Instance().ReportData(0, data, tag_name); | |||||
} |