Skip to content

Commit 80b7de1

Browse files
Brox Chendm-vodopyanov
Brox Chen
andauthored
[SYCL] Reorganize annotated_arg/ptr folder (#10420)
Reorganize annotated_ptr/arg folder sycl/ext ----oneapi/ --------experimental --------------annotated_ptr --------------------annotated_ptr.hpp --------------annotated_arg --------------------annotated_arg.hpp --------------common_annotated_properties --------------------properties.hpp ----intel/ --------experimental --------------fpga_annotated_properties.hpp --------------fpga_kernel_properties.hpp --------- Co-authored-by: Dmitry Vodopyanov <dmitry.vodopyanov@intel.com>
1 parent 99cbdd1 commit 80b7de1

File tree

10 files changed

+147
-77
lines changed

10 files changed

+147
-77
lines changed

sycl/include/sycl/ext/oneapi/annotated_arg/properties.hpp renamed to sycl/include/sycl/ext/intel/experimental/fpga_annotated_properties.hpp

Lines changed: 30 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//==-- properties.hpp - SYCL properties associated with annotated_arg/ptr --==//
1+
//==-- fpga_annotated_properties.hpp - SYCL properties associated with
2+
// annotated_arg/ptr --==//
23
//
34
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,20 +9,19 @@
89

910
#pragma once
1011

11-
#include <sycl/ext/oneapi/properties/property.hpp>
12-
#include <sycl/ext/oneapi/properties/property_value.hpp>
12+
#include <sycl/ext/oneapi/experimental/common_annotated_properties/properties.hpp>
1313

1414
namespace sycl {
1515
__SYCL_INLINE_VER_NAMESPACE(_V1) {
1616
namespace ext {
17-
namespace oneapi {
17+
namespace intel {
1818
namespace experimental {
1919

20-
template <typename T, typename PropertyListT> class annotated_arg;
21-
template <typename T, typename PropertyListT> class annotated_ptr;
22-
20+
template <typename PropertyT, typename... Ts>
21+
using property_value =
22+
sycl::ext::oneapi::experimental::property_value<PropertyT, Ts...>;
2323
//===----------------------------------------------------------------------===//
24-
// Common properties of annotated_arg/annotated_ptr
24+
// FPGA properties of annotated_arg/annotated_ptr
2525
//===----------------------------------------------------------------------===//
2626
struct register_map_key {
2727
using value_t = property_value<register_map_key>;
@@ -102,6 +102,27 @@ inline constexpr read_write_mode_key::value_t<read_write_mode_enum::write>
102102
inline constexpr read_write_mode_key::value_t<read_write_mode_enum::read_write>
103103
read_write_mode_readwrite;
104104

105+
} // namespace experimental
106+
} // namespace intel
107+
108+
namespace oneapi {
109+
namespace experimental {
110+
template <typename T, typename PropertyListT> class annotated_arg;
111+
template <typename T, typename PropertyListT> class annotated_ptr;
112+
113+
struct alignment_key;
114+
using register_map_key = intel::experimental::register_map_key;
115+
using conduit_key = intel::experimental::conduit_key;
116+
using stable_key = intel::experimental::stable_key;
117+
using buffer_location_key = intel::experimental::buffer_location_key;
118+
using awidth_key = intel::experimental::awidth_key;
119+
using dwidth_key = intel::experimental::dwidth_key;
120+
using latency_key = intel::experimental::latency_key;
121+
using read_write_mode_key = intel::experimental::read_write_mode_key;
122+
using maxburst_key = intel::experimental::maxburst_key;
123+
using wait_request_key = intel::experimental::wait_request_key;
124+
using read_write_mode_enum = intel::experimental::read_write_mode_enum;
125+
105126
template <> struct is_property_key<register_map_key> : std::true_type {};
106127
template <> struct is_property_key<conduit_key> : std::true_type {};
107128
template <> struct is_property_key<stable_key> : std::true_type {};
@@ -287,9 +308,6 @@ struct PropertyMetaInfo<read_write_mode_key::value_t<Mode>> {
287308
} // namespace detail
288309

289310
// 'buffer_location' and mmhost properties are pointers-only
290-
template <typename T, typename PropertyValueT>
291-
struct is_valid_property : std::false_type {};
292-
293311
template <typename T, int N>
294312
struct is_valid_property<T, buffer_location_key::value_t<N>>
295313
: std::bool_constant<std::is_pointer<T>::value> {};
@@ -327,69 +345,11 @@ struct is_valid_property<T, conduit_key::value_t> : std::true_type {};
327345
template <typename T>
328346
struct is_valid_property<T, stable_key::value_t> : std::true_type {};
329347

330-
template <typename T, typename... Props>
331-
struct check_property_list : std::true_type {};
332-
333-
template <typename T, typename Prop, typename... Props>
334-
struct check_property_list<T, Prop, Props...>
335-
: std::conditional_t<is_valid_property<T, Prop>::value,
336-
check_property_list<T, Props...>, std::false_type> {
337-
static_assert(is_valid_property<T, Prop>::value,
338-
"Property is invalid for the given type.");
339-
};
340-
341348
//===----------------------------------------------------------------------===//
342-
// Specific properties of annotated_ptr
343-
//===----------------------------------------------------------------------===//
344-
struct alignment_key {
345-
template <int K>
346-
using value_t = property_value<alignment_key, std::integral_constant<int, K>>;
347-
};
348-
349-
template <int K> inline constexpr alignment_key::value_t<K> alignment;
350-
351-
template <typename T, int W>
352-
struct is_valid_property<T, alignment_key::value_t<W>>
353-
: std::bool_constant<std::is_pointer<T>::value> {};
354-
355-
template <> struct is_property_key<alignment_key> : std::true_type {};
356-
357-
template <typename T, typename PropertyListT>
358-
struct is_property_key_of<alignment_key, annotated_ptr<T, PropertyListT>>
359-
: std::true_type {};
360-
361-
namespace detail {
362-
363-
template <> struct PropertyToKind<alignment_key> {
364-
static constexpr PropKind Kind = PropKind::Alignment;
365-
};
366-
367-
template <> struct IsCompileTimeProperty<alignment_key> : std::true_type {};
368-
369-
template <int N> struct PropertyMetaInfo<alignment_key::value_t<N>> {
370-
static constexpr const char *name = "sycl-alignment";
371-
static constexpr int value = N;
372-
};
373-
374-
} // namespace detail
375-
376-
//===----------------------------------------------------------------------===//
377-
// Utility type trait for annotated_arg/annotated_ptr deduction guide
349+
// Utility for FPGA properties
378350
//===----------------------------------------------------------------------===//
379351
//
380352
namespace detail {
381-
// Deduce a `properties<>` type from given variadic properties
382-
template <typename... Args> struct DeducedProperties {
383-
using type = decltype(properties{std::declval<Args>()...});
384-
};
385-
386-
// Partial specialization for deducing a `properties<>` type by forwarding the
387-
// given `properties<>` type
388-
template <typename... Args>
389-
struct DeducedProperties<detail::properties_t<Args...>> {
390-
using type = detail::properties_t<Args...>;
391-
};
392-
393353
template <typename... Args> struct checkValidFPGAPropertySet {
394354
using list = std::tuple<Args...>;
395355
static constexpr bool has_BufferLocation =

sycl/include/sycl/ext/intel/fpga_extensions.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
//===----------------------------------------------------------------------===//
88

99
#pragma once
10+
#include <sycl/detail/defines_elementary.hpp>
11+
#include <sycl/detail/stl_type_traits.hpp>
12+
#include <sycl/ext/intel/experimental/fpga_annotated_properties.hpp>
13+
#include <sycl/ext/intel/experimental/fpga_kernel_properties.hpp>
1014
#include <sycl/ext/intel/experimental/fpga_lsu.hpp>
1115
#include <sycl/ext/intel/experimental/pipes.hpp>
1216
#include <sycl/ext/intel/fpga_device_selector.hpp>

sycl/include/sycl/ext/oneapi/annotated_arg/annotated_arg.hpp renamed to sycl/include/sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
#include <sycl/detail/stl_type_traits.hpp>
1515
#include <sycl/exception.hpp>
16-
#include <sycl/ext/oneapi/annotated_arg/properties.hpp>
16+
#include <sycl/ext/intel/experimental/fpga_annotated_properties.hpp>
17+
#include <sycl/ext/oneapi/experimental/common_annotated_properties/properties.hpp>
1718
#include <sycl/ext/oneapi/properties/properties.hpp>
1819

1920
namespace sycl {

sycl/include/sycl/ext/oneapi/annotated_arg/annotated_ptr.hpp renamed to sycl/include/sycl/ext/oneapi/experimental/annotated_ptr/annotated_ptr.hpp

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
#include <sycl/detail/stl_type_traits.hpp>
1515
#include <sycl/exception.hpp>
16-
#include <sycl/ext/oneapi/annotated_arg/properties.hpp>
16+
#include <sycl/ext/intel/experimental/fpga_annotated_properties.hpp>
17+
#include <sycl/ext/oneapi/experimental/common_annotated_properties/properties.hpp>
1718
#include <sycl/ext/oneapi/properties/properties.hpp>
1819

1920
namespace sycl {
@@ -22,6 +23,41 @@ namespace ext {
2223
namespace oneapi {
2324
namespace experimental {
2425

26+
//===----------------------------------------------------------------------===//
27+
// Specific properties of annotated_ptr
28+
//===----------------------------------------------------------------------===//
29+
struct alignment_key {
30+
template <int K>
31+
using value_t = property_value<alignment_key, std::integral_constant<int, K>>;
32+
};
33+
34+
template <int K> inline constexpr alignment_key::value_t<K> alignment;
35+
36+
template <> struct is_property_key<alignment_key> : std::true_type {};
37+
38+
template <typename T, int W>
39+
struct is_valid_property<T, alignment_key::value_t<W>>
40+
: std::bool_constant<std::is_pointer<T>::value> {};
41+
42+
template <typename T, typename PropertyListT>
43+
struct is_property_key_of<alignment_key, annotated_ptr<T, PropertyListT>>
44+
: std::true_type {};
45+
46+
namespace detail {
47+
48+
template <> struct PropertyToKind<alignment_key> {
49+
static constexpr PropKind Kind = PropKind::Alignment;
50+
};
51+
52+
template <> struct IsCompileTimeProperty<alignment_key> : std::true_type {};
53+
54+
template <int N> struct PropertyMetaInfo<alignment_key::value_t<N>> {
55+
static constexpr const char *name = "sycl-alignment";
56+
static constexpr int value = N;
57+
};
58+
59+
} // namespace detail
60+
2561
namespace {
2662
#define PROPAGATE_OP(op) \
2763
annotated_ref operator op(const T &rhs) { \
@@ -135,7 +171,8 @@ __SYCL_TYPE(annotated_ptr) annotated_ptr<T, detail::properties_t<Props...>> {
135171

136172
// buffer_location and alignment are allowed for annotated_ref
137173
using allowed_properties =
138-
std::tuple<decltype(buffer_location<0>), decltype(alignment<0>)>;
174+
std::tuple<decltype(ext::intel::experimental::buffer_location<0>),
175+
decltype(ext::oneapi::experimental::alignment<0>)>;
139176
using filtered_properties =
140177
typename PropertiesFilter<allowed_properties, Props...>::tuple;
141178

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//==-- properties.hpp - SYCL properties associated with
2+
// annotated_arg/ptr --==//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#pragma once
11+
12+
#include <sycl/ext/oneapi/properties/properties.hpp>
13+
#include <sycl/ext/oneapi/properties/property.hpp>
14+
#include <sycl/ext/oneapi/properties/property_value.hpp>
15+
16+
namespace sycl {
17+
__SYCL_INLINE_VER_NAMESPACE(_V1) {
18+
namespace ext {
19+
namespace oneapi {
20+
namespace experimental {
21+
22+
template <typename T, typename PropertyListT> class annotated_arg;
23+
template <typename T, typename PropertyListT> class annotated_ptr;
24+
25+
//===----------------------------------------------------------------------===//
26+
// Common properties of annotated_arg/annotated_ptr
27+
//===----------------------------------------------------------------------===//
28+
29+
//===----------------------------------------------------------------------===//
30+
// Utility type trait for annotated_arg/annotated_ptr deduction guide
31+
//===----------------------------------------------------------------------===//
32+
template <typename T, typename PropertyValueT>
33+
struct is_valid_property : std::false_type {};
34+
35+
namespace detail {
36+
// Deduce a `properties<>` type from given variadic properties
37+
template <typename... Args> struct DeducedProperties {
38+
using type = decltype(properties{std::declval<Args>()...});
39+
};
40+
41+
// Partial specialization for deducing a `properties<>` type by forwarding the
42+
// given `properties<>` type
43+
template <typename... Args>
44+
struct DeducedProperties<detail::properties_t<Args...>> {
45+
using type = detail::properties_t<Args...>;
46+
};
47+
} // namespace detail
48+
49+
template <typename T, typename... Props>
50+
struct check_property_list : std::true_type {};
51+
52+
template <typename T, typename Prop, typename... Props>
53+
struct check_property_list<T, Prop, Props...>
54+
: std::conditional_t<is_valid_property<T, Prop>::value,
55+
check_property_list<T, Props...>, std::false_type> {
56+
static_assert(is_valid_property<T, Prop>::value,
57+
"Property is invalid for the given type.");
58+
};
59+
60+
} // namespace experimental
61+
} // namespace oneapi
62+
} // namespace ext
63+
} // __SYCL_INLINE_VER_NAMESPACE(_V1)
64+
} // namespace sycl

sycl/include/sycl/sycl.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,10 @@
6464
#include <sycl/ext/intel/experimental/pipe_properties.hpp>
6565
#include <sycl/ext/intel/experimental/pipes.hpp>
6666
#include <sycl/ext/intel/usm_pointers.hpp>
67-
#include <sycl/ext/oneapi/annotated_arg/annotated_arg.hpp>
68-
#include <sycl/ext/oneapi/annotated_arg/annotated_ptr.hpp>
69-
#include <sycl/ext/oneapi/annotated_arg/properties.hpp>
7067
#include <sycl/ext/oneapi/device_global/device_global.hpp>
7168
#include <sycl/ext/oneapi/device_global/properties.hpp>
69+
#include <sycl/ext/oneapi/experimental/annotated_arg/annotated_arg.hpp>
70+
#include <sycl/ext/oneapi/experimental/annotated_ptr/annotated_ptr.hpp>
7271
#include <sycl/ext/oneapi/experimental/ballot_group.hpp>
7372
#include <sycl/ext/oneapi/experimental/bfloat16_math.hpp>
7473
#include <sycl/ext/oneapi/experimental/builtins.hpp>

sycl/test/extensions/annotated_arg/annotated_arg_for_non_ptr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using namespace sycl;
1212
using namespace ext::oneapi::experimental;
13+
using namespace ext::intel::experimental;
1314

1415
struct B {};
1516

sycl/test/extensions/annotated_arg/annotated_arg_for_ptr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using namespace sycl;
1212
using namespace ext::oneapi::experimental;
13+
using namespace ext::intel::experimental;
1314

1415
using annotated_arg_t1 =
1516
annotated_arg<int *, decltype(properties(awidth<32>, dwidth<32>))>;

sycl/test/extensions/annotated_arg/annotated_arg_properties.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
22
// expected-no-diagnostics
33

4-
#include <sycl/sycl.hpp>
4+
#include "sycl/sycl.hpp"
5+
#include <sycl/ext/intel/fpga_extensions.hpp>
56

67
using namespace sycl::ext::oneapi::experimental;
8+
using namespace sycl::ext::intel::experimental;
79

810
static annotated_arg<int, decltype(properties())> AnnotatedArg1;
911
static annotated_arg<int, decltype(properties(register_map))> AnnotatedArg2;

sycl/test/extensions/annotated_arg/annotated_ptr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using namespace sycl;
1212
using namespace ext::oneapi::experimental;
13+
using namespace ext::intel::experimental;
1314

1415
using annotated_ptr_t1 =
1516
annotated_ptr<int, decltype(properties(buffer_location<0>, awidth<32>,

0 commit comments

Comments
 (0)