Skip to content

Commit ad46b64

Browse files
authored
[SYCL] Changed noinit to no_init according to the final published SYCL 2020 spec. (#3718)
1 parent 1f9f526 commit ad46b64

File tree

8 files changed

+41
-10
lines changed

8 files changed

+41
-10
lines changed

sycl/doc/extensions/accessor_properties/SYCL_ONEAPI_accessor_properties.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ Here are some examples of legal and illegal conversions:
7272

7373
```c++
7474
accessor A2(B, h, accessor_property_list{no_alias});
75-
accessor A3(B, h, accessor_property_list{no_alias, noinit});
75+
accessor A3(B, h, accessor_property_list{no_alias, no_init});
7676
accessor A4(B, h, accessor_property_list{no_alias, no_offset});
7777
accessor A5(B, h, accessor_property_list{no_offset, no_alias});
78-
A2 = A3; // Legal because noinit is a runtime property and A2 and A3 otherwise have the same properties
78+
A2 = A3; // Legal because no_init is a runtime property and A2 and A3 otherwise have the same properties
7979
A3 = A2; // Legal for the same reasons as the previous line
8080
A2 = A4; // Illegal as A2 doesn't have the compile-time-constant property no_offset
8181
A5 = A4; // Legal as the order of properties doesn't matter
@@ -473,7 +473,7 @@ Rewrite Table 4.50: Properties supported by the SYCL accessor class as follows,
473473
[options="header"]
474474
|====
475475
| Property | Description | Compile-time Constant
476-
| sycl::property::noinit | The noinit property notifies the SYCL runtime that previous contents of a buffer can be discarded. Replaces deprecated discard_write and discard_read_write access modes. | No
476+
| sycl::property::no_init | The no_init property notifies the SYCL runtime that previous contents of a buffer can be discarded. Replaces deprecated discard_write and discard_read_write access modes. | No
477477
| ONEAPI::property::no_offset | The no_offset property notifies the SYCL device compiler that the accessor will never contain an offset. This may enable the compiler to make assumptions about the alignment of the accessor that it couldn't make otherwise. | Yes
478478
| ONEAPI::property::no_alias | The no_alias property notifies the SYCL device compiler that all modifications to the memory locations accessed (directly or indirectly) by this accessor, that occur during kernel execution, will be done through this accessor (directly or indirectly) and no other accessor or USM pointer in the kernel. This is an unchecked assertion by the programmer and results in undefined behaviour if it is violated. | Yes
479479
|====

sycl/include/CL/sycl/accessor.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,8 @@ class accessor :
838838
static access::mode getAdjustedMode(const PropertyListT &PropertyList) {
839839
access::mode AdjustedMode = AccessMode;
840840

841-
if (PropertyList.template has_property<property::noinit>()) {
841+
if (PropertyList.template has_property<property::no_init>() ||
842+
PropertyList.template has_property<property::noinit>()) {
842843
if (AdjustedMode == access::mode::write) {
843844
AdjustedMode = access::mode::discard_write;
844845
} else if (AdjustedMode == access::mode::read_write) {

sycl/include/CL/sycl/detail/accessor_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void __SYCL_EXPORT addHostAccessorAndWait(Requirement *Req);
214214
template <typename MayBeTag1, typename MayBeTag2>
215215
constexpr access::mode deduceAccessMode() {
216216
// property_list = {} is not properly detected by deduction guide,
217-
// when parameter is passed without curly braces: access(buffer, noinit)
217+
// when parameter is passed without curly braces: access(buffer, no_init)
218218
// thus simplest approach is to check 2 last arguments for being a tag
219219
if constexpr (std::is_same<MayBeTag1,
220220
mode_tag_t<access::mode::read>>::value ||

sycl/include/CL/sycl/detail/properties_traits.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ __SYCL_PARAM_TRAITS_SPEC(sycl::property::image::use_mutex)
66
__SYCL_PARAM_TRAITS_SPEC(sycl::property::image::context_bound)
77
__SYCL_PARAM_TRAITS_SPEC(sycl::ext::oneapi::property::buffer::use_pinned_host_memory)
88
__SYCL_PARAM_TRAITS_SPEC(sycl::property::noinit)
9+
__SYCL_PARAM_TRAITS_SPEC(sycl::property::no_init)
910
__SYCL_PARAM_TRAITS_SPEC(sycl::property::context::cuda::use_primary_context)
1011
__SYCL_PARAM_TRAITS_SPEC(sycl::property::queue::in_order)
1112
__SYCL_PARAM_TRAITS_SPEC(sycl::property::reduction::initialize_to_identity)

sycl/include/CL/sycl/properties/accessor_properties.hpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,28 @@ __SYCL_INLINE_NAMESPACE(cl) {
1717
namespace sycl {
1818
namespace property {
1919

20-
class noinit : public detail::DataLessProperty<detail::NoInit> {};
20+
class no_init : public detail::DataLessProperty<detail::NoInit> {};
21+
22+
class __SYCL2020_DEPRECATED("spelling is now: no_init") noinit
23+
: public detail::DataLessProperty<detail::NoInit> {};
2124

2225
} // namespace property
2326

2427
#if __cplusplus > 201402L
2528

26-
inline constexpr property::noinit noinit;
29+
__SYCL_INLINE_CONSTEXPR property::no_init no_init;
30+
31+
__SYCL_INLINE_CONSTEXPR property::noinit
32+
__SYCL2020_DEPRECATED("spelling is now: no_init") noinit;
2733

2834
#else
2935

3036
namespace {
3137

32-
constexpr const auto &noinit =
38+
constexpr const auto &no_init =
39+
sycl::detail::InlineVariableHelper<property::no_init>::value;
40+
41+
constexpr const auto &noinit __SYCL2020_DEPRECATED("spelling is now: no_init") =
3342
sycl::detail::InlineVariableHelper<property::noinit>::value;
3443
}
3544

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4143,6 +4143,7 @@ _ZNK2cl4sycl7context12get_propertyINS0_8property6buffer13context_boundEEET_v
41434143
_ZNK2cl4sycl7context12get_propertyINS0_8property6buffer9use_mutexEEET_v
41444144
_ZNK2cl4sycl7context12get_propertyINS0_8property6noinitEEET_v
41454145
_ZNK2cl4sycl7context12get_propertyINS0_8property7context4cuda19use_primary_contextEEET_v
4146+
_ZNK2cl4sycl7context12get_propertyINS0_8property7no_initEEET_v
41464147
_ZNK2cl4sycl7context12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v
41474148
_ZNK2cl4sycl7context12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv
41484149
_ZNK2cl4sycl7context12has_propertyINS0_8property5image12use_host_ptrEEEbv
@@ -4154,6 +4155,7 @@ _ZNK2cl4sycl7context12has_propertyINS0_8property6buffer13context_boundEEEbv
41544155
_ZNK2cl4sycl7context12has_propertyINS0_8property6buffer9use_mutexEEEbv
41554156
_ZNK2cl4sycl7context12has_propertyINS0_8property6noinitEEEbv
41564157
_ZNK2cl4sycl7context12has_propertyINS0_8property7context4cuda19use_primary_contextEEEbv
4158+
_ZNK2cl4sycl7context12has_propertyINS0_8property7no_initEEEbv
41574159
_ZNK2cl4sycl7context12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv
41584160
_ZNK2cl4sycl7context3getEv
41594161
_ZNK2cl4sycl7context7is_hostEv
@@ -4180,6 +4182,7 @@ _ZNK2cl4sycl7program12get_propertyINS0_8property6buffer13context_boundEEET_v
41804182
_ZNK2cl4sycl7program12get_propertyINS0_8property6buffer9use_mutexEEET_v
41814183
_ZNK2cl4sycl7program12get_propertyINS0_8property6noinitEEET_v
41824184
_ZNK2cl4sycl7program12get_propertyINS0_8property7context4cuda19use_primary_contextEEET_v
4185+
_ZNK2cl4sycl7program12get_propertyINS0_8property7no_initEEET_v
41834186
_ZNK2cl4sycl7program12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v
41844187
_ZNK2cl4sycl7program12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv
41854188
_ZNK2cl4sycl7program12has_propertyINS0_8property5image12use_host_ptrEEEbv
@@ -4191,6 +4194,7 @@ _ZNK2cl4sycl7program12has_propertyINS0_8property6buffer13context_boundEEEbv
41914194
_ZNK2cl4sycl7program12has_propertyINS0_8property6buffer9use_mutexEEEbv
41924195
_ZNK2cl4sycl7program12has_propertyINS0_8property6noinitEEEbv
41934196
_ZNK2cl4sycl7program12has_propertyINS0_8property7context4cuda19use_primary_contextEEEbv
4197+
_ZNK2cl4sycl7program12has_propertyINS0_8property7no_initEEEbv
41944198
_ZNK2cl4sycl7program12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv
41954199
_ZNK2cl4sycl7program16get_link_optionsB5cxx11Ev
41964200
_ZNK2cl4sycl7program17get_build_optionsB5cxx11Ev
@@ -4212,6 +4216,7 @@ _ZNK2cl4sycl7sampler12get_propertyINS0_8property6buffer13context_boundEEET_v
42124216
_ZNK2cl4sycl7sampler12get_propertyINS0_8property6buffer9use_mutexEEET_v
42134217
_ZNK2cl4sycl7sampler12get_propertyINS0_8property6noinitEEET_v
42144218
_ZNK2cl4sycl7sampler12get_propertyINS0_8property7context4cuda19use_primary_contextEEET_v
4219+
_ZNK2cl4sycl7sampler12get_propertyINS0_8property7no_initEEET_v
42154220
_ZNK2cl4sycl7sampler12get_propertyINS0_8property9reduction22initialize_to_identityEEET_v
42164221
_ZNK2cl4sycl7sampler12has_propertyINS0_3ext6oneapi8property6buffer22use_pinned_host_memoryEEEbv
42174222
_ZNK2cl4sycl7sampler12has_propertyINS0_8property5image12use_host_ptrEEEbv
@@ -4223,6 +4228,7 @@ _ZNK2cl4sycl7sampler12has_propertyINS0_8property6buffer13context_boundEEEbv
42234228
_ZNK2cl4sycl7sampler12has_propertyINS0_8property6buffer9use_mutexEEEbv
42244229
_ZNK2cl4sycl7sampler12has_propertyINS0_8property6noinitEEEbv
42254230
_ZNK2cl4sycl7sampler12has_propertyINS0_8property7context4cuda19use_primary_contextEEEbv
4231+
_ZNK2cl4sycl7sampler12has_propertyINS0_8property7no_initEEEbv
42264232
_ZNK2cl4sycl7sampler12has_propertyINS0_8property9reduction22initialize_to_identityEEEbv
42274233
_ZNK2cl4sycl7sampler18get_filtering_modeEv
42284234
_ZNK2cl4sycl7sampler19get_addressing_modeEv

sycl/test/basic_tests/accessor/accessor_property_list_ct.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int main() {
4545

4646
{
4747
// Property list copy
48-
accessor_property_list PL{no_alias, sycl::noinit};
48+
accessor_property_list PL{no_alias, sycl::no_init};
4949

5050
accessor_property_list PL_1{PL};
5151
static_assert(PL_1.has_property<property::no_alias>(),
@@ -108,7 +108,7 @@ int main() {
108108
sycl::buffer<int, 1> buf_data(data, sycl::range<1>(1),
109109
{sycl::property::buffer::use_host_ptr()});
110110

111-
accessor_property_list PL{sycl::noinit, no_alias};
111+
accessor_property_list PL{sycl::no_init, no_alias};
112112
sycl::accessor acc_1(buf_data, PL);
113113
sycl::accessor<int, 1, sycl::access::mode::read_write,
114114
sycl::access::target::global_buffer,

sycl/test/basic_tests/accessor/accessor_property_list_rt.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,27 @@
88
using namespace sycl::ONEAPI;
99

1010
int main() {
11+
{
12+
// Single RT property
13+
accessor_property_list PL{sycl::no_init};
14+
static_assert(!PL.has_property<property::no_offset>(), "Property is found");
15+
assert(PL.has_property<sycl::property::no_init>() && "Property not found");
16+
}
17+
1118
{
1219
// Single RT property
1320
accessor_property_list PL{sycl::noinit};
1421
static_assert(!PL.has_property<property::no_offset>(), "Property is found");
1522
assert(PL.has_property<sycl::property::noinit>() && "Property not found");
1623
}
1724

25+
{
26+
// Compile time and runtime properties
27+
accessor_property_list PL{sycl::no_init, no_alias};
28+
assert(PL.has_property<property::no_alias>() && "Property not found");
29+
assert(PL.has_property<sycl::property::no_init>() && "Property not found");
30+
}
31+
1832
{
1933
// Compile time and runtime properties
2034
accessor_property_list PL{sycl::noinit, no_alias};

0 commit comments

Comments
 (0)