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
35// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
36#define MATCHER_FOR_GRAPH_ADD_AGGREGATE_NODE(_graph_create_event_variant_, ...) \
37 AGraphAddAggregateNodeEvent( \
38 ::testing::Field( \
39 &Kokkos::Execution::GraphImpl::GraphAddAggregateNodeEvent::graph, \
40 ::testing::Eq( \
41 std::get<Kokkos::Execution::GraphImpl::GraphCreateEvent>(_graph_create_event_variant_).graph)), \
42 ::testing::Field( \
43 &Kokkos::Execution::GraphImpl::GraphAddAggregateNodeEvent::predecessors, \
44 ::testing::ElementsAre(__VA_ARGS__)))
45
46// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
47#define MATCHER_FOR_GRAPH_ROOT_NODE_OF(_graph_create_event_) \
48 std::get<Kokkos::Execution::GraphImpl::GraphCreateEvent>(_graph_create_event_).root_node
49
50// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
51#define MATCHER_FOR_GRAPH_NODE_OF(_graph_add_node_event_) \
52 std::get<Kokkos::Execution::GraphImpl::GraphAddNodeEvent>(_graph_add_node_event_).node
53
54// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
55#define MATCHER_FOR_GRAPH_AGGREGATE_NODE_OF(_graph_add_aggregate_node_event_) \
56 std::get<Kokkos::Execution::GraphImpl::GraphAddAggregateNodeEvent>(_graph_add_aggregate_node_event_).node
57
58// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
59#define MATCHER_FOR_GRAPH_INSTANTIATE(_graph_create_event_variant_) \
60 AGraphInstantiateEvent( \
61 ::testing::Field( \
62 &Kokkos::Execution::GraphImpl::GraphInstantiateEvent::graph, \
63 ::testing::Eq( \
64 std::get<Kokkos::Execution::GraphImpl::GraphCreateEvent>(_graph_create_event_variant_).graph)))
65
66// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
67#define MATCHER_FOR_GRAPH_SUBMIT(_exec_, _graph_create_event_variant_) \
68 AGraphSubmitEvent( \
69 ::testing::Field( \
70 &Kokkos::Execution::GraphImpl::GraphSubmitEvent::dev_id, \
71 ::testing::Eq(Kokkos::Tools::Experimental::device_id(_exec_))), \
72 ::testing::Field( \
73 &Kokkos::Execution::GraphImpl::GraphSubmitEvent::graph, \
74 ::testing::Eq( \
75 std::get<Kokkos::Execution::GraphImpl::GraphCreateEvent>(_graph_create_event_variant_).graph)))
76
77
79template <Kokkos::ExecutionSpace Exec>
87 constexpr bool operator()(const Kokkos::utils::callbacks::BeginFenceEvent& event) const {
88 return event.name != "Kokkos::DefaultGraph::submit: fencing before launching graph nodes"
89 && event.name != "Kokkos::DefaultGraphNode::execute_node: sync with predecessors"
90 && event.name != "Kokkos::GraphImpl::~GraphImpl: Graph Destruction";
91 }
92
93 template <Kokkos::utils::callbacks::Event EventType>
94 constexpr bool operator()(const EventType&) const {
95 return true;
96 }
97};
98
99} // namespace Tests::GraphImpl
100
101#endif // KOKKOS_EXECUTION_TESTS_GRAPH_EVENTS_HPP
#define DEFINE_EVENT_MATCHER_IN(__namespace__, __eventtype__)
Similar to EventDiscardMatcher, for graph-related events.
Definition events.hpp:80
constexpr bool operator()(const EventType &) const
Definition events.hpp:94
constexpr bool operator()(const Kokkos::utils::callbacks::BeginFenceEvent &event) const
Definition events.hpp:87