forked from oneapi-src/unified-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathur_loader.cpp
More file actions
37 lines (31 loc) · 1.01 KB
/
ur_loader.cpp
File metadata and controls
37 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
*
* Copyright (C) 2022-2023 Intel Corporation
*
* Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
* See LICENSE.TXT
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*/
#include "ur_loader.hpp"
namespace ur_loader {
///////////////////////////////////////////////////////////////////////////////
context_t *context;
///////////////////////////////////////////////////////////////////////////////
ur_result_t context_t::init() {
for (const auto &adapterPaths : adapter_registry) {
for (const auto &path : adapterPaths) {
auto handle = LibLoader::loadAdapterLibrary(path.string().c_str());
if (handle) {
platforms.emplace_back(std::move(handle));
break;
}
}
}
forceIntercept = getenv_tobool("UR_ENABLE_LOADER_INTERCEPT");
if (forceIntercept || platforms.size() > 1) {
intercept_enabled = true;
}
return UR_RESULT_SUCCESS;
}
} // namespace ur_loader