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 {
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 typename std::enable_if<std::is_trivially_copyable<_T>::value, _T>::type
23 fpga_reg(_T t) {
24 #if __has_builtin(__builtin_intel_fpga_reg)
25  return __builtin_intel_fpga_reg(t);
26 #else
27  return t;
28 #endif
29 }
30 
31 template <typename _T>
32 [[deprecated(
33  "ext::intel::fpga_reg will only support trivially_copyable types in a "
34  "future release. The type used here will be disallowed.")]]
35 typename std::enable_if<std::is_trivially_copyable<_T>::value == false,
36  _T>::type
37 fpga_reg(_T t) {
38 #if __has_builtin(__builtin_intel_fpga_reg)
39  return __builtin_intel_fpga_reg(t);
40 #else
41  return t;
42 #endif
43 }
44 
45 } // namespace ext::intel
46 
47 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
48 } // namespace sycl
49 
50 // Keep it consistent with FPGA attributes like intelfpga::memory()
51 // Currently clang does not support nested namespace for attributes
52 namespace intelfpga {
53 template <typename _T>
54 [[deprecated("intelfpga::fpga_reg will be removed in a future release.")]] _T
55 fpga_reg(const _T &t) {
57 }
58 } // namespace intelfpga
#define __SYCL_INLINE_VER_NAMESPACE(X)
_T fpga_reg(const _T &t)
Definition: fpga_reg.hpp:55
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14