Skip to content

Commit 9a5f39a

Browse files
[SYCL] [FPGA] Manually revert header change of variadic template argument list (#4260)
The previous patch #3957 was a prerequisite change for the upcoming FPGA latency control feature. Revert due to a late change to the proposed use model API.
1 parent c544d4b commit 9a5f39a

File tree

3 files changed

+25
-73
lines changed

3 files changed

+25
-73
lines changed

sycl/include/sycl/ext/intel/fpga_lsu.hpp

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,24 @@ constexpr uint8_t CACHE = 0x2;
2020
constexpr uint8_t STATICALLY_COALESCE = 0x4;
2121
constexpr uint8_t PREFETCH = 0x8;
2222

23-
struct burst_coalesce_impl_id;
24-
template <int32_t _N>
25-
struct burst_coalesce_impl : std::integral_constant<int32_t, _N> {
26-
using type_id = burst_coalesce_impl_id;
23+
template <int32_t _N> struct burst_coalesce_impl {
24+
static constexpr int32_t value = _N;
25+
static constexpr int32_t default_value = 0;
2726
};
2827

29-
struct cache_id;
30-
template <int32_t _N> struct cache : std::integral_constant<int32_t, _N> {
31-
using type_id = cache_id;
28+
template <int32_t _N> struct cache {
29+
static constexpr int32_t value = _N;
30+
static constexpr int32_t default_value = 0;
3231
};
3332

34-
struct prefetch_impl_id;
35-
template <int32_t _N>
36-
struct prefetch_impl : std::integral_constant<int32_t, _N> {
37-
using type_id = prefetch_impl_id;
33+
template <int32_t _N> struct prefetch_impl {
34+
static constexpr int32_t value = _N;
35+
static constexpr int32_t default_value = 0;
3836
};
3937

40-
struct statically_coalesce_impl_id;
41-
template <int32_t _N>
42-
struct statically_coalesce_impl : std::integral_constant<int32_t, _N> {
43-
using type_id = statically_coalesce_impl_id;
38+
template <int32_t _N> struct statically_coalesce_impl {
39+
static constexpr int32_t value = _N;
40+
static constexpr int32_t default_value = 1;
4441
};
4542

4643
template <bool _B> using burst_coalesce = burst_coalesce_impl<_B>;
@@ -81,21 +78,21 @@ template <class... _mem_access_params> class lsu final {
8178

8279
private:
8380
static constexpr int32_t _burst_coalesce_val =
84-
_GetValue<burst_coalesce_impl<0>, _mem_access_params...>::value;
81+
_GetValue<burst_coalesce_impl, _mem_access_params...>::value;
8582
static constexpr uint8_t _burst_coalesce =
8683
_burst_coalesce_val == 1 ? BURST_COALESCE : 0;
8784

8885
static constexpr int32_t _cache_val =
89-
_GetValue<cache<0>, _mem_access_params...>::value;
86+
_GetValue<cache, _mem_access_params...>::value;
9087
static constexpr uint8_t _cache = (_cache_val > 0) ? CACHE : 0;
9188

9289
static constexpr int32_t _statically_coalesce_val =
93-
_GetValue<statically_coalesce_impl<1>, _mem_access_params...>::value;
90+
_GetValue<statically_coalesce_impl, _mem_access_params...>::value;
9491
static constexpr uint8_t _dont_statically_coalesce =
9592
_statically_coalesce_val == 0 ? STATICALLY_COALESCE : 0;
9693

9794
static constexpr int32_t _prefetch_val =
98-
_GetValue<prefetch_impl<0>, _mem_access_params...>::value;
95+
_GetValue<prefetch_impl, _mem_access_params...>::value;
9996
static constexpr uint8_t _prefetch = _prefetch_val ? PREFETCH : 0;
10097

10198
static_assert(_cache_val >= 0, "cache size parameter must be non-negative");

sycl/include/sycl/ext/intel/fpga_utils.hpp

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,18 @@ namespace sycl {
1717
namespace ext {
1818
namespace intel {
1919

20-
template <class _D, class _T>
21-
struct _MatchType : std::is_same<typename _D::type_id, typename _T::type_id> {};
20+
template <template <int32_t> class _Type, class _T>
21+
struct _MatchType : std::is_same<_Type<_T::value>, _T> {};
2222

23-
template <class _D, class... _T> struct _GetValue;
24-
25-
template <class _D>
26-
struct _GetValue<_D> : std::integral_constant<decltype(_D::value), _D::value> {
23+
template <template <int32_t> class _Type, class... _T> struct _GetValue {
24+
static constexpr auto value = _Type<0>::default_value;
2725
};
2826

29-
template <class _D, class _T1, class... _T> struct _GetValue<_D, _T1, _T...> {
30-
template <class _D2, class _T12, class _Enable = void>
31-
struct impl : std::integral_constant<decltype(_D::value),
32-
_GetValue<_D, _T...>::value> {};
33-
34-
template <class _D2, class _T12>
35-
struct impl<_D2, _T12, std::enable_if_t<_MatchType<_D2, _T12>::value>>
36-
: std::integral_constant<decltype(_D::value), _T1::value> {};
37-
38-
static constexpr auto value = impl<_D, _T1>::value;
27+
template <template <int32_t> class _Type, class _T1, class... _T>
28+
struct _GetValue<_Type, _T1, _T...> {
29+
static constexpr auto value =
30+
detail::conditional_t<_MatchType<_Type, _T1>::value, _T1,
31+
_GetValue<_Type, _T...>>::value;
3932
};
4033
} // namespace intel
4134
} // namespace ext

sycl/test/fpga_tests/arbitrary_template_arg.cpp

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)