]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/compute/algorithm/copy.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / compute / algorithm / copy.hpp
index 53b26d4df1f23a477e8f88758840c5fdf30bbfc9..b72aaa52d7864f895526d1c82da0212049521b47 100644 (file)
@@ -103,6 +103,7 @@ dispatch_copy_async(InputIterator first,
                     InputIterator last,
                     OutputIterator result,
                     command_queue &queue,
+                    const wait_list &events,
                     typename boost::enable_if<
                         mpl::and_<
                             mpl::not_<
@@ -118,7 +119,7 @@ dispatch_copy_async(InputIterator first,
         "copy_async() is only supported for contiguous host iterators"
     );
 
-    return copy_to_device_async(first, last, result, queue);
+    return copy_to_device_async(first, last, result, queue, events);
 }
 
 // host -> device (async)
@@ -129,6 +130,7 @@ dispatch_copy_async(InputIterator first,
                     InputIterator last,
                     OutputIterator result,
                     command_queue &queue,
+                    const wait_list &events,
                     typename boost::enable_if<
                         mpl::and_<
                             mpl::not_<
@@ -167,7 +169,7 @@ dispatch_copy_async(InputIterator first,
         context
     );
     return copy_on_device_async(
-        mapped_host.begin(), mapped_host.end(), result, queue
+        mapped_host.begin(), mapped_host.end(), result, queue, events
     );
 }
 
