|
|
|
@@ -29,6 +29,7 @@ |
|
|
|
#include "common/types.h" |
|
|
|
#include "common/util.h" |
|
|
|
#include "common/util/error_manager/error_manager.h" |
|
|
|
#include "external/ge/ge_api_types.h" |
|
|
|
#include "ge/ge_api_types.h" |
|
|
|
#include "graph/opsproto_manager.h" |
|
|
|
#include "graph/utils/type_utils.h" |
|
|
|
@@ -56,7 +57,7 @@ static std::map<std::string, domiTensorFormat_t> kInputFormatStrToGeformat = { |
|
|
|
{"NCDHW", domi::DOMI_TENSOR_NCDHW}, |
|
|
|
{"NDHWC", domi::DOMI_TENSOR_NDHWC} |
|
|
|
}; |
|
|
|
const char *const kIsOutputAdjustHwLayoutKey = "is_output_adjust_hw_layout"; |
|
|
|
|
|
|
|
// datatype/formats from user to GE, Unified to util interface file later |
|
|
|
const std::map<std::string, ge::DataType> kOutputTypeSupportDatatype = { |
|
|
|
{"FP32", ge::DT_FLOAT}, {"FP16", ge::DT_FLOAT16}, {"UINT8", ge::DT_UINT8}}; |
|
|
|
@@ -871,7 +872,7 @@ domi::Status AclGrphParseUtil::SetOutputNodeInfo(ge::Graph &graph, |
|
|
|
GE_CHECK_NOTNULL(compute_graph); |
|
|
|
|
|
|
|
string output_type; |
|
|
|
GetAclParams(parser_params, "output_type", output_type); |
|
|
|
GetAclParams(parser_params, ge::ir_option::OUTPUT_TYPE, output_type); |
|
|
|
|
|
|
|
std::vector<std::pair<std::string, int32_t>> user_out_nodes = ge::GetParserContext().user_out_nodes; |
|
|
|
std::vector<domiTensorFormat_t> output_formats = ge::GetParserContext().output_formats; |
|
|
|
@@ -957,55 +958,68 @@ domi::Status AclGrphParseUtil::ParseAclLogLevel(const std::string &log) { |
|
|
|
return domi::SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
domi::Status AclGrphParseUtil::CheckOptions(const std::map<std::string, std::string> &parser_params) { |
|
|
|
for (auto &ele : parser_params) { |
|
|
|
auto it = ge::ir_option::ir_parser_suppported_options.find(ele.first); |
|
|
|
if (it == ge::ir_option::ir_parser_suppported_options.end()) { |
|
|
|
GELOGE(PARAM_INVALID, "input options include unsupported option(%s).Please check!", |
|
|
|
ele.first.c_str()); |
|
|
|
return PARAM_INVALID; |
|
|
|
} |
|
|
|
} |
|
|
|
return SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
domi::Status AclGrphParseUtil::ParseParamsBeforeGraph(const std::map<std::string, std::string> &parser_params, |
|
|
|
string &graph_name) { |
|
|
|
GELOGI("Parse graph user options start."); |
|
|
|
// support paragrams: log, input_format, is_dynamic_input, input_shape, out_nodes |
|
|
|
// is_output_adjust_hw_layout, output, op_name_map, enable_scope_fusion_passes |
|
|
|
string log_level; |
|
|
|
GetAclParams(parser_params, "log", log_level); |
|
|
|
GetAclParams(parser_params, ge::ir_option::LOG_LEVEL, log_level); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ParseAclLogLevel(log_level) != SUCCESS, |
|
|
|
return PARAM_INVALID, "Parse log_level failed"); |
|
|
|
|
|
|
|
|
|
|
|
string input_format; |
|
|
|
GetAclParams(parser_params, "input_format", input_format); |
|
|
|
GetAclParams(parser_params, ge::ir_option::INPUT_FORMAT, input_format); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ParseAclFormat(input_format) != SUCCESS, |
|
|
|
return PARAM_INVALID, "Parse input_format failed"); |
|
|
|
|
|
|
|
string dynamic_input_str; |
|
|
|
GetAclParams(parser_params, "is_dynamic_input", dynamic_input_str); |
|
|
|
GetAclParams(parser_params, ge::ir_option::IS_DYNAMIC_INPUT, dynamic_input_str); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!CheckInputTrueOrFalse(dynamic_input_str, "is_dynamic_input"), |
|
|
|
return PARAM_INVALID, "Parse is_dynamic_input failed"); |
|
|
|
bool is_dynamic_input = dynamic_input_str == "true" ? true : false; |
|
|
|
|
|
|
|
string input_shape; |
|
|
|
GetAclParams(parser_params, "input_shape", input_shape); |
|
|
|
GetAclParams(parser_params, ge::ir_option::INPUT_SHAPE, input_shape); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ParseAclShape(input_shape, is_dynamic_input) != SUCCESS, |
|
|
|
return PARAM_INVALID, "Parse input_shape failed"); |
|
|
|
|
|
|
|
string out_nodes; |
|
|
|
GetAclParams(parser_params, "out_nodes", out_nodes); |
|
|
|
GetAclParams(parser_params, ge::ir_option::OUT_NODES, out_nodes); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ParseAclOutputNodes(out_nodes) != SUCCESS, |
|
|
|
return PARAM_INVALID, "Parse out_nodes failed"); |
|
|
|
|
|
|
|
|
|
|
|
string is_output_adjust_hw_layout; |
|
|
|
GetAclParams(parser_params, "is_output_adjust_hw_layout", is_output_adjust_hw_layout); |
|
|
|
GetAclParams(parser_params, ge::ir_option::IS_OUTPUT_ADJUST_HW_LAYOUT, is_output_adjust_hw_layout); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ParseAclOutputFp16NodesFormat(is_output_adjust_hw_layout) != SUCCESS, |
|
|
|
return PARAM_INVALID, "Parse is_output_adjust_hw_layout failed"); |
|
|
|
|
|
|
|
string op_conf_str; |
|
|
|
GetAclParams(parser_params, "op_name_map", op_conf_str); |
|
|
|
GetAclParams(parser_params, ge::ir_option::OP_NAME_MAP, op_conf_str); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ParseAclOpConf(op_conf_str) != SUCCESS, |
|
|
|
return PARAM_INVALID, "Parse op_name_map failed"); |
|
|
|
|
|
|
|
string tmp_name; |
|
|
|
GetAclParams(parser_params, "output", tmp_name); |
|
|
|
GetAclParams(parser_params, ge::ir_option::OUTPUT, tmp_name); |
|
|
|
graph_name = tmp_name.empty() ? (kGraphDefaultName + "_" + ge::parser::CurrentTimeInStr()) : tmp_name; |
|
|
|
|
|
|
|
string enable_scope_fusion_passes; |
|
|
|
GetAclParams(parser_params, "enable_scope_fusion_passes", enable_scope_fusion_passes); |
|
|
|
GetAclParams(parser_params, ge::ir_option::ENABLE_SCOPE_FUSION_PASSES, enable_scope_fusion_passes); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ParseAclEnableScope(enable_scope_fusion_passes) != SUCCESS, |
|
|
|
return PARAM_INVALID, "Parse enable_scope_fusion_passes failed"); |
|
|
|
|
|
|
|
@@ -1018,15 +1032,15 @@ domi::Status AclGrphParseUtil::ParseParamsAfterGraph(ge::Graph &graph, |
|
|
|
ComputeGraphPtr compute_graph = GraphUtils::GetComputeGraph(graph); |
|
|
|
|
|
|
|
string input_fp16_nodes; |
|
|
|
GetAclParams(parser_params, "input_fp16_nodes", input_fp16_nodes); |
|
|
|
GetAclParams(parser_params, ge::ir_option::INPUT_FP16_NODES, input_fp16_nodes); |
|
|
|
|
|
|
|
string is_input_adjust_hw_layout; |
|
|
|
GetAclParams(parser_params, "is_input_adjust_hw_layout", is_input_adjust_hw_layout); |
|
|
|
GetAclParams(parser_params, ge::ir_option::IS_INPUT_ADJUST_HW_LAYOUT, is_input_adjust_hw_layout); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ParseAclInputFp16Nodes(compute_graph, input_fp16_nodes, is_input_adjust_hw_layout) != SUCCESS, |
|
|
|
return PARAM_INVALID, "Parse input_fp16_nodes failed"); |
|
|
|
//GE_RETURN_IF_ERROR(CheckInputShapeNode(compute_graph, is_dynamic_input)); |
|
|
|
string compress_weight_conf; |
|
|
|
GetAclParams(parser_params, "compress_weight_conf", compress_weight_conf); |
|
|
|
GetAclParams(parser_params, ge::ir_option::COMPRESS_WEIGHT_CONF, compress_weight_conf); |
|
|
|
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ParseAclWeightCompressConf(compute_graph, compress_weight_conf) != SUCCESS, |
|
|
|
return PARAM_INVALID, "Parse compress_weight_conf failed"); |
|
|
|
return SUCCESS; |
|
|
|
|