Debian Codegraph @

packages/kokkos-kernels/batched/dense/impl/KokkosBatched_Trsv_Team_Impl.hpp

raw
1 //@HEADER
2 // ************************************************************************
3 //
4 // Kokkos v. 4.0
5 // Copyright (2022) National Technology & Engineering
6 // Solutions of Sandia, LLC (NTESS).
7 //
8 // Under the terms of Contract DE-NA0003525 with NTESS,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
12 // See https://kokkos.org/LICENSE for license information.
13 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14 //
15 //@HEADER
16 #ifndef KOKKOSBATCHED_TRSV_TEAM_IMPL_HPP
17 #define KOKKOSBATCHED_TRSV_TEAM_IMPL_HPP
18
19 /// \author Kyungjoo Kim ([email protected])
20
21 #include "KokkosBatched_Util.hpp"
22 #include "KokkosBatched_Trsv_Team_Internal.hpp"
23
24 namespace KokkosBatched {
25 ///
26 /// Team Impl
27 /// ===========
28
29 ///
30 /// Implemented:
31 /// L/NT, U/NT, L/T, U/T
32 ///
33 /// Not yet implemented
34 /// L/CT, U/CT
35
36 ///
37 /// L/NT
38 ///
39
40 template <typename MemberType, typename ArgDiag>
41 struct TeamTrsv<MemberType, Uplo::Lower, Trans::NoTranspose, ArgDiag, Algo::Trsv::Unblocked> {
42 template <typename ScalarType, typename AViewType, typename bViewType>
43 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A,
44 const bViewType &b) {
45 return TeamTrsvInternalLower<Algo::Trsv::Unblocked>::invoke(member, ArgDiag::use_unit_diag, A.extent(0), alpha,
46 A.data(), A.stride_0(), A.stride_1(), b.data(),
47 b.stride_0());
48 }
49 };
50
51 template <typename MemberType, typename ArgDiag>
52 struct TeamTrsv<MemberType, Uplo::Lower, Trans::NoTranspose, ArgDiag, Algo::Trsv::Blocked> {
53 template <typename ScalarType, typename AViewType, typename bViewType>
54 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A,
55 const bViewType &b) {
56 return TeamTrsvInternalLower<Algo::Trsv::Blocked>::invoke(member, ArgDiag::use_unit_diag, A.extent(0), alpha,
57 A.data(), A.stride_0(), A.stride_1(), b.data(),
58 b.stride_0());
59 }
60 };
61
62 ///
63 /// L/T
64 ///
65
66 template <typename MemberType, typename ArgDiag>
67 struct TeamTrsv<MemberType, Uplo::Lower, Trans::Transpose, ArgDiag, Algo::Trsv::Unblocked> {
68 template <typename ScalarType, typename AViewType, typename bViewType>
69 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A,
70 const bViewType &b) {
71 return TeamTrsvInternalUpper<Algo::Trsv::Unblocked>::invoke(member, ArgDiag::use_unit_diag, A.extent(1), alpha,
72 A.data(), A.stride_1(), A.stride_0(), b.data(),
73 b.stride_0());
74 }
75 };
76
77 template <typename MemberType, typename ArgDiag>
78 struct TeamTrsv<MemberType, Uplo::Lower, Trans::Transpose, ArgDiag, Algo::Trsv::Blocked> {
79 template <typename ScalarType, typename AViewType, typename bViewType>
80 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType & /*member*/, const ScalarType alpha, const AViewType &A,
81 const bViewType &b) {
82 return TeamTrsvInternalUpper<Algo::Trsv::Blocked>::invoke(ArgDiag::use_unit_diag, A.extent(1), alpha, A.data(),
83 A.stride_1(), A.stride_0(), b.data(), b.stride_0());
84 }
85 };
86
87 ///
88 /// U/NT
89 ///
90
91 template <typename MemberType, typename ArgDiag>
92 struct TeamTrsv<MemberType, Uplo::Upper, Trans::NoTranspose, ArgDiag, Algo::Trsv::Unblocked> {
93 template <typename ScalarType, typename AViewType, typename bViewType>
94 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A,
95 const bViewType &b) {
96 return TeamTrsvInternalUpper<Algo::Trsv::Unblocked>::invoke(member, ArgDiag::use_unit_diag, A.extent(0), alpha,
97 A.data(), A.stride_0(), A.stride_1(), b.data(),
98 b.stride_0());
99 }
100 };
101
102 template <typename MemberType, typename ArgDiag>
103 struct TeamTrsv<MemberType, Uplo::Upper, Trans::NoTranspose, ArgDiag, Algo::Trsv::Blocked> {
104 template <typename ScalarType, typename AViewType, typename bViewType>
105 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A,
106 const bViewType &b) {
107 return TeamTrsvInternalUpper<Algo::Trsv::Blocked>::invoke(member, ArgDiag::use_unit_diag, A.extent(0), alpha,
108 A.data(), A.stride_0(), A.stride_1(), b.data(),
109 b.stride_0());
110 }
111 };
112
113 ///
114 /// U/T
115 ///
116
117 template <typename MemberType, typename ArgDiag>
118 struct TeamTrsv<MemberType, Uplo::Upper, Trans::Transpose, ArgDiag, Algo::Trsv::Unblocked> {
119 template <typename ScalarType, typename AViewType, typename bViewType>
120 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A,
121 const bViewType &b) {
122 return TeamTrsvInternalLower<Algo::Trsv::Unblocked>::invoke(member, ArgDiag::use_unit_diag, A.extent(1), alpha,
123 A.data(), A.stride_1(), A.stride_0(), b.data(),
124 b.stride_0());
125 }
126 };
127
128 template <typename MemberType, typename ArgDiag>
129 struct TeamTrsv<MemberType, Uplo::Upper, Trans::Transpose, ArgDiag, Algo::Trsv::Blocked> {
130 template <typename ScalarType, typename AViewType, typename bViewType>
131 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A,
132 const bViewType &b) {
133 return TeamTrsvInternalLower<Algo::Trsv::Blocked>::invoke(member, ArgDiag::use_unit_diag, A.extent(1), alpha,
134 A.data(), A.stride_1(), A.stride_0(), b.data(),
135 b.stride_0());
136 }
137 };
138 } // namespace KokkosBatched
139
140 #endif