Skip to content

Commit 1ced1a7

Browse files
Merge pull request #1960 from IntelPython/avoid-copy-in-triul-ctor-host-task
Avoid copy in triul ctor host task
2 parents 9f8f90b + a873743 commit 1ced1a7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

dpctl/tensor/libtensor/source/triul_ctor.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@
2222
/// This file defines functions of dpctl.tensor._tensor_impl extensions
2323
//===--------------------------------------------------------------------===//
2424

25-
#include <cstddef>
26-
#include <stdexcept>
25+
#include <algorithm> // for std::copy
26+
#include <cstddef> // for std::size_t
27+
#include <memory> // for std::make_shared
28+
#include <stdexcept> // for std::runtime_error
29+
#include <utility> // for std::pair, std::move
30+
#include <vector> // for std::vector, std::begin, std::end
31+
2732
#include <sycl/sycl.hpp>
28-
#include <utility>
29-
#include <vector>
3033

3134
#include "dpctl4pybind11.hpp"
3235
#include <pybind11/pybind11.h>
@@ -206,7 +209,8 @@ usm_ndarray_triul(sycl::queue &exec_q,
206209
const auto &ctx = exec_q.get_context();
207210
using dpctl::tensor::alloc_utils::sycl_free_noexcept;
208211
cgh.host_task(
209-
[shp_host_shape_and_strides, dev_shape_and_strides, ctx]() {
212+
[shp_host_shape_and_strides = std::move(shp_host_shape_and_strides),
213+
dev_shape_and_strides, ctx]() {
210214
// capture of shp_host_shape_and_strides ensure the underlying
211215
// vector exists for the entire execution of copying kernel
212216
sycl_free_noexcept(dev_shape_and_strides, ctx);

0 commit comments

Comments
 (0)