Skip to content

Commit

Permalink
add dry on execution
Browse files Browse the repository at this point in the history
  • Loading branch information
DanLiu2Intel committed Dec 4, 2024
1 parent d6423e3 commit 90c32b4
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
27 changes: 27 additions & 0 deletions src/plugins/intel_npu/src/al/include/intel_npu/config/runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,31 @@ struct RUN_INFERENCES_SEQUENTIALLY final : OptionBase<RUN_INFERENCES_SEQUENTIALL
}
};

//
// ENABLE_DRY_ON_EXECUTION
//
struct ENABLE_DRY_ON_EXECUTION final : OptionBase<ENABLE_DRY_ON_EXECUTION, bool> {
static std::string_view key() {
return ov::intel_npu::enable_dry_on_execution.name();
}

#ifdef NPU_PLUGIN_DEVELOPER_BUILD
static std::string_view envVar() {
return "IE_NPU_ENABLE_DRY_ON_EXECUTION";
}
#endif

static bool defaultValue() {
return false;
}

static constexpr std::string_view getTypeName() {
return "bool";
}

static OptionMode mode() {
return OptionMode::RunTime;
}
};

} // namespace intel_npu
Original file line number Diff line number Diff line change
Expand Up @@ -329,5 +329,15 @@ static constexpr ov::Property<std::string> backend_compilation_params{"NPU_BACKE
*/
static constexpr ov::Property<bool> run_inferences_sequentially{"NPU_RUN_INFERENCES_SEQUENTIALLY"};

/**
* @brief [Only for NPU compiler]
* Type: std::Boolean, default is "NO".
* Config for backend for plugin initlization.
* If set to 'YES', plugin will be initilizated normally with backend.
* If not, plugin will be initilizated without backend and pass empty device to compilation.
* If set to 'NO', only compilation with MLIR pipeline can be finished and can not do inference.
* Available values: "YES", "NO".
*/
static constexpr ov::Property<bool> enable_dry_on_execution{"ENABLE_DRY_ON_EXECUTION"};
} // namespace intel_npu
} // namespace ov
1 change: 1 addition & 0 deletions src/plugins/intel_npu/src/al/src/config/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void intel_npu::registerRunTimeOptions(OptionsDesc& desc) {
desc.add<TURBO>();
desc.add<BYPASS_UMD_CACHING>();
desc.add<RUN_INFERENCES_SEQUENTIALLY>();
desc.add<ENABLE_DRY_ON_EXECUTION>();
}

// Heuristically obtained number. Varies depending on the values of PLATFORM and PERFORMANCE_HINT
Expand Down
23 changes: 21 additions & 2 deletions src/plugins/intel_npu/src/plugin/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,15 @@ Plugin::Plugin()
std::vector<AvailableBackends> backendRegistry;

#if defined(OPENVINO_STATIC_LIBRARY)
backendRegistry.push_back(AvailableBackends::LEVEL_ZERO);
const auto* envVar = std::getenv("IE_NPU_ENABLE_DRY_ON_EXECUTION")
if (envVar) {
std::printf("getenv(IE_NPU_ENABLE_DRY_ON_EXECUTION) is %s\n", envVar);
OV_ITT_TASK_CHAIN(PLUGIN, itt::domains::NPUPlugin, "Plugin::Plugin", "create empty Zero NPUBackends");
_logger.info("initialize Plugin without backend. Only compilation can be performed!");
} else {
backendRegistry.push_back(AvailableBackends::LEVEL_ZERO);
}

#else
# if defined(ENABLE_IMD_BACKEND)
if (const auto* envVar = std::getenv("IE_NPU_USE_IMD_BACKEND")) {
Expand All @@ -220,7 +228,13 @@ Plugin::Plugin()
# endif

# if defined(_WIN32) || defined(_WIN64) || (defined(__linux__) && defined(__x86_64__))
backendRegistry.push_back(AvailableBackends::LEVEL_ZERO);
const auto* envVar2 = std::getenv("IE_NPU_ENABLE_DRY_ON_EXECUTION")
if (envVar2) {
std::printf("2getenv(IE_NPU_ENABLE_DRY_ON_EXECUTION) is %s\n", envVar);
_logger.info("initialize Plugin without backend2. Only compilation can be performed!");
} else {
backendRegistry.push_back(AvailableBackends::LEVEL_ZERO);
}
# endif
#endif

Expand Down Expand Up @@ -578,6 +592,11 @@ Plugin::Plugin()
return config.getString<BATCH_MODE>();
}}}};

//need to update config?
// if (const auto* envVar = std::getenv("IE_NPU_ENABLE_DRY_ON_EXECUTION")) {
// }


for (auto& property : _properties) {
if (std::get<0>(property.second)) {
_supportedProperties.emplace_back(ov::PropertyName(property.first, std::get<1>(property.second)));
Expand Down

0 comments on commit 90c32b4

Please sign in to comment.