DPC++ Runtime
Runtime libraries for oneAPI DPC++
backend_types.hpp
Go to the documentation of this file.
1 //==-------------- backend_types.hpp - SYCL backend types ------------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 #include <sycl/detail/defines_elementary.hpp> // for __SYCL2020_DEPRECATED
12 
13 #include <ostream> // for operator<<, ostream
14 
15 namespace sycl {
16 inline namespace _V1 {
17 
18 enum class backend : char {
19  host __SYCL2020_DEPRECATED("'host' backend is no longer supported") = 0,
20  opencl = 1,
22  ext_oneapi_cuda = 3,
23  all = 4,
24  ext_intel_esimd_emulator __SYCL_DEPRECATED(
25  "esimd emulator is no longer supported") = 5,
26  ext_oneapi_hip = 6,
28 };
29 
30 template <backend Backend> class backend_traits;
31 
32 template <backend Backend, typename SYCLObjectT>
33 using backend_input_t =
34  typename backend_traits<Backend>::template input_type<SYCLObjectT>;
35 template <backend Backend, typename SYCLObjectT>
36 using backend_return_t =
37  typename backend_traits<Backend>::template return_type<SYCLObjectT>;
38 
39 inline std::ostream &operator<<(std::ostream &Out, backend be) {
40  switch (be) {
41  case backend::host:
42  Out << "host";
43  break;
44  case backend::opencl:
45  Out << "opencl";
46  break;
48  Out << "ext_oneapi_level_zero";
49  break;
51  Out << "ext_oneapi_cuda";
52  break;
53  case backend::ext_intel_esimd_emulator:
54  Out << "ext_intel_esimd_emulator";
55  break;
57  Out << "ext_oneapi_hip";
58  break;
60  Out << "ext_oneapi_native_cpu";
61  break;
62  case backend::all:
63  Out << "all";
64  }
65  return Out;
66 }
67 
68 namespace detail {
69 inline std::string_view get_backend_name_no_vendor(backend Backend) {
70  switch (Backend) {
71  case backend::host:
72  return "host";
73  case backend::opencl:
74  return "opencl";
76  return "level_zero";
78  return "cuda";
79  case backend::ext_intel_esimd_emulator:
80  return "esimd_emulator";
82  return "hip";
84  return "native_cpu";
85  case backend::all:
86  return "all";
87  }
88 
89  return "";
90 }
91 } // namespace detail
92 
93 } // namespace _V1
94 } // namespace sycl
std::string_view get_backend_name_no_vendor(backend Backend)
typename backend_traits< Backend >::template return_type< SyclType > backend_return_t
Definition: backend.hpp:87
std::ostream & operator<<(std::ostream &Out, backend be)
typename backend_traits< Backend >::template input_type< SyclType > backend_input_t
Definition: backend.hpp:83
Definition: access.hpp:18