-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve performance of the native BsrMatrix SpMV, especially for sing…
…le-vector cases. * Adds a new `"v4.2"` BsrMatrix SpMV implementation for non-transpose mode. * It is the default (when TPLs are disabled or not supported) on the GPU for non-transpose mode * The old implementation is retained for all other modes * old implementation may be requested explicitly with `controls.setParameter("algorithm", "v4.1")` * Adds explicit invocation of old "4.1" impl to `KokkosKernels_sparse_spmv_bsr_benchmark` * When TPLs are enabled, the new implementation may be requested anyway with `controls.setParameter("algorithm", "v4.2")` * simplify `KokkosKernels::Impl::always_false_v` * Add `template <typename View> class with_unmanaged` which provides a `type` alias reproducing `View` with `Kokkos::Unmanaged` added to its memory traits * Add `KokkosKernels::Impl::with_unmanaged_t` as an alias for `typename with_unamanged::type` * Add `template <typename View> auto KokkosKernels::Impl:make_unmanaged(const View &v)` which constructs a `with_unmanaged_t<View>` from v * Add `<sstream>` to `KokkosKernels_Error.hpp` * Add `DieOnError` and `SkipOnError` wrapped `bool`s to give names to boolean function arguments * Link `KokkosKernels_sparse_spmv_bsr_benchmark` against `stdc++fs` for rocm 5.2 * More aggressive block size filtering in `KokkosSparse_csr_detect_block_size.hpp` * Removes a useless warning from `Controls::getParameter` since what happens when a parameter is unset was made explicit in be87154 * `BsrMatrix` constructor throws when combination of nnz, rows, and columns don't make sense * Change `BsrMatrix::block_layout` to `BsrMatrix::block_layout_type` for consistency * Adds `BsrMatrix::unmanaged_block` to return an unmanged view to a 2D block of values * Adds `BsrMatrix::unmanaged_block_const` to return a const unmanged view to a 2D block of values
- Loading branch information
Showing
15 changed files
with
477 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// Kokkos v. 4.0 | ||
// Copyright (2022) National Technology & Engineering | ||
// Solutions of Sandia, LLC (NTESS). | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, | ||
// the U.S. Government retains certain rights in this software. | ||
// | ||
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://kokkos.org/LICENSE for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//@HEADER | ||
|
||
#ifndef KOKKOSKERNELS_VIEWUTILS_HPP | ||
#define KOKKOSKERNELS_VIEWUTILS_HPP | ||
#include "Kokkos_Core.hpp" | ||
|
||
namespace KokkosKernels::Impl { | ||
|
||
/*! \brief Yields a type that is View with Kokkos::Unmanaged added to the memory | ||
* traits | ||
*/ | ||
template <typename View> | ||
class with_unmanaged { | ||
using data_type = typename View::data_type; | ||
using layout_type = typename View::array_layout; | ||
using memory_space = typename View::memory_space; | ||
|
||
using orig_traits = typename View::memory_traits; | ||
static constexpr unsigned new_traits = | ||
orig_traits::impl_value | Kokkos::Unmanaged; | ||
|
||
public: | ||
using type = Kokkos::View<data_type, layout_type, memory_space, | ||
Kokkos::MemoryTraits<new_traits> >; | ||
}; | ||
|
||
/*! \brief A type that is View with Kokkos::Unmanaged added to the memory traits | ||
\tparam View the type to add Kokkos::Unmanaged to | ||
*/ | ||
template <typename View> | ||
using with_unmanaged_t = typename with_unmanaged<View>::type; | ||
|
||
/*! \brief Returns an unmanaged version of v | ||
\tparam View the type of the input view v | ||
*/ | ||
template <typename View> | ||
auto make_unmanaged(const View &v) { | ||
return typename with_unmanaged<View>::type(v); | ||
} | ||
|
||
} // namespace KokkosKernels::Impl | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// Kokkos v. 4.0 | ||
// Copyright (2022) National Technology & Engineering | ||
// Solutions of Sandia, LLC (NTESS). | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, | ||
// the U.S. Government retains certain rights in this software. | ||
// | ||
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://kokkos.org/LICENSE for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//@HEADER | ||
*/ | ||
|
||
#ifndef KOKKOSKERNELS_PERFTEST_BENCHMARK_UTILS_HPP | ||
#define KOKKOSKERNELS_PERFTEST_BENCHMARK_UTILS_HPP | ||
|
||
namespace KokkosKernelsBenchmark { | ||
|
||
class WrappedBool { | ||
public: | ||
WrappedBool(const bool &val) : val_(val) {} | ||
|
||
operator bool() const { return val_; } | ||
|
||
protected: | ||
bool val_; | ||
}; | ||
|
||
class DieOnError : public WrappedBool { | ||
public: | ||
DieOnError(const bool &val) : WrappedBool(val) {} | ||
}; | ||
class SkipOnError : public WrappedBool { | ||
public: | ||
SkipOnError(const bool &val) : WrappedBool(val) {} | ||
}; | ||
|
||
} // namespace KokkosKernelsBenchmark | ||
|
||
#endif // KOKKOSKERNELS_PERFTEST_BENCHMARK_UTILS_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.