Skip to content

Commit 240aa79

Browse files
author
Chen, Brox
committed
reorganize annotated_arg/ptr folder
1 parent 5c6ee06 commit 240aa79

File tree

10 files changed

+127
-75
lines changed

10 files changed

+127
-75
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: 21 additions & 69 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

12+
#include <sycl/ext/oneapi/experimental/common_annotated_properties/properties.hpp>
1113
#include <sycl/ext/oneapi/properties/property.hpp>
1214
#include <sycl/ext/oneapi/properties/property_value.hpp>
1315

1416
namespace sycl {
1517
__SYCL_INLINE_VER_NAMESPACE(_V1) {
1618
namespace ext {
17-
namespace oneapi {
19+
namespace intel {
1820
namespace experimental {
1921

20-
template <typename T, typename PropertyListT> class annotated_arg;
21-
template <typename T, typename PropertyListT> class annotated_ptr;
22-
22+
using namespace sycl::ext::oneapi::experimental;
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,21 @@ 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+
} // namespace ext
108+
} // __SYCL_INLINE_VER_NAMESPACE(_V1)
109+
} // namespace sycl
110+
111+
namespace sycl {
112+
__SYCL_INLINE_VER_NAMESPACE(_V1) {
113+
namespace ext {
114+
namespace oneapi {
115+
namespace experimental {
116+
template <typename T, typename PropertyListT> class annotated_arg;
117+
template <typename T, typename PropertyListT> class annotated_ptr;
118+
119+
using namespace sycl::ext::intel::experimental;
105120
template <> struct is_property_key<register_map_key> : std::true_type {};
106121
template <> struct is_property_key<conduit_key> : std::true_type {};
107122
template <> struct is_property_key<stable_key> : std::true_type {};
@@ -287,9 +302,6 @@ struct PropertyMetaInfo<read_write_mode_key::value_t<Mode>> {
287302
} // namespace detail
288303

289304
// 'buffer_location' and mmhost properties are pointers-only
290-
template <typename T, typename PropertyValueT>
291-
struct is_valid_property : std::false_type {};
292-
293305
template <typename T, int N>
294306
struct is_valid_property<T, buffer_location_key::value_t<N>>
295307
: std::bool_constant<std::is_pointer<T>::value> {};
@@ -327,66 +339,6 @@ struct is_valid_property<T, conduit_key::value_t> : std::true_type {};
327339
template <typename T>
328340
struct is_valid_property<T, stable_key::value_t> : std::true_type {};
329341

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-
341-
//===----------------------------------------------------------------------===//
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 <> struct is_property_key<alignment_key> : std::true_type {};
352-
353-
template <typename T, typename PropertyListT>
354-
struct is_property_key_of<alignment_key, annotated_ptr<T, PropertyListT>>
355-
: std::true_type {};
356-
357-
namespace detail {
358-
359-
template <> struct PropertyToKind<alignment_key> {
360-
static constexpr PropKind Kind = PropKind::Alignment;
361-
};
362-
363-
template <> struct IsCompileTimeProperty<alignment_key> : std::true_type {};
364-
365-
template <int N> struct PropertyMetaInfo<alignment_key::value_t<N>> {
366-
static constexpr const char *name = "sycl-alignment";
367-
static constexpr int value = N;
368-
};
369-
370-
} // namespace detail
371-
372-
//===----------------------------------------------------------------------===//
373-
// Utility type trait for annotated_arg/annotated_ptr deduction guide
374-
//===----------------------------------------------------------------------===//
375-
//
376-
namespace detail {
377-
// Deduce a `properties<>` type from given variadic properties
378-
template <typename... Args> struct DeducedProperties {
379-
using type = decltype(properties{std::declval<Args>()...});
380-
};
381-
382-
// Partial specialization for deducing a `properties<>` type by forwarding the
383-
// given `properties<>` type
384-
template <typename... Args>
385-
struct DeducedProperties<detail::properties_t<Args...>> {
386-
using type = detail::properties_t<Args...>;
387-
};
388-
} // namespace detail
389-
390342
} // namespace experimental
391343
} // namespace oneapi
392344
} // namespace ext

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

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

99
#pragma once
10+
#include <sycl/ext/intel/experimental/fpga_annotated_properties.hpp>
11+
#include <sycl/ext/intel/experimental/fpga_kernel_properties.hpp>
1012
#include <sycl/ext/intel/experimental/fpga_lsu.hpp>
1113
#include <sycl/ext/intel/experimental/pipes.hpp>
1214
#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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
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/oneapi/experimental/common_annotated_properties/properties.hpp>
1717
#include <sycl/ext/oneapi/properties/properties.hpp>
1818

1919
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: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
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/oneapi/experimental/common_annotated_properties/properties.hpp>
1717
#include <sycl/ext/oneapi/properties/properties.hpp>
1818

1919
namespace sycl {
@@ -22,6 +22,37 @@ namespace ext {
2222
namespace oneapi {
2323
namespace experimental {
2424

25+
//===----------------------------------------------------------------------===//
26+
// Specific properties of annotated_ptr
27+
//===----------------------------------------------------------------------===//
28+
struct alignment_key {
29+
template <int K>
30+
using value_t = property_value<alignment_key, std::integral_constant<int, K>>;
31+
};
32+
33+
template <int K> inline constexpr alignment_key::value_t<K> alignment;
34+
35+
template <> struct is_property_key<alignment_key> : std::true_type {};
36+
37+
template <typename T, typename PropertyListT>
38+
struct is_property_key_of<alignment_key, annotated_ptr<T, PropertyListT>>
39+
: std::true_type {};
40+
41+
namespace detail {
42+
43+
template <> struct PropertyToKind<alignment_key> {
44+
static constexpr PropKind Kind = PropKind::Alignment;
45+
};
46+
47+
template <> struct IsCompileTimeProperty<alignment_key> : std::true_type {};
48+
49+
template <int N> struct PropertyMetaInfo<alignment_key::value_t<N>> {
50+
static constexpr const char *name = "sycl-alignment";
51+
static constexpr int value = N;
52+
};
53+
54+
} // namespace detail
55+
2556
namespace {
2657
#define PROPAGATE_OP(op) \
2758
annotated_ref operator op(const T &rhs) { \
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//==-- common_annotated_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/property.hpp>
13+
#include <sycl/ext/oneapi/properties/property_value.hpp>
14+
15+
namespace sycl {
16+
__SYCL_INLINE_VER_NAMESPACE(_V1) {
17+
namespace ext {
18+
namespace oneapi {
19+
namespace experimental {
20+
21+
template <typename T, typename PropertyListT> class annotated_arg;
22+
template <typename T, typename PropertyListT> class annotated_ptr;
23+
24+
//===----------------------------------------------------------------------===//
25+
// Common properties of annotated_arg/annotated_ptr
26+
//===----------------------------------------------------------------------===//
27+
28+
//===----------------------------------------------------------------------===//
29+
// Utility type trait for annotated_arg/annotated_ptr deduction guide
30+
//===----------------------------------------------------------------------===//
31+
template <typename T, typename PropertyValueT>
32+
struct is_valid_property : std::false_type {};
33+
34+
namespace detail {
35+
// Deduce a `properties<>` type from given variadic properties
36+
template <typename... Args> struct DeducedProperties {
37+
using type = decltype(properties{std::declval<Args>()...});
38+
};
39+
40+
// Partial specialization for deducing a `properties<>` type by forwarding the
41+
// given `properties<>` type
42+
template <typename... Args>
43+
struct DeducedProperties<detail::properties_t<Args...>> {
44+
using type = detail::properties_t<Args...>;
45+
};
46+
} // namespace detail
47+
48+
template <typename T, typename... Props>
49+
struct check_property_list : std::true_type {};
50+
51+
template <typename T, typename Prop, typename... Props>
52+
struct check_property_list<T, Prop, Props...>
53+
: std::conditional_t<is_valid_property<T, Prop>::value,
54+
check_property_list<T, Props...>, std::false_type> {
55+
static_assert(is_valid_property<T, Prop>::value,
56+
"Property is invalid for the given type.");
57+
};
58+
59+
} // namespace experimental
60+
} // namespace oneapi
61+
} // namespace ext
62+
} // __SYCL_INLINE_VER_NAMESPACE(_V1)
63+
} // 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(awidth<32>, dwidth<32>))>;

0 commit comments

Comments
 (0)