Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions sycl/include/CL/sycl/INTEL/fpga_reg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@
#pragma once

#include <CL/sycl/detail/defines.hpp>
#include <type_traits>

__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {
namespace INTEL {

template <typename _T> _T fpga_reg(const _T &t) {
// Returns a registered copy of the input
// This function is intended for FPGA users to instruct the compiler to insert
// at least one register stage between the input and the return value.
template <typename _T>
typename std::enable_if<std::is_trivially_copyable<_T>::value, _T>::type
fpga_reg(_T t) {
#if __has_builtin(__builtin_intel_fpga_reg)
return __builtin_intel_fpga_reg(t);
#else
Expand All @@ -26,10 +32,3 @@ template <typename _T> _T fpga_reg(const _T &t) {
} // namespace sycl
} // __SYCL_INLINE_NAMESPACE(cl)

// Keep it consistent with FPGA attributes like intelfpga::memory()
// Currently clang does not support nested namespace for attributes
namespace intelfpga {
template <typename _T> _T fpga_reg(const _T &t) {
return cl::sycl::INTEL::fpga_reg(t);
}
} // namespace intelfpga