From 2b15e8aaeee1a9c53a13f5746d2e612c05b2ca2a Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Fri, 4 Mar 2022 14:47:43 +0100 Subject: [PATCH] initiate Dense cross-executor copy from source This means that padding in the target will be copied and written back after the copy has finished. This fixes issues in builds without OpenMP executor and reference/test/matrix/dense_kernels --- core/matrix/dense.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/core/matrix/dense.cpp b/core/matrix/dense.cpp index ae0bfe0f04a..bef9bc4ff0c 100644 --- a/core/matrix/dense.cpp +++ b/core/matrix/dense.cpp @@ -322,19 +322,17 @@ void Dense::convert_to(Dense* result) const if (result->get_size() != this->get_size()) { result->resize(this->get_size()); } - // we need to create a clone of the local data, so the target executor can - // copy it. - auto result_exec = result->get_executor(); - auto result_input = make_temporary_clone(result_exec, &values_); + // we need to create a temporary clone of the target data to write to + auto exec = this->get_executor(); + auto result_output = make_temporary_clone(exec, &result->values_); // create a (value, not pointer to avoid allocation overhead) view // matrix on the array to avoid special-casing cross-executor copies - auto tmp_this = Dense{ - result_exec, this->get_size(), - gko::detail::array_const_cast(gko::detail::ConstArrayView( - result_exec, result_input->get_num_elems(), - result_input->get_const_data())), - this->get_stride()}; - result_exec->run(dense::make_copy(&tmp_this, result)); + auto tmp_result = + Dense{exec, this->get_size(), + make_array_view(exec, result_output->get_num_elems(), + result_output->get_data()), + result->get_stride()}; + exec->run(dense::make_copy(this, &tmp_result)); }