|
7 | 7 | //===----------------------------------------------------------------------===//
|
8 | 8 | #pragma once
|
9 | 9 |
|
| 10 | +#include <CL/sycl/detail/common.hpp> |
10 | 11 | #include <CL/sycl/detail/defines.hpp>
|
11 | 12 |
|
12 | 13 | __SYCL_INLINE_NAMESPACE(cl) {
|
@@ -47,7 +48,43 @@ enum class address_space : int {
|
47 | 48 | local_space
|
48 | 49 | };
|
49 | 50 |
|
50 |
| -} // namespace access |
| 51 | +} // namespace access |
| 52 | + |
| 53 | +using access::target; |
| 54 | +using access_mode = access::mode; |
| 55 | + |
| 56 | +template <access_mode mode> struct mode_tag_t { |
| 57 | + explicit mode_tag_t() = default; |
| 58 | +}; |
| 59 | + |
| 60 | +template <access_mode mode, target trgt> struct mode_target_tag_t { |
| 61 | + explicit mode_target_tag_t() = default; |
| 62 | +}; |
| 63 | + |
| 64 | +#if __cplusplus > 201402L |
| 65 | + |
| 66 | +inline constexpr mode_tag_t<access_mode::read> read_only{}; |
| 67 | +inline constexpr mode_tag_t<access_mode::read_write> read_write{}; |
| 68 | +inline constexpr mode_tag_t<access_mode::write> write_only{}; |
| 69 | +inline constexpr mode_target_tag_t<access_mode::read, target::constant_buffer> |
| 70 | + read_constant{}; |
| 71 | + |
| 72 | +#else |
| 73 | + |
| 74 | +namespace { |
| 75 | + |
| 76 | +constexpr const auto &read_only = |
| 77 | + sycl::detail::InlineVariableHelper<mode_tag_t<access_mode::read>>::value; |
| 78 | +constexpr const auto &read_write = sycl::detail::InlineVariableHelper< |
| 79 | + mode_tag_t<access_mode::read_write>>::value; |
| 80 | +constexpr const auto &write_only = |
| 81 | + sycl::detail::InlineVariableHelper<mode_tag_t<access_mode::write>>::value; |
| 82 | +constexpr const auto &read_constant = sycl::detail::InlineVariableHelper< |
| 83 | + mode_target_tag_t<access_mode::read, target::constant_buffer>>::value; |
| 84 | + |
| 85 | +} // namespace |
| 86 | + |
| 87 | +#endif |
51 | 88 |
|
52 | 89 | namespace detail {
|
53 | 90 |
|
|
0 commit comments