@@ -17,29 +17,10 @@ namespace sycl {
17
17
namespace level0 {
18
18
using namespace detail ;
19
19
20
- // Get the L0 plugin.
21
- static const plugin &getPlugin () {
22
- static const plugin *L0Plugin = nullptr ;
23
- if (L0Plugin)
24
- return *L0Plugin;
25
-
26
- const vector_class<plugin> &Plugins = pi::initialize ();
27
- for (const auto &Plugin : Plugins)
28
- if (Plugin.getBackend () == backend::level0) {
29
- L0Plugin = &Plugin;
30
- break ;
31
- }
32
- if (!L0Plugin) {
33
- throw runtime_error (" sycl::level0 - no Level-Zero plugin" ,
34
- PI_INVALID_OPERATION);
35
- }
36
- return *L0Plugin;
37
- }
38
-
39
20
// ----------------------------------------------------------------------------
40
21
// Implementation of level0::make<platform>
41
22
__SYCL_EXPORT platform make_platform (pi_native_handle NativeHandle) {
42
- const auto &Plugin = getPlugin ();
23
+ const auto &Plugin = pi:: getPlugin<backend::level0> ();
43
24
// Create PI platform first.
44
25
pi::PiPlatform PiPlatform;
45
26
Plugin.call <PiApiKind::piextPlatformCreateWithNativeHandle>(NativeHandle,
@@ -54,7 +35,7 @@ __SYCL_EXPORT platform make_platform(pi_native_handle NativeHandle) {
54
35
// Implementation of level0::make<device>
55
36
__SYCL_EXPORT device make_device (const platform &Platform,
56
37
pi_native_handle NativeHandle) {
57
- const auto &Plugin = getPlugin ();
38
+ const auto &Plugin = pi:: getPlugin<backend::level0> ();
58
39
const auto &PlatformImpl = getSyclObjImpl (Platform);
59
40
// Create PI device first.
60
41
pi::PiDevice PiDevice;
@@ -80,7 +61,7 @@ __SYCL_EXPORT program make_program(const context &Context,
80
61
// Implementation of level0::make<queue>
81
62
__SYCL_EXPORT queue make_queue (const context &Context,
82
63
pi_native_handle NativeHandle) {
83
- const auto &Plugin = getPlugin ();
64
+ const auto &Plugin = pi:: getPlugin<backend::level0> ();
84
65
const auto &ContextImpl = getSyclObjImpl (Context);
85
66
// Create PI queue first.
86
67
pi::PiQueue PiQueue;
0 commit comments