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