File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,15 @@ template <typename AllocatorT> class buffer_impl : public SYCLMemObjT {
227
227
};
228
228
}
229
229
230
+ template <template <typename T> class C , typename T>
231
+ void set_final_data (
232
+ C<T> FinalData,
233
+ typename std::enable_if<
234
+ std::is_convertible<C<T>, weak_ptr_class<T>>::value>::type * = 0 ) {
235
+ weak_ptr_class<T> WeakFinalData (FinalData);
236
+ set_final_data (WeakFinalData);
237
+ }
238
+
230
239
template <typename Destination>
231
240
void set_final_data (
232
241
Destination FinalData,
Original file line number Diff line number Diff line change @@ -191,6 +191,22 @@ int main() {
191
191
std::weak_ptr<int > resultWeak = result;
192
192
Buffer.set_final_data (resultWeak);
193
193
queue myQueue;
194
+ myQueue.submit ([&](handler &cgh) {
195
+ auto B = Buffer.get_access <access::mode::write>(cgh);
196
+ cgh.parallel_for <class weakPointer >(
197
+ range<1 >{10 }, [=](id<1 > index) { B[index] = 1 ; });
198
+ });
199
+ }
200
+ checkAllOf (result.get (), 10 , 1 , __LINE__);
201
+ }
202
+
203
+ {
204
+ int data[10 ] = {0 };
205
+ std::shared_ptr<int > result (new int [10 ]());
206
+ {
207
+ buffer<int , 1 > Buffer (data, range<1 >(10 ));
208
+ Buffer.set_final_data (result);
209
+ queue myQueue;
194
210
myQueue.submit ([&](handler &cgh) {
195
211
auto B = Buffer.get_access <access::mode::write>(cgh);
196
212
cgh.parallel_for <class sharedPointer >(
You can’t perform that action at this time.
0 commit comments