kokkos-execution 0.0.1
Loading...
Searching...
No Matches
events.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_EXECUTION_TESTS_GRAPH_EVENTS_HPP
2#define KOKKOS_EXECUTION_TESTS_GRAPH_EVENTS_HPP
3
5
7
8namespace Tests::GraphImpl {
9
15
16// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
17#define MATCHER_FOR_GRAPH_CREATE(_device_handle_) \
18 AGraphCreateEvent( \
19 ::testing::Field( \
20 &Kokkos::Execution::GraphImpl::GraphCreateEvent::dev_id, \
21 ::testing::Eq(Kokkos::Tools::Experimental::device_id(_device_handle_.m_exec))))
22
23// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
24#define MATCHER_FOR_GRAPH_ADDNODE(_graph_create_event_variant_, _device_handle_, _predecessor_, ...) \
25 AGraphAddNodeEvent( \
26 ::testing::Field( \
27 &Kokkos::Execution::GraphImpl::GraphAddNodeEvent::dev_id, \
28 ::testing::Eq(Kokkos::Tools::Experimental::device_id(_device_handle_.m_exec))), \
29 ::testing::Field( \
30 &Kokkos::Execution::GraphImpl::GraphAddNodeEvent::graph, \
31 ::testing::Eq( \
32 std::get<Kokkos::Execution::GraphImpl::GraphCreateEvent>(_graph_create_event_variant_).graph)), \
33 ::testing::Field(&Kokkos::Execution::GraphImpl::GraphAddNodeEvent::predecessor, ::testing::Eq(_predecessor_)) \
34 __VA_OPT__( \
35 , \
36 ::testing::Field( \
37 &Kokkos::Execution::GraphImpl::GraphAddNodeEvent::name, ::testing::Eq(std::string(__VA_ARGS__)))))
38
39// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
40#define MATCHER_FOR_GRAPH_ADD_AGGREGATE_NODE(_graph_create_event_variant_, ...) \
41 AGraphAddAggregateNodeEvent( \
42 ::testing::Field( \
43 &Kokkos::Execution::GraphImpl::GraphAddAggregateNodeEvent::graph, \
44 ::testing::Eq( \
45 std::get<Kokkos::Execution::GraphImpl::GraphCreateEvent>(_graph_create_event_variant_).graph)), \
46 ::testing::Field( \
47 &Kokkos::Execution::GraphImpl::GraphAddAggregateNodeEvent::predecessors, \
48 ::testing::ElementsAre(__VA_ARGS__)))
49
50// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
51#define MATCHER_FOR_GRAPH_ROOT_NODE_OF(_graph_create_event_) \
52 std::get<Kokkos::Execution::GraphImpl::GraphCreateEvent>(_graph_create_event_).root_node
53
54// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
55#define MATCHER_FOR_GRAPH_NODE_OF(_graph_add_node_event_) \
56 std::get<Kokkos::Execution::GraphImpl::GraphAddNodeEvent>(_graph_add_node_event_).node
57
58// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
59#define MATCHER_FOR_GRAPH_AGGREGATE_NODE_OF(_graph_add_aggregate_node_event_) \
60 std::get<Kokkos::Execution::GraphImpl::GraphAddAggregateNodeEvent>(_graph_add_aggregate_node_event_).node
61
62// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
63#define MATCHER_FOR_GRAPH_INSTANTIATE(_graph_create_event_variant_) \
64 AGraphInstantiateEvent( \
65 ::testing::Field( \
66 &Kokkos::Execution::GraphImpl::GraphInstantiateEvent::graph, \
67 ::testing::Eq( \
68 std::get<Kokkos::Execution::GraphImpl::GraphCreateEvent>(_graph_create_event_variant_).graph)))
69
70// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
71#define MATCHER_FOR_GRAPH_SUBMIT(_exec_, _graph_create_event_variant_) \
72 AGraphSubmitEvent( \
73 ::testing::Field( \
74 &Kokkos::Execution::GraphImpl::GraphSubmitEvent::dev_id, \
75 ::testing::Eq(Kokkos::Tools::Experimental::device_id(_exec_))), \
76 ::testing::Field( \
77 &Kokkos::Execution::GraphImpl::GraphSubmitEvent::graph, \
78 ::testing::Eq( \
79 std::get<Kokkos::Execution::GraphImpl::GraphCreateEvent>(_graph_create_event_variant_).graph)))
80
82template <Kokkos::ExecutionSpace Exec>
91 constexpr bool operator()(const Kokkos::utils::callbacks::BeginFenceEvent& event) const {
92 return event.name != "Kokkos::DefaultGraph::submit: fencing before launching graph nodes"
93 && event.name != "Kokkos::DefaultGraph::submit: fencing before ending graph submit"
94 && event.name != "Kokkos::DefaultGraphNode::execute_node: sync with predecessors"
95 && event.name != "Kokkos::GraphImpl::~GraphImpl: Graph Destruction";
96 }
97
98 template <Kokkos::utils::callbacks::Event EventType>
99 constexpr bool operator()(const EventType&) const {
100 return true;
101 }
102};
103
104} // namespace Tests::GraphImpl
105
106#endif // KOKKOS_EXECUTION_TESTS_GRAPH_EVENTS_HPP
#define DEFINE_EVENT_MATCHER_IN(__namespace__, __eventtype__)
Similar to EventDiscardMatcher, for graph-related events.
Definition events.hpp:83
constexpr bool operator()(const EventType &) const
Definition events.hpp:99
constexpr bool operator()(const Kokkos::utils::callbacks::BeginFenceEvent &event) const
Definition events.hpp:91