Skip to content

Commit a9b3acd

Browse files
committed
Readd copy ctor
Signed-off-by: Larsen, Steffen <[email protected]>
1 parent eca9cad commit a9b3acd

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_device_global.asciidoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,19 @@ The object of type `T` is initialized from the `args` parameter pack using list
335335

336336
`T` must be trivially destructible.
337337

338+
// --- ROW BREAK ---
339+
a|
340+
[source,c++]
341+
----
342+
constexpr device_global(const device_global &other);
343+
----
344+
|
345+
Available if `PropertyListT::has_property<device_image_scope_key>() == false`.
346+
347+
Constructs a `device_global` object, and implicit storage for `T` in the global address space on each device that may access it.
348+
349+
The storage on each device for `T` is initialized with a copy of the storage in `other`.
350+
338351
// --- ROW BREAK ---
339352
a|
340353
[source,c++]

sycl/include/sycl/ext/oneapi/device_global/device_global.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ class
226226
// Inherit the base class' constructors
227227
using detail::device_global_base<T, property_list_t>::device_global_base;
228228

229+
constexpr device_global(const device_global &DG)
230+
: base_t(static_cast<const base_t &>(DG)) {}
231+
229232
device_global(const device_global &&) = delete;
230233
device_global &operator=(const device_global &) = delete;
231234
device_global &operator=(const device_global &&) = delete;

sycl/test/extensions/device_global/device_global_copy_negative.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ namespace oneapiext = sycl::ext::oneapi::experimental;
1010
using device_image_properties =
1111
decltype(oneapiext::properties{oneapiext::device_image_scope});
1212

13-
// expected-error@+2 {{call to implicitly-deleted copy constructor of}}
13+
// expected-error@sycl/ext/oneapi/device_global/device_global.hpp:* {{call to deleted constructor}}
1414
oneapiext::device_global<const int, device_image_properties> DGInit1{3};
1515
oneapiext::device_global<const int, device_image_properties> DGCopy1{DGInit1};
1616

17-
// expected-error@+2 {{call to implicitly-deleted copy constructor of}}
17+
// expected-error@sycl/ext/oneapi/device_global/device_global.hpp:* {{call to deleted constructor}}
1818
oneapiext::device_global<int, device_image_properties> DGInit2{3};
1919
oneapiext::device_global<int, device_image_properties> DGCopy2{DGInit2};
2020

0 commit comments

Comments
 (0)