Skip to content

Commit

Permalink
Enable the registry of level_zero_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
omarahmed1111 committed Jan 29, 2025
1 parent 4643d1c commit 58ccaa9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions scripts/core/INTRO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ Specific environment variables can be set to control the behavior of unified run

This environment variable is default enabled on Linux, but default disabled on Windows.

.. envvar:: UR_ADAPTER_LEVEL_ZERO_V2

If set, UR will use level_zero_v2 instead of the default level_zero.

CTS Environment Variables
-------------------------

Expand Down
11 changes: 10 additions & 1 deletion source/loader/ur_adapter_registry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class AdapterRegistry {
// to load the adapter.
std::vector<std::vector<fs::path>> adaptersLoadPaths;

static constexpr std::array<const char *, 5> knownAdapterNames{
std::vector<const char *> knownAdapterNames{
MAKE_LIBRARY_NAME("ur_adapter_level_zero", "0"),
MAKE_LIBRARY_NAME("ur_adapter_opencl", "0"),
MAKE_LIBRARY_NAME("ur_adapter_cuda", "0"),
Expand Down Expand Up @@ -263,6 +263,15 @@ class AdapterRegistry {
#else
bool loaderPreFilter = getenv_tobool("UR_LOADER_PRELOAD_FILTER", true);
#endif

if (getenv_tobool("UR_ADAPTER_LEVEL_ZERO_V2")) {
knownAdapterNames.push_back(
MAKE_LIBRARY_NAME("ur_adapter_level_zero_v2", "0"));
} else {
knownAdapterNames.push_back(
MAKE_LIBRARY_NAME("ur_adapter_level_zero", "0"));
}

for (const auto &adapterName : knownAdapterNames) {

if (loaderPreFilter) {
Expand Down

0 comments on commit 58ccaa9

Please sign in to comment.