From d0410d07828e6cd637732f64534b4bfbf02294f8 Mon Sep 17 00:00:00 2001 From: aurianer Date: Thu, 19 Sep 2024 14:16:59 +0200 Subject: [PATCH] Combine the two definition of getMatrixLayout --- include/dlaf/permutations/general/impl.h | 25 ++++++------------------ 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/include/dlaf/permutations/general/impl.h b/include/dlaf/permutations/general/impl.h index 8cd94800de..8e643ea8c7 100644 --- a/include/dlaf/permutations/general/impl.h +++ b/include/dlaf/permutations/general/impl.h @@ -133,29 +133,16 @@ void applyPermutationOnCPU( #if defined(DLAF_WITH_GPU) -template -MatrixLayout getMatrixLayout(const matrix::Distribution& distr, - const std::vector>& tiles) { +template +MatrixLayout getMatrixLayout(const matrix::Distribution& distr, const std::vector& tiles) { LocalTileSize tile_sz = distr.localNrTiles(); MatrixLayout layout; layout.nb = distr.blockSize().rows(); - layout.ld = tiles[0].ld(); - layout.row_offset = (tile_sz.rows() > 1) ? tiles[1].ptr() - tiles[0].ptr() : 0; - layout.col_offset = (tile_sz.cols() > 1) ? tiles[to_sizet(tile_sz.rows())].ptr() - tiles[0].ptr() : 0; - return layout; -} - -template -MatrixLayout getMatrixLayout( - const matrix::Distribution& distr, - const std::vector>& tiles) { - const LocalTileSize tile_sz = distr.localNrTiles(); - MatrixLayout layout; - layout.nb = distr.blockSize().rows(); - layout.ld = tiles[0].get().ld(); - layout.row_offset = (tile_sz.rows() > 1) ? tiles[1].get().ptr() - tiles[0].get().ptr() : 0; + using dlaf::common::internal::unwrap; + layout.ld = unwrap(tiles[0]).ld(); + layout.row_offset = (tile_sz.rows() > 1) ? unwrap(tiles[1]).ptr() - unwrap(tiles[0]).ptr() : 0; layout.col_offset = - (tile_sz.cols() > 1) ? tiles[to_sizet(tile_sz.rows())].get().ptr() - tiles[0].get().ptr() : 0; + (tile_sz.cols() > 1) ? unwrap(tiles[to_sizet(tile_sz.rows())]).ptr() - unwrap(tiles[0]).ptr() : 0; return layout; }