| @@ -418,6 +418,14 @@ Status ModelBuilder::BuildModelDef(ge::Model &model) { | |||||
| return FAILED); | return FAILED); | ||||
| GELOGI("For model, max_mem_offset_: %zu, p2p_mem_size: %zu, zero_copy_mem_size_: %zu", max_mem_offset_, | GELOGI("For model, max_mem_offset_: %zu, p2p_mem_size: %zu, zero_copy_mem_size_: %zu", max_mem_offset_, | ||||
| p2p_mem_offset_, zero_copy_mem_size_); | p2p_mem_offset_, zero_copy_mem_size_); | ||||
| string fp_ceiling_mode; | |||||
| if (ge::GetContext().GetOption("ge.fpCeilingMode", fp_ceiling_mode) == SUCCESS) { | |||||
| if (!ge::AttrUtils::SetStr(&model, ATTR_FP_CEILING_MODE, fp_ceiling_mode)) { | |||||
| GELOGE(FAILED, "Failed to set attr ATTR_FP_CEILING_MODE"); | |||||
| return FAILED; | |||||
| } | |||||
| GELOGI("Set attr ATTR_FP_CEILING_MODE to model, value is %s.", fp_ceiling_mode.c_str()); | |||||
| } | |||||
| string ge_core_type; | string ge_core_type; | ||||
| Status ret = ge::GetContext().GetOption(kCoreType, ge_core_type); | Status ret = ge::GetContext().GetOption(kCoreType, ge_core_type); | ||||
| @@ -689,6 +689,17 @@ Status DavinciModel::Init(void *dev_ptr, size_t mem_size, void *weight_ptr, size | |||||
| need_destroy_aicpu_kernel_ = IsAicpuKernelConnectSpecifiedLayer(); | need_destroy_aicpu_kernel_ = IsAicpuKernelConnectSpecifiedLayer(); | ||||
| (void)ge::AttrUtils::GetListStr(ge_model_, ATTR_MODEL_OUT_NODES_NAME, out_node_name_); | (void)ge::AttrUtils::GetListStr(ge_model_, ATTR_MODEL_OUT_NODES_NAME, out_node_name_); | ||||
| string fp_ceiling_mode; | |||||
| if (ge::AttrUtils::GetStr(ge_model_, ATTR_FP_CEILING_MODE, fp_ceiling_mode)) { | |||||
| GELOGI("Get attr ATTR_FP_CEILING_MODE from model, value is %s.", fp_ceiling_mode.c_str()); | |||||
| // mode 0: Do not perform saturation processing. By default, IEEE754 is used. | |||||
| rtError_t ret = rtSetCtxINFMode((fp_ceiling_mode != "0")); | |||||
| if (ret != RT_ERROR_NONE) { | |||||
| GELOGE(FAILED, "Failed to set fp_ceiling_mode to runtime."); | |||||
| return FAILED; | |||||
| } | |||||
| } | |||||
| // collect profiling for ge | // collect profiling for ge | ||||
| if (ProfilingManager::Instance().ProfilingModelLoadOn()) { | if (ProfilingManager::Instance().ProfilingModelLoadOn()) { | ||||
| std::vector<ComputeGraphDescInfo> compute_graph_desc_info; | std::vector<ComputeGraphDescInfo> compute_graph_desc_info; | ||||
| @@ -130,6 +130,22 @@ bool IsTailingOptimization() { | |||||
| GELOGW("OPTION_EXEC_ENABLE_TAILING_OPTIMIZATION not set, use BFSTopologicalSorting by default."); | GELOGW("OPTION_EXEC_ENABLE_TAILING_OPTIMIZATION not set, use BFSTopologicalSorting by default."); | ||||
| return false; | return false; | ||||
| } | } | ||||
| ge::Status CheckFpCeilingMode() { | |||||
| static const std::unordered_set<std::string> kValidFpCeilingMode = {"0", "1", "2"}; | |||||
| string mode; | |||||
| auto ret = ge::GetContext().GetOption("ge.fpCeilingMode", mode); | |||||
| if (ret == ge::GRAPH_SUCCESS) { | |||||
| if (kValidFpCeilingMode.count(mode) == 0) { | |||||
| GELOGE(ge::GE_GRAPH_OPTIONS_INVALID, "The fp_ceiling_mode %s is invalid, options are 0, 1, and 2.", mode.c_str()); | |||||
| return ge::GE_GRAPH_OPTIONS_INVALID; | |||||
| } | |||||
| GELOGI("The parameter fp_ceiling_mode is set to %s.", mode.c_str()); | |||||
| return ge::SUCCESS; | |||||
| } | |||||
| GELOGW("The parameter fp_ceiling_mode is noe set."); | |||||
| return ge::SUCCESS; | |||||
| } | |||||
| } // namespace | } // namespace | ||||
| namespace ge { | namespace ge { | ||||
| @@ -165,6 +181,12 @@ Status GraphManager::Initialize(const std::map<string, string> &options) { | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| ret = CheckFpCeilingMode(); | |||||
| if (ret != SUCCESS) { | |||||
| GELOGE(ret, "[Initialize] Check fp-ceiling-mode options failed."); | |||||
| return ret; | |||||
| } | |||||
| ret = graph_context_->Initialize(options); | ret = graph_context_->Initialize(options); | ||||
| if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
| GELOGE(ret, "[Initialize] GraphContext initialize failed."); | GELOGE(ret, "[Initialize] GraphContext initialize failed."); | ||||
| @@ -56,6 +56,7 @@ const int kDefaultDeviceIdForInfer = -1; | |||||
| const uint32_t kAicoreOverflow = (0x1 << 0); | const uint32_t kAicoreOverflow = (0x1 << 0); | ||||
| const uint32_t kAtomicOverflow = (0x1 << 1); | const uint32_t kAtomicOverflow = (0x1 << 1); | ||||
| const uint32_t kAllOverflow = (kAicoreOverflow | kAtomicOverflow); | const uint32_t kAllOverflow = (kAicoreOverflow | kAtomicOverflow); | ||||
| const char *const kGlobalOptionFpCeilingModeDefault = "2"; | |||||
| } // namespace | } // namespace | ||||
| static std::shared_ptr<GELib> instancePtr_ = nullptr; | static std::shared_ptr<GELib> instancePtr_ = nullptr; | ||||
| @@ -79,6 +80,11 @@ Status GELib::Initialize(const map<string, string> &options) { | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| instancePtr_->SetDefaultPrecisionMode(new_options); | instancePtr_->SetDefaultPrecisionMode(new_options); | ||||
| if (new_options.find("ge.fpCeilingMode") == new_options.end()) { | |||||
| new_options["ge.fpCeilingMode"] = kGlobalOptionFpCeilingModeDefault; | |||||
| } | |||||
| GetMutableGlobalOptions().insert(new_options.begin(), new_options.end()); | GetMutableGlobalOptions().insert(new_options.begin(), new_options.end()); | ||||
| GetThreadLocalContext().SetGlobalOption(GetMutableGlobalOptions()); | GetThreadLocalContext().SetGlobalOption(GetMutableGlobalOptions()); | ||||
| GE_TIMESTAMP_START(Init); | GE_TIMESTAMP_START(Init); | ||||
| @@ -1 +1 @@ | |||||
| Subproject commit cc9de48a7779cf95cab90a23db608421a691fd12 | |||||
| Subproject commit 63dfb1fd98c1356c3c738d96cd4d9f760dec1b63 | |||||
| @@ -1 +1 @@ | |||||
| Subproject commit f86c751307835d85329260feb51b559d378b5710 | |||||
| Subproject commit db4e6070bb2cec01cead264a44ceae07e7f3048e | |||||
| @@ -0,0 +1,16 @@ | |||||
| #!bin/bash | |||||
| target_path=$(pwd) | |||||
| echo "target path: ${target_path}/prebuild" | |||||
| if [ ! -d "${target_path}/prebuild" ]; then | |||||
| echo "cloning prebuild repository to ${target_path}" | |||||
| cd ${target_path} | |||||
| git clone https://gitee.com/mindspore/prebuild.git | |||||
| else | |||||
| echo "found prebuild in ${target_path}, attempting to update ..." | |||||
| cd ${target_path}/prebuild | |||||
| git pull | |||||
| fi | |||||
| cd - | |||||
| export D_LINK_PATH=${target_path}/prebuild/lib64 | |||||