Skip to content

Commit

Permalink
Add a function of set graph extension via environment variables in de…
Browse files Browse the repository at this point in the history
…velop build mode
  • Loading branch information
ShaojieZhuIntel committed Oct 17, 2024
1 parent 3163c79 commit db7943b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/plugins/intel_npu/src/backend/include/zero_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <ze_api.h>
#include <ze_graph_ext.h>

#include <type_traits>

#include "intel_npu/al/config/runtime.hpp"
#include "intel_npu/utils/logger/logger.hpp"
#include "intel_npu/utils/zero/zero_result.hpp"
Expand Down
29 changes: 29 additions & 0 deletions src/plugins/intel_npu/src/backend/src/zero_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,35 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder",
zeDriverGetExtensionFunctionAddress(driver_handle,
graph_ext_name.c_str(),
reinterpret_cast<void**>(&graph_ddi_table_ext)));
#ifdef NPU_PLUGIN_DEVELOPER_BUILD
auto graphExtManualConfig = std::getenv("GRAPH_EXT_VERSION_MANUAL");
if (graphExtManualConfig != nullptr) {
if (strcmp(graphExtManualConfig, "ZE_extension_graph_1_8") == 0) {
log.info("With GRAPH_EXT_VERSION_MANUAL. Using ZE_GRAPH_EXT_VERSION_1_8");
graph_ext_version = ZE_GRAPH_EXT_VERSION_1_8;
} else if (strcmp(graphExtManualConfig, "ZE_extension_graph_1_7") == 0) {
log.info("With GRAPH_EXT_VERSION_MANUAL. Using ZE_GRAPH_EXT_VERSION_1_7");
graph_ext_version = ZE_GRAPH_EXT_VERSION_1_7;
} else if (strcmp(graphExtManualConfig, "ZE_extension_graph_1_6") == 0) {
log.info("With GRAPH_EXT_VERSION_MANUAL. Using ZE_GRAPH_EXT_VERSION_1_6");
graph_ext_version = ZE_GRAPH_EXT_VERSION_1_6;
} else if (strcmp(graphExtManualConfig, "ZE_extension_graph_1_5") == 0) {
log.info("With GRAPH_EXT_VERSION_MANUAL. Using ZE_GRAPH_EXT_VERSION_1_5");
graph_ext_version = ZE_GRAPH_EXT_VERSION_1_5;
} else if (strcmp(graphExtManualConfig, "ZE_extension_graph_1_4") == 0) {
log.info("With GRAPH_EXT_VERSION_MANUAL. Using ZE_GRAPH_EXT_VERSION_1_4");
graph_ext_version = ZE_GRAPH_EXT_VERSION_1_4;
} else if (strcmp(graphExtManualConfig, "ZE_extension_graph_1_3") == 0) {
log.info("With GRAPH_EXT_VERSION_MANUAL. Using ZE_GRAPH_EXT_VERSION_1_3");
graph_ext_version = ZE_GRAPH_EXT_VERSION_1_3;
} else if (strcmp(graphExtManualConfig, "ZE_extension_graph_1_2") == 0) {
log.info("With GRAPH_EXT_VERSION_MANUAL. Using ZE_GRAPH_EXT_VERSION_1_2");
graph_ext_version = ZE_GRAPH_EXT_VERSION_1_2;
} else {
log.info("With GRAPH_EXT_VERSION_AUTO.");
}
}
#endif
graph_dditable_ext_decorator =
std::make_unique<ze_graph_dditable_ext_decorator>(graph_ddi_table_ext, graph_ext_version);

Expand Down

0 comments on commit db7943b

Please sign in to comment.