@@ -179,6 +181,7 @@ dispatch_copy(InputIterator first,
               InputIterator last,
               OutputIterator result,
               command_queue &queue,
+              const wait_list &events,
               typename boost::enable_if<
                   mpl::and_<
                       mpl::not_<
@@ -190,7 +193,7 @@ dispatch_copy(InputIterator first,
                   >
               >::type* = 0)
 {
-    return copy_to_device(first, last, result, queue);
+    return copy_to_device(first, last, result, queue, events);
 }
 
 // host -> device
@@ -202,6 +205,7 @@ dispatch_copy(InputIterator first,
               InputIterator last,
               OutputIterator result,
               command_queue &queue,
+              const wait_list &events,
               typename boost::enable_if<
                   mpl::and_<
                       mpl::not_<
@@ -258,13 +262,15 @@ dispatch_copy(InputIterator first,
 
     // [0; map_copy_threshold) -> copy_to_device_map()
     if(input_size_bytes < map_copy_threshold) {
-        return copy_to_device_map(first, last, result, queue);
+        return copy_to_device_map(first, last, result, queue, events);
     }
     // [map_copy_threshold; direct_copy_threshold) -> convert [first; last)
     //     on host and then perform copy_to_device()
     else if(input_size_bytes < direct_copy_threshold) {
         std::vector<output_type> vector(first, last);
-        return copy_to_device(vector.begin(), vector.end(), result, queue);
+        return copy_to_device(
+            vector.begin(), vector.end(), result, queue, events
+        );
     }
 
     // [direct_copy_threshold; inf) -> map [first; last) to device and
@@ -275,7 +281,7 @@ dispatch_copy(InputIterator first,
     // return the result.
     // At this point we are sure that count > 1 (first != last), so event
     // returned by dispatch_copy_async() must be valid.
-    return dispatch_copy_async(first, last, result, queue).get();
+    return dispatch_copy_async(first, last, result, queue, events).get();
 }
 
 // host -> device
@@ -286,6 +292,7 @@ dispatch_copy(InputIterator first,
               InputIterator last,
               OutputIterator result,
               command_queue &queue,
+              const wait_list &events,
               typename boost::enable_if<
                   mpl::and_<
                       mpl::not_<
@@ -345,12 +352,12 @@ dispatch_copy(InputIterator first,
     // copy_to_device_map() is used for every input
     if(input_size_bytes < map_copy_threshold
         || direct_copy_threshold <= map_copy_threshold) {
-        return copy_to_device_map(first, last, result, queue);
+        return copy_to_device_map(first, last, result, queue, events);
     }
     // [map_copy_threshold; inf) -> convert [first; last)
     //     on host and then perform copy_to_device()
     std::vector<output_type> vector(first, last);
-    return copy_to_device(vector.begin(), vector.end(), result, queue);
+    return copy_to_device(vector.begin(), vector.end(), result, queue, events);
 }
 
 // device -> host (async)
@@ -360,6 +367,7 @@ dispatch_copy_async(InputIterator first,
                     InputIterator last,
                     OutputIterator result,
                     command_queue &queue,
+                    const wait_list &events,
                     typename boost::enable_if<
                         mpl::and_<
                             is_device_iterator<InputIterator>,
@@ -375,7 +383,7 @@ dispatch_copy_async(InputIterator first,
         "copy_async() is only supported for contiguous host iterators"
     );
 
-    return copy_to_host_async(first, last, result, queue);
+    return copy_to_host_async(first, last, result, queue, events);
 }
 
 // device -> host (async)
@@ -386,6 +394,7 @@ dispatch_copy_async(InputIterator first,
                     InputIterator last,
                     OutputIterator result,
                     command_queue &queue,
+                    const wait_list &events,
                     typename boost::enable_if<
                         mpl::and_<
                             is_device_iterator<InputIterator>,
@@ -426,7 +435,8 @@ dispatch_copy_async(InputIterator first,
             first,
             last,
             make_buffer_iterator<output_type>(mapped_host),
-            queue
+            queue,
+            events
         );
     // update host memory asynchronously by maping and unmaping memory
     event map_event;
@@ -451,6 +461,7 @@ dispatch_copy(InputIterator first,
               InputIterator last,
               OutputIterator result,
               command_queue &queue,
+              const wait_list &events,
               typename boost::enable_if<
                   mpl::and_<
                       is_device_iterator<InputIterator>,
@@ -465,7 +476,7 @@ dispatch_copy(InputIterator first,
                   >
               >::type* = 0)
 {
-    return copy_to_host(first, last, result, queue);
+    return copy_to_host(first, last, result, queue, events);
 }
 
 // device -> host
@@ -478,6 +489,7 @@ dispatch_copy(InputIterator first,
               InputIterator last,
               OutputIterator result,
               command_queue &queue,
+              const wait_list &events,
               typename boost::enable_if<
                   mpl::and_<
                       is_device_iterator<InputIterator>,
@@ -540,12 +552,12 @@ dispatch_copy(InputIterator first,
     // copy_to_host_map() is used for every input
     if(input_size_bytes < map_copy_threshold
         || direct_copy_threshold <= map_copy_threshold) {
-        return copy_to_host_map(first, last, result, queue);
+        return copy_to_host_map(first, last, result, queue, events);
     }
     // [map_copy_threshold; inf) -> copy [first;last) to temporary vector
     //     then copy (and convert) to result using std::copy()
     std::vector<input_type> vector(count);
-    copy_to_host(first, last, vector.begin(), queue);
+    copy_to_host(first, last, vector.begin(), queue, events);
     return std::copy(vector.begin(), vector.end(), result);
 }
 
@@ -559,6 +571,7 @@ dispatch_copy(InputIterator first,
               InputIterator last,
               OutputIterator result,
               command_queue &queue,
+              const wait_list &events,
               typename boost::enable_if<
                   mpl::and_<
                       is_device_iterator<InputIterator>,
@@ -618,13 +631,13 @@ dispatch_copy(InputIterator first,
 
     // [0; map_copy_threshold) -> copy_to_host_map()
     if(input_size_bytes < map_copy_threshold) {
-        return copy_to_host_map(first, last, result, queue);
+        return copy_to_host_map(first, last, result, queue, events);
     }
     // [map_copy_threshold; direct_copy_threshold) -> copy [first;last) to
     //     temporary vector then copy (and convert) to result using std::copy()
     else if(input_size_bytes < direct_copy_threshold) {
         std::vector<input_type> vector(count);
-        copy_to_host(first, last, vector.begin(), queue);
+        copy_to_host(first, last, vector.begin(), queue, events);
         return std::copy(vector.begin(), vector.end(), result);
     }
 
@@ -636,7 +649,7 @@ dispatch_copy(InputIterator first,
     // return the result.
     // At this point we are sure that count > 1 (first != last), so event
     // returned by dispatch_copy_async() must be valid.
-    return dispatch_copy_async(first, last, result, queue).get();
+    return dispatch_copy_async(first, last, result, queue, events).get();
 }
 
 // device -> device
@@ -646,6 +659,7 @@ dispatch_copy(InputIterator first,
               InputIterator last,
               OutputIterator result,
               command_queue &queue,
+              const wait_list &events,
               typename boost::enable_if<
                   mpl::and_<
                       is_device_iterator<InputIterator>,
@@ -658,7 +672,7 @@ dispatch_copy(InputIterator first,
                   >
               >::type* = 0)
 {
-    return copy_on_device(first, last, result, queue);
+    return copy_on_device(first, last, result, queue, events);
 }
 
 // device -> device (specialization for buffer iterators)
@@ -668,6 +682,7 @@ dispatch_copy(InputIterator first,
               InputIterator last,
               OutputIterator result,
               command_queue &queue,
+              const wait_list &events,
               typename boost::enable_if<
                   mpl::and_<
                       is_device_iterator<InputIterator>,
@@ -691,7 +706,8 @@ dispatch_copy(InputIterator first,
                               result.get_buffer(),
                               first.get_index() * sizeof(value_type),
                               result.get_index() * sizeof(value_type),
-                              static_cast<size_t>(n) * sizeof(value_type));
+                              static_cast<size_t>(n) * sizeof(value_type),
+                              events);
     return result + n;
 }
 
@@ -702,6 +718,7 @@ dispatch_copy_async(InputIterator first,
                     InputIterator last,
                     OutputIterator result,
                     command_queue &queue,
+                    const wait_list &events,
                     typename boost::enable_if<
                         mpl::and_<
                             is_device_iterator<InputIterator>,
@@ -714,7 +731,7 @@ dispatch_copy_async(InputIterator first,
                         >
                     >::type* = 0)
 {
-    return copy_on_device_async(first, last, result, queue);
+    return copy_on_device_async(first, last, result, queue, events);
 }
 
 // device -> device (async, specialization for buffer iterators)
@@ -724,6 +741,7 @@ dispatch_copy_async(InputIterator first,
                     InputIterator last,
                     OutputIterator result,
                     command_queue &queue,
+                    const wait_list &events,
                     typename boost::enable_if<
                         mpl::and_<
                             is_device_iterator<InputIterator>,
@@ -749,7 +767,8 @@ dispatch_copy_async(InputIterator first,
             result.get_buffer(),
             first.get_index() * sizeof(value_type),
             result.get_index() * sizeof(value_type),
-            static_cast<size_t>(n) * sizeof(value_type)
+            static_cast<size_t>(n) * sizeof(value_type),
+            events
         );
 
     return make_future(result + n, event_);
@@ -762,12 +781,14 @@ dispatch_copy(InputIterator first,
               InputIterator last,
               OutputIterator result,
               command_queue &queue,
+              const wait_list &events,
               typename boost::enable_if_c<
                   !is_device_iterator<InputIterator>::value &&
                   !is_device_iterator<OutputIterator>::value
               >::type* = 0)
 {
     (void) queue;
+    (void) events;
 
     return std::copy(first, last, result);
 }
@@ -833,9 +854,10 @@ template<class InputIterator, class OutputIterator>
 inline OutputIterator copy(InputIterator first,
                            InputIterator last,
                            OutputIterator result,
-                           command_queue &queue = system::default_queue())
+                           command_queue &queue = system::default_queue(),
+                           const wait_list &events = wait_list())
 {
-    return detail::dispatch_copy(first, last, result, queue);
+    return detail::dispatch_copy(first, last, result, queue, events);
 }
 
 /// Copies the values in the range [\p first, \p last) to the range
@@ -847,9 +869,10 @@ inline future<OutputIterator>
 copy_async(InputIterator first,
            InputIterator last,
            OutputIterator result,
-           command_queue &queue = system::default_queue())
+           command_queue &queue = system::default_queue(),
+           const wait_list &events = wait_list())
 {
-    return detail::dispatch_copy_async(first, last, result, queue);
+    return detail::dispatch_copy_async(first, last, result, queue, events);
 }
 
 } // end compute namespace