From 5449c70ec02ecca8834a20d0c5a22a2977ede42e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 19:08:31 +0100 Subject: [PATCH] Fix GPU test failures: PCA (#2531) (#2532) * Fix PCA tests * Apply clang-format (cherry picked from commit ad79276b2218aa0be96390e73cd4fb4d3cc4bc9b) Co-authored-by: Dmitriy Ovchinnikov <117165790+inteldimitrius@users.noreply.github.com> --- .../dal/algo/pca/backend/cpu/train_kernel_precomputed.cpp | 3 +++ .../dal/algo/pca/backend/gpu/train_kernel_cov_impl_dpc.cpp | 4 ++-- .../pca/backend/gpu/train_kernel_precomputed_impl_dpc.cpp | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/oneapi/dal/algo/pca/backend/cpu/train_kernel_precomputed.cpp b/cpp/oneapi/dal/algo/pca/backend/cpu/train_kernel_precomputed.cpp index 91d7ee93f69..2349b4ab8b7 100644 --- a/cpp/oneapi/dal/algo/pca/backend/cpu/train_kernel_precomputed.cpp +++ b/cpp/oneapi/dal/algo/pca/backend/cpu/train_kernel_precomputed.cpp @@ -79,6 +79,9 @@ static result_t call_daal_kernel(const context_cpu& ctx, *daal_means, *daal_variances)); + if (desc.get_result_options().test(result_options::vars)) { + result.set_variances(homogen_table::wrap(arr_vars, 1, column_count)); + } if (desc.get_result_options().test(result_options::eigenvectors)) { const auto mdl = model_t{}.set_eigenvectors( homogen_table::wrap(arr_eigvec, component_count, column_count)); diff --git a/cpp/oneapi/dal/algo/pca/backend/gpu/train_kernel_cov_impl_dpc.cpp b/cpp/oneapi/dal/algo/pca/backend/gpu/train_kernel_cov_impl_dpc.cpp index 04c2146e414..bc98f92cd57 100644 --- a/cpp/oneapi/dal/algo/pca/backend/gpu/train_kernel_cov_impl_dpc.cpp +++ b/cpp/oneapi/dal/algo/pca/backend/gpu/train_kernel_cov_impl_dpc.cpp @@ -154,7 +154,6 @@ template result_t train_kernel_cov_impl::operator()(const descriptor_t& desc, const input_t& input) { ONEDAL_ASSERT(input.get_data().has_data()); const auto data = input.get_data(); - std::int64_t row_count = data.get_row_count(); auto rows_count_global = row_count; ONEDAL_ASSERT(data.get_column_count() > 0); @@ -194,7 +193,8 @@ result_t train_kernel_cov_impl::operator()(const descriptor_t& desc, cons auto [cov, cov_event] = compute_covariance(q_, rows_count_global, xtx, sums, { gemm_event }); if (desc.get_result_options().test(result_options::vars)) { - auto [vars, vars_event] = compute_variances(q_, cov, { gemm_event }); + auto [vars, vars_event] = compute_variances(q_, cov, { cov_event }); + vars_event.wait_and_throw(); result.set_variances(homogen_table::wrap(vars.flatten(q_), 1, column_count)); } if (desc.get_result_options().test(result_options::eigenvectors | diff --git a/cpp/oneapi/dal/algo/pca/backend/gpu/train_kernel_precomputed_impl_dpc.cpp b/cpp/oneapi/dal/algo/pca/backend/gpu/train_kernel_precomputed_impl_dpc.cpp index d1add31a346..9c4b4439e9f 100644 --- a/cpp/oneapi/dal/algo/pca/backend/gpu/train_kernel_precomputed_impl_dpc.cpp +++ b/cpp/oneapi/dal/algo/pca/backend/gpu/train_kernel_precomputed_impl_dpc.cpp @@ -63,7 +63,6 @@ auto compute_eigenvectors_on_host(sycl::queue& q, std::int64_t component_count, const dal::backend::event_vector& deps = {}) { ONEDAL_PROFILER_TASK(compute_eigenvectors_on_host); - ONEDAL_ASSERT(corr.has_mutable_data()); ONEDAL_ASSERT(corr.get_dimension(0) == corr.get_dimension(1), "Correlation matrix must be square"); ONEDAL_ASSERT(corr.get_dimension(0) > 0);