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  // No support anymore:
25  // ext_intel_esimd_emulator = 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;
54  Out << "ext_oneapi_hip";
55  break;
57  Out << "ext_oneapi_native_cpu";
58  break;
59  case backend::all:
60  Out << "all";
61  }
62  return Out;
63 }
64 
65 namespace detail {
66 inline std::string_view get_backend_name_no_vendor(backend Backend) {
67  switch (Backend) {
68  case backend::host:
69  return "host";
70  case backend::opencl:
71  return "opencl";
73  return "level_zero";
75  return "cuda";
77  return "hip";
79  return "native_cpu";
80  case backend::all:
81  return "all";
82  }
83 
84  return "";
85 }
86 } // namespace detail
87 
88 } // namespace _V1
89 } // 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:81
std::ostream & operator<<(std::ostream &Out, backend be)
typename backend_traits< Backend >::template input_type< SyclType > backend_input_t
Definition: backend.hpp:77
Definition: access.hpp:18