From: @zhou_lili Reviewed-by: @ji_chen,@xchu42 Signed-off-by: @ji_chentags/v1.3.0
| @@ -844,9 +844,12 @@ Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor | |||||
| * @param [in] vector<GeTensor> &inputs: Operator input data description information. | * @param [in] vector<GeTensor> &inputs: Operator input data description information. | ||||
| * @param [in] vector<GeTensor> &outputs: Operator output data description information. | * @param [in] vector<GeTensor> &outputs: Operator output data description information. | ||||
| * @param [in] engine_type: specific engine. | * @param [in] engine_type: specific engine. | ||||
| * @param [in] compile_flag: op build flag, compile flag by acl | |||||
| * @param [out] ModelBufferData &Model_buff: Model_buff: model buffer of the op. | * @param [out] ModelBufferData &Model_buff: Model_buff: model buffer of the op. | ||||
| * @return SUCCESS handle successfully / others handle failed | * @return SUCCESS handle successfully / others handle failed | ||||
| */ | */ | ||||
| // old process will be deleted | |||||
| Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor> &inputs, | Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor> &inputs, | ||||
| const vector<GeTensor> &outputs, OpEngineType engine_type, | const vector<GeTensor> &outputs, OpEngineType engine_type, | ||||
| ModelBufferData &model_buff) { | ModelBufferData &model_buff) { | ||||
| @@ -857,6 +860,12 @@ Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor | |||||
| return status; | return status; | ||||
| } | } | ||||
| Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor> &inputs, | |||||
| const vector<GeTensor> &outputs, OpEngineType engine_type, int32_t compile_flag, | |||||
| ModelBufferData &model_buff) { | |||||
| return SUCCESS; | |||||
| } | |||||
| Status GeGenerator::BuildSingleOpGraph(OpDescPtr &op_desc, const vector<GeTensor> &inputs, | Status GeGenerator::BuildSingleOpGraph(OpDescPtr &op_desc, const vector<GeTensor> &inputs, | ||||
| const vector<GeTensor> &outputs, std::string graph_name, Graph &graph) { | const vector<GeTensor> &outputs, std::string graph_name, Graph &graph) { | ||||
| ge::ComputeGraphPtr compute_graph = MakeShared<ComputeGraph>(graph_name); | ge::ComputeGraphPtr compute_graph = MakeShared<ComputeGraph>(graph_name); | ||||
| @@ -110,6 +110,7 @@ const char *const SAVE_ORIGINAL_MODEL = "ge.saveOriginalModel"; | |||||
| const char *const ORIGINAL_MODEL_FILE = "ge.originalModelFile"; | const char *const ORIGINAL_MODEL_FILE = "ge.originalModelFile"; | ||||
| const char *const INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16"; | const char *const INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16"; | ||||
| const char *const OP_DEBUG_LEVEL = "ge.opDebugLevel"; | const char *const OP_DEBUG_LEVEL = "ge.opDebugLevel"; | ||||
| const char *const PERFORMANCE_MODE = "ge.performance_mode"; | |||||
| } // namespace configure_option | } // namespace configure_option | ||||
| // Configure stream num by Session constructor options param, | // Configure stream num by Session constructor options param, | ||||
| // its value should be int32_t type, default value is "1" | // its value should be int32_t type, default value is "1" | ||||
| @@ -314,6 +315,11 @@ const std::string HCOM_MULTI_MODE = "ge.hcomMultiMode"; | |||||
| // atc and ir option | // atc and ir option | ||||
| const char *const INPUT_SHAPE_RANGE = "input_shape_range"; | const char *const INPUT_SHAPE_RANGE = "input_shape_range"; | ||||
| // Configure express high compile performance or high execute performance | |||||
| // normal: no need to compile, used saved .o files directly | |||||
| // high: need to recompile, high execute performance mode | |||||
| const std::string PERFORMANCE_MODE = "ge.performance_mode"; | |||||
| // Graph run mode | // Graph run mode | ||||
| enum GraphRunMode { PREDICTION = 0, TRAIN }; | enum GraphRunMode { PREDICTION = 0, TRAIN }; | ||||
| @@ -388,6 +394,7 @@ static const char *const MDL_BANK_PATH = ge::MDL_BANK_PATH_FLAG.c_str(); | |||||
| static const char *const OP_BANK_PATH = ge::OP_BANK_PATH_FLAG.c_str(); | static const char *const OP_BANK_PATH = ge::OP_BANK_PATH_FLAG.c_str(); | ||||
| static const char *const OP_BANK_UPDATE = ge::OP_BANK_UPDATE_FLAG.c_str(); | static const char *const OP_BANK_UPDATE = ge::OP_BANK_UPDATE_FLAG.c_str(); | ||||
| static const char *const OP_DEBUG_LEVEL = ge::OP_DEBUG_LEVEL.c_str(); | static const char *const OP_DEBUG_LEVEL = ge::OP_DEBUG_LEVEL.c_str(); | ||||
| static const char *const PERFORMANCE_MODE = ge::PERFORMANCE_MODE.c_str(); | |||||
| // for interface: aclgrphBuildModel | // for interface: aclgrphBuildModel | ||||
| #ifdef __GNUC__ | #ifdef __GNUC__ | ||||
| @@ -412,7 +419,8 @@ const std::set<std::string> ir_builder_suppported_options = {INPUT_FORMAT, | |||||
| OP_COMPILER_CACHE_MODE, | OP_COMPILER_CACHE_MODE, | ||||
| MDL_BANK_PATH, | MDL_BANK_PATH, | ||||
| OP_BANK_PATH, | OP_BANK_PATH, | ||||
| OP_BANK_UPDATE}; | |||||
| OP_BANK_UPDATE, | |||||
| PERFORMANCE_MODE}; | |||||
| // for interface: aclgrphParse | // for interface: aclgrphParse | ||||
| const std::set<std::string> ir_parser_suppported_options = { | const std::set<std::string> ir_parser_suppported_options = { | ||||
| @@ -67,8 +67,9 @@ struct DataBuffer { | |||||
| void *data; // Data address | void *data; // Data address | ||||
| uint64_t length; // Data length | uint64_t length; // Data length | ||||
| bool isDataSupportMemShare = false; | bool isDataSupportMemShare = false; | ||||
| DataBuffer(void *dataIn, uint64_t len, bool isSupportMemShare) | |||||
| : data(dataIn), length(len), isDataSupportMemShare(isSupportMemShare) {} | |||||
| uint32_t placement = 0; | |||||
| DataBuffer(void *dataIn, uint64_t len, bool isSupportMemShare, uint32_t placement = 0) | |||||
| : data(dataIn), length(len), isDataSupportMemShare(isSupportMemShare), placement(placement) {} | |||||
| DataBuffer() : data(nullptr), length(0), isDataSupportMemShare(false) {} | DataBuffer() : data(nullptr), length(0), isDataSupportMemShare(false) {} | ||||
| }; | }; | ||||
| @@ -76,10 +76,13 @@ class GE_FUNC_VISIBILITY GeGenerator { | |||||
| /// @param [in] inputs: input tensors. | /// @param [in] inputs: input tensors. | ||||
| /// @param [in] outputs: output tensors. | /// @param [in] outputs: output tensors. | ||||
| /// @param [in] engine_type: engine type. | /// @param [in] engine_type: engine type. | ||||
| /// @param [in] compile_flag: op build flag, accurate build is 0, fuzz build is 1 | |||||
| /// @param [out] model_buff: model buff of op. | /// @param [out] model_buff: model buff of op. | ||||
| /// @return SUCCESS or FAILED | /// @return SUCCESS or FAILED | ||||
| Status BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor> &inputs, const vector<GeTensor> &outputs, | Status BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor> &inputs, const vector<GeTensor> &outputs, | ||||
| OpEngineType engine_type, ModelBufferData &model_buff); | OpEngineType engine_type, ModelBufferData &model_buff); | ||||
| Status BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor> &inputs, const vector<GeTensor> &outputs, | |||||
| OpEngineType engine_type, int32_t compile_flag, ModelBufferData &model_buff); | |||||
| /// | /// | ||||
| /// @ingroup ge | /// @ingroup ge | ||||
| /// @brief: Build single Op into model buff. | /// @brief: Build single Op into model buff. | ||||
| @@ -88,6 +88,24 @@ TEST_F(UtestGeGenerator, test_build_single_op_online) { | |||||
| EXPECT_EQ(generator.BuildSingleOpModel(op_desc, inputs, outputs, ENGINE_AIVECTOR, model_buffer), FAILED); | EXPECT_EQ(generator.BuildSingleOpModel(op_desc, inputs, outputs, ENGINE_AIVECTOR, model_buffer), FAILED); | ||||
| } | } | ||||
| TEST_F(UtestGeGenerator, test_singleop_fuzz_build) { | |||||
| GeTensorDesc tensor_desc; | |||||
| shared_ptr<OpDesc> op_desc = make_shared<OpDesc>("Add", "add"); | |||||
| op_desc->AddInputDesc(tensor_desc); | |||||
| op_desc->AddInputDesc(tensor_desc); | |||||
| op_desc->AddOutputDesc(tensor_desc); | |||||
| GeTensor tensor(tensor_desc); | |||||
| const vector<GeTensor> inputs = { tensor, tensor }; | |||||
| const vector<GeTensor> outputs = { tensor }; | |||||
| GeGenerator generator; | |||||
| generator.Initialize({}); | |||||
| ModelBufferData model_buffer; | |||||
| bool compile_flag = true; | |||||
| EXPECT_EQ(generator.BuildSingleOpModel(op_desc, inputs, outputs, ENGINE_AIVECTOR, compile_flag, model_buffer), SUCCESS); | |||||
| } | |||||
| TEST_F(UtestGeGenerator, test_check_aicore) { | TEST_F(UtestGeGenerator, test_check_aicore) { | ||||
| GeGenerator generator; | GeGenerator generator; | ||||
| generator.Initialize({}); | generator.Initialize({}); | ||||