Skip to content

Commit 11ef88c

Browse files
authored
[SYCL] Make the Level Zero default backend (#1883)
Signed-off-by: Artur Gainullin <[email protected]>
1 parent ca67e69 commit 11ef88c

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

sycl/source/detail/pi.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@ static void initializePlugins(vector_class<plugin> *Plugins) {
319319
PluginNames[I].first.find("cuda") != std::string::npos) {
320320
// Use the CUDA plugin as the GlobalPlugin
321321
GlobalPlugin = std::make_shared<plugin>(PluginInformation, backend::cuda);
322+
} else if (InteropBE == backend::level0 &&
323+
PluginNames[I].first.find("level0") != std::string::npos) {
324+
// Use the LEVEL0 plugin as the GlobalPlugin
325+
GlobalPlugin =
326+
std::make_shared<plugin>(PluginInformation, backend::level0);
322327
}
323328
Plugins->emplace_back(plugin(PluginInformation, PluginNames[I].second));
324329
if (trace(TraceLevel::PI_TRACE_BASIC))

sycl/source/device_selector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ __SYCL_INLINE_NAMESPACE(cl) {
1919
namespace sycl {
2020

2121
// Utility function to check if device is of the preferred backend.
22-
// Currently preference is given to the opencl backend.
22+
// Currently preference is given to the level0 backend.
2323
static bool isDeviceOfPreferredSyclBe(const device &Device) {
2424
if (Device.is_host())
2525
return false;
2626

2727
return detail::getSyclObjImpl(Device)->getPlugin().getBackend() ==
28-
backend::opencl;
28+
backend::level0;
2929
}
3030

3131
device device_selector::select_device() const {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// REQUIRES: gpu, level0
2+
3+
// RUN: sycl-ls --verbose >%t.default.out
4+
// RUN: FileCheck %s --check-prefixes=CHECK-GPU-BUILTIN,CHECK-GPU-CUSTOM --input-file %t.default.out
5+
6+
// CHECK-GPU-BUILTIN: gpu_selector(){{.*}}GPU : 0.91
7+
// CHECK-GPU-CUSTOM: custom_selector(gpu){{.*}}GPU : 0.91
8+
9+
//==-- sycl-ls-gpu-default.cpp - SYCL test for default selected gpu device -==//
10+
//
11+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
12+
// See https://llvm.org/LICENSE.txt for license information.
13+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14+
//
15+
//===----------------------------------------------------------------------===//

sycl/test/plugins/sycl-ls-gpu-opencl.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// REQUIRES: gpu, opencl
22

3-
// RUN: sycl-ls --verbose >%t.default.out
4-
// RUN: FileCheck %s --check-prefixes=CHECK-GPU-BUILTIN,CHECK-GPU-CUSTOM --input-file %t.default.out
5-
63
// RUN: env SYCL_BE=PI_OPENCL sycl-ls --verbose >%t.opencl.out
74
// RUN: FileCheck %s --check-prefixes=CHECK-GPU-BUILTIN,CHECK-GPU-CUSTOM --input-file %t.opencl.out
85

sycl/test/scheduler/MultipleDevices.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ int main() {
127127
Result &= multidevice_test(MyQueue1, MyQueue2);
128128
} catch(cl::sycl::runtime_error &) {
129129
std::cout << "Skipping CPU and GPU" << std::endl;
130+
} catch (cl::sycl::compile_program_error &) {
131+
std::cout << "Skipping CPU and GPU" << std::endl;
130132
}
131133

132134
try {
@@ -135,6 +137,8 @@ int main() {
135137
Result &= multidevice_test(MyQueue1, MyQueue2);
136138
} catch(cl::sycl::runtime_error &) {
137139
std::cout << "Skipping host and GPU" << std::endl;
140+
} catch (cl::sycl::compile_program_error &) {
141+
std::cout << "Skipping CPU and GPU" << std::endl;
138142
}
139143

140144
try {
@@ -143,6 +147,8 @@ int main() {
143147
Result &= multidevice_test(MyQueue1, MyQueue2);
144148
} catch (cl::sycl::runtime_error &) {
145149
std::cout << "Skipping GPU and GPU" << std::endl;
150+
} catch (cl::sycl::compile_program_error &) {
151+
std::cout << "Skipping CPU and GPU" << std::endl;
146152
}
147153

148154
return Result;

0 commit comments

Comments
 (0)