kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
diagnostics.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_IMPL_DIAGNOSTICS_HPP
2
#define KOKKOS_EXECUTION_IMPL_DIAGNOSTICS_HPP
3
9
10
#include "
kokkos-execution/stdexec.hpp
"
11
12
namespace
Kokkos::Execution::Impl
{
13
15
template
<
typename
T>
16
struct
WITH_OPSTATE
;
17
19
template
<
typename
... T>
20
struct
WITH_CHILDREN_ERRORS
;
21
23
template
<
typename
T>
24
struct
WITH_EXECUTION_SPACE
;
25
28
template
<
template
<
typename
...>
class
To,
template
<
typename
...>
class
From,
typename
... As>
29
auto
rebind
(From<As...>*) -> To<As...>;
30
31
template
<
template
<
typename
...>
class
To,
typename
From>
32
using
rebind_t
=
decltype
(
rebind<To>
(
static_cast<
From*
>
(
nullptr
)));
34
37
template
<
typename
T>
38
struct
TryDiagnose
{
39
using
type
= stdexec::__msuccess;
40
};
41
42
template
<
typename
T>
43
requires
std::invocable<
decltype
(T::diagnose)>
44
struct
TryDiagnose<T>
{
45
using
type
=
decltype
(T::diagnose());
46
};
47
48
template
<
typename
T>
49
using
try_diagnose_t
=
typename
TryDiagnose<T>::type
;
51
54
template
<
typename
...>
55
struct
Diagnose
;
56
57
template
<
typename
T>
58
struct
Diagnose<T>
:
TryDiagnose<T>
{ };
59
60
template
<
typename
... Ts>
61
struct
Diagnose
{
62
using
type
= stdexec::__mlist<try_diagnose_t<Ts>...>;
63
};
64
65
template
<
typename
... Ts>
66
requires
(
sizeof
...(Ts) > 0)
67
using
diagnose_t
=
typename
Diagnose<Ts...>::type
;
69
72
template
<
typename
...>
73
struct
FirstErrorOf
;
74
75
template
<
typename
T>
76
struct
FirstErrorOf<T>
{
77
using
type
= std::conditional_t<stdexec::__merror<T>, T, stdexec::__msuccess>;
78
};
79
80
template
<
typename
T,
typename
... Ts>
81
struct
FirstErrorOf
<T, Ts...>
82
: std::conditional_t<stdexec::__merror<T>, std::type_identity<T>, FirstErrorOf<Ts...>> { };
83
84
template
<
typename
T>
85
struct
FirstError
:
FirstErrorOf
<T> { };
86
87
template
<
typename
... Ts>
88
struct
FirstError
<
stdexec
::__mlist<Ts...>> :
FirstErrorOf
<Ts...> { };
89
90
template
<
typename
T>
91
using
first_error_t
=
typename
FirstError<T>::type
;
93
96
template
<
typename
T>
97
struct
Collapse
: std::type_identity<T> { };
98
99
template
<
typename
T>
100
struct
Collapse
<
stdexec
::__mlist<T>> {
101
using
type
= T;
102
};
103
104
template
<
typename
T>
105
using
collapse_t
=
typename
Collapse<T>::type
;
107
116
template
<
typename
T>
117
using
keep_if_error_t
= std::conditional_t<stdexec::__merror<T>, stdexec::__mlist<T>, stdexec::__mlist<>>;
118
119
template
<
typename
T>
120
struct
KeepErrors
{
121
using
type
= std::conditional_t<stdexec::__merror<T>, T, stdexec::__msuccess>;
122
};
123
124
template
<
typename
... Ts>
125
struct
KeepErrors
<
stdexec
::__mlist<Ts...>> {
126
using
type
= stdexec::__mconcat_result_t<stdexec::__mlist<>,
keep_if_error_t<Ts>
...>;
127
};
128
129
template
<
typename
List>
130
using
keep_errors_t
=
typename
KeepErrors<List>::type
;
132
134
template
<
typename
T>
135
constexpr
bool
mandate_or_explain
() noexcept {
136
if
constexpr
(!T::value) {
137
static_assert
(std::is_same_v<diagnose_t<T>, stdexec::__msuccess>,
"Check for the error in the compiler log."
);
138
}
139
return
T::value;
140
}
141
142
}
// namespace Kokkos::Execution::Impl
143
144
#endif
// KOKKOS_EXECUTION_IMPL_DIAGNOSTICS_HPP
stdexec.hpp
Kokkos::Execution::Impl
Definition
attributes.hpp:6
Kokkos::Execution::Impl::first_error_t
typename FirstError< T >::type first_error_t
Definition
diagnostics.hpp:91
Kokkos::Execution::Impl::collapse_t
typename Collapse< T >::type collapse_t
Definition
diagnostics.hpp:105
Kokkos::Execution::Impl::rebind
auto rebind(From< As... > *) -> To< As... >
Kokkos::Execution::Impl::try_diagnose_t
typename TryDiagnose< T >::type try_diagnose_t
Definition
diagnostics.hpp:49
Kokkos::Execution::Impl::mandate_or_explain
constexpr bool mandate_or_explain() noexcept
If T::value is false, diagnose.
Definition
diagnostics.hpp:135
Kokkos::Execution::Impl::keep_if_error_t
std::conditional_t< stdexec::__merror< T >, stdexec::__mlist< T >, stdexec::__mlist<> > keep_if_error_t
Definition
diagnostics.hpp:117
Kokkos::Execution::Impl::keep_errors_t
typename KeepErrors< List >::type keep_errors_t
Definition
diagnostics.hpp:130
Kokkos::Execution::Impl::rebind_t
decltype(rebind< To >(static_cast< From * >(nullptr))) rebind_t
Definition
diagnostics.hpp:32
Kokkos::Execution::Impl::diagnose_t
typename Diagnose< Ts... >::type diagnose_t
Definition
diagnostics.hpp:67
stdexec
Definition
when_all.hpp:16
Kokkos::Execution::Impl::Collapse< stdexec::__mlist< T > >::type
T type
Definition
diagnostics.hpp:101
Kokkos::Execution::Impl::Collapse
Definition
diagnostics.hpp:97
Kokkos::Execution::Impl::Diagnose
Definition
diagnostics.hpp:61
Kokkos::Execution::Impl::Diagnose::type
stdexec::__mlist< try_diagnose_t< Ts >... > type
Definition
diagnostics.hpp:62
Kokkos::Execution::Impl::FirstErrorOf< T >::type
std::conditional_t< stdexec::__merror< T >, T, stdexec::__msuccess > type
Definition
diagnostics.hpp:77
Kokkos::Execution::Impl::FirstErrorOf
Definition
diagnostics.hpp:73
Kokkos::Execution::Impl::FirstError
Definition
diagnostics.hpp:85
Kokkos::Execution::Impl::KeepErrors< stdexec::__mlist< Ts... > >::type
stdexec::__mconcat_result_t< stdexec::__mlist<>, keep_if_error_t< Ts >... > type
Definition
diagnostics.hpp:126
Kokkos::Execution::Impl::KeepErrors
Definition
diagnostics.hpp:120
Kokkos::Execution::Impl::KeepErrors::type
std::conditional_t< stdexec::__merror< T >, T, stdexec::__msuccess > type
Definition
diagnostics.hpp:121
Kokkos::Execution::Impl::TryDiagnose< T >::type
decltype(T::diagnose()) type
Definition
diagnostics.hpp:45
Kokkos::Execution::Impl::TryDiagnose
Definition
diagnostics.hpp:38
Kokkos::Execution::Impl::TryDiagnose::type
stdexec::__msuccess type
Definition
diagnostics.hpp:39
Kokkos::Execution::Impl::WITH_CHILDREN_ERRORS
Tag to be used to signal children errors.
Definition
diagnostics.hpp:20
Kokkos::Execution::Impl::WITH_EXECUTION_SPACE
Tag to be used to signal an execution space.
Definition
diagnostics.hpp:24
Kokkos::Execution::Impl::WITH_OPSTATE
Definition
diagnostics.hpp:16
kokkos-execution
impl
diagnostics.hpp
Generated on
for kokkos-execution by
1.18.0