alpaka
Abstraction Library for Parallel Kernel Acceleration
PlatformFpgaSyclIntel.hpp
Go to the documentation of this file.
1 /* Copyright 2023 Jan Stephan, Luca Ferragina, Andrea Bocci
2  * SPDX-License-Identifier: MPL-2.0
3  */
4 
5 #pragma once
6 
8 #include "alpaka/dev/Traits.hpp"
10 
11 #if defined(ALPAKA_ACC_SYCL_ENABLED) && defined(ALPAKA_SYCL_ONEAPI_FPGA)
12 
13 # include <sycl/sycl.hpp>
14 
15 # include <string>
16 
17 namespace alpaka
18 {
19  namespace detail
20  {
21  // Prevent clang from annoying us with warnings about emitting too many vtables. These are discarded by the
22  // linker anyway.
23 # if BOOST_COMP_CLANG
24 # pragma clang diagnostic push
25 # pragma clang diagnostic ignored "-Wweak-vtables"
26 # endif
27  struct IntelFpgaSelector final
28  {
29 # ifdef ALPAKA_FPGA_EMULATION
30  static constexpr auto platform_name = "Intel(R) FPGA Emulation Platform for OpenCL(TM)";
31 # else
32  static constexpr auto platform_name = "Intel(R) FPGA SDK for OpenCL(TM)";
33 # endif
34 
35  auto operator()(sycl::device const& dev) const -> int
36  {
37  auto const& platform = dev.get_platform().get_info<sycl::info::platform::name>();
38  auto const is_intel_fpga = dev.is_accelerator() && (platform == platform_name);
39 
40  return is_intel_fpga ? 1 : -1;
41  }
42  };
43 # if BOOST_COMP_CLANG
44 # pragma clang diagnostic pop
45 # endif
46  } // namespace detail
47 
48  //! The SYCL device manager.
49  using PlatformFpgaSyclIntel = PlatformGenericSycl<detail::IntelFpgaSelector>;
50 } // namespace alpaka
51 
52 namespace alpaka::trait
53 {
54  //! The SYCL device manager device type trait specialization.
55  template<>
56  struct DevType<PlatformFpgaSyclIntel>
57  {
58  using type = DevGenericSycl<PlatformFpgaSyclIntel>; // = DevFpgaSyclIntel
59  };
60 } // namespace alpaka::trait
61 
62 #endif
The accelerator traits.
The alpaka accelerator library.