@@ -18,9 +18,22 @@ namespace INTEL {
18
18
// Returns a registered copy of the input
19
19
// This function is intended for FPGA users to instruct the compiler to insert
20
20
// at least one register stage between the input and the return value.
21
- template <typename _T> _T fpga_reg (_T t) {
22
- static_assert (std::is_trivially_copyable<_T>::value,
23
- " Type is not trivially_copyable." );
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(" INTEL::fpga_reg will only support trivially_copyable types in a "
33
+ " future release. The type used here will be disallowed." )]]
34
+ typename std::enable_if<std::is_trivially_copyable<_T>::value == false ,
35
+ _T>::type
36
+ fpga_reg (_T t) {
24
37
#if __has_builtin(__builtin_intel_fpga_reg)
25
38
return __builtin_intel_fpga_reg (t);
26
39
#else
@@ -31,3 +44,13 @@ template <typename _T> _T fpga_reg(_T t) {
31
44
} // namespace INTEL
32
45
} // namespace sycl
33
46
} // __SYCL_INLINE_NAMESPACE(cl)
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) {
54
+ return cl::sycl::INTEL::fpga_reg (t);
55
+ }
56
+ } // namespace intelfpga
0 commit comments