DPC++ Runtime
Runtime libraries for oneAPI DPC++
fpga_reg.hpp
Go to the documentation of this file.
1 //==-------------- fpga_reg.hpp --- SYCL FPGA Reg Extensions ---------------==//
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.hpp>
12 #include <type_traits>
13 
14 namespace sycl {
15 inline namespace _V1 {
16 namespace ext::intel {
17 
18 // Returns a registered copy of the input
19 // This function is intended for FPGA users to instruct the compiler to insert
20 // at least one register stage between the input and the return value.
21 template <typename _T>
22 std::enable_if_t<std::is_trivially_copyable_v<_T>, _T> fpga_reg(_T t) {
23 #if __has_builtin(__builtin_intel_fpga_reg)
24  return __builtin_intel_fpga_reg(t);
25 #else
26  return t;
27 #endif
28 }
29 
30 template <typename _T>
31 [[deprecated(
32  "ext::intel::fpga_reg will only support trivially_copyable types in a "
33  "future release. The type used here will be disallowed.")]] std::
34  enable_if_t<std::is_trivially_copyable_v<_T> == false, _T>
35  fpga_reg(_T t) {
36 #if __has_builtin(__builtin_intel_fpga_reg)
37  return __builtin_intel_fpga_reg(t);
38 #else
39  return t;
40 #endif
41 }
42 
43 } // namespace ext::intel
44 
45 } // namespace _V1
46 } // namespace sycl
47 
48 // Keep it consistent with FPGA attributes like intelfpga::memory()
49 // Currently clang does not support nested namespace for attributes
50 namespace intelfpga {
51 template <typename _T>
52 [[deprecated("intelfpga::fpga_reg will be removed in a future release.")]] _T
53 fpga_reg(const _T &t) {
55 }
56 } // namespace intelfpga
_T fpga_reg(const _T &t)
Definition: fpga_reg.hpp:53
std::enable_if_t< std::is_trivially_copyable_v< _T >, _T > fpga_reg(_T t)
Definition: fpga_reg.hpp:22
Definition: access.hpp:18