• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

celerity / celerity-runtime / 11609936308

31 Oct 2024 10:08AM UTC coverage: 95.249% (+0.05%) from 95.198%
11609936308

push

github

fknorr
Update benchmark results for new TDAG structure

3034 of 3420 branches covered (88.71%)

Branch coverage included in aggregate %.

6730 of 6831 relevant lines covered (98.52%)

1524046.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/include/command.h
1
#pragma once
2

3
#include "intrusive_graph.h"
4
#include "ranges.h"
5
#include "task.h"
6
#include "types.h"
7

8
#include <matchbox.hh>
9

10
namespace celerity {
11
namespace detail {
12

13
        enum class command_type { epoch, horizon, execution, push, await_push, reduction, fence };
14

15
        class abstract_command : public intrusive_graph_node<abstract_command>,
16
                                 // Accept visitors to enable matchbox::match() on the command inheritance hierarchy
17
                                 public matchbox::acceptor<class epoch_command, class horizon_command, class execution_command, class push_command,
18
                                     class await_push_command, class reduction_command, class fence_command> {
19
                friend class command_graph;
20

21
          protected:
22
                abstract_command(command_id cid) : m_cid(cid) {}
6,052✔
23

24
          public:
25
                virtual command_type get_type() const = 0;
26

27
                command_id get_cid() const { return m_cid; }
132,828✔
28

29
          private:
30
                // Should only be possible to add/remove dependencies using command_graph.
31
                using parent_type = intrusive_graph_node<abstract_command>;
32
                using parent_type::add_dependency;
33
                using parent_type::remove_dependency;
34

35
                command_id m_cid;
36
        };
37

38
        class push_command final : public matchbox::implement_acceptor<abstract_command, push_command> {
39
                friend class command_graph;
40
                push_command(const command_id cid, const transfer_id& trid, std::vector<std::pair<node_id, region<3>>> target_regions)
534✔
41
                    : acceptor_base(cid), m_trid(trid), m_target_regions(std::move(target_regions)) {}
534✔
42

43
                command_type get_type() const override { return command_type::push; }
×
44

45
          public:
46
                const transfer_id& get_transfer_id() const { return m_trid; }
583✔
47
                const std::vector<std::pair<node_id, region<3>>>& get_target_regions() const { return m_target_regions; }
583✔
48

49
          private:
50
                transfer_id m_trid;
51
                std::vector<std::pair<node_id, region<3>>> m_target_regions;
52
        };
53

54
        class await_push_command final : public matchbox::implement_acceptor<abstract_command, await_push_command> {
55
                friend class command_graph;
56
                await_push_command(const command_id cid, const transfer_id& trid, region<3> region) : acceptor_base(cid), m_trid(trid), m_region(std::move(region)) {}
478✔
57

58
                command_type get_type() const override { return command_type::await_push; }
×
59

60
          public:
61
                const transfer_id& get_transfer_id() const { return m_trid; }
531✔
62
                const region<3>& get_region() const { return m_region; }
917✔
63

64
          private:
65
                transfer_id m_trid;
66
                region<3> m_region;
67
        };
68

69
        class reduction_command final : public matchbox::implement_acceptor<abstract_command, reduction_command> {
70
                friend class command_graph;
71
                reduction_command(command_id cid, const reduction_info& info, const bool has_local_contribution)
68✔
72
                    : acceptor_base(cid), m_info(info), m_has_local_contribution(has_local_contribution) {}
68✔
73

74
                command_type get_type() const override { return command_type::reduction; }
×
75

76
          public:
77
                const reduction_info& get_reduction_info() const { return m_info; }
199✔
78
                bool has_local_contribution() const { return m_has_local_contribution; }
95✔
79

80
          private:
81
                reduction_info m_info;
82
                bool m_has_local_contribution;
83
        };
84

85
        class task_command : public abstract_command {
86
          protected:
87
                task_command(const command_id cid, const task* const tsk) : abstract_command(cid), m_task(tsk) {}
4,972✔
88

89
          public:
90
                const task* get_task() const { return m_task; }
17,359✔
91

92
          private:
93
                const task* m_task;
94
        };
95

96
        class epoch_command final : public matchbox::implement_acceptor<task_command, epoch_command> {
97
                friend class command_graph;
98
                epoch_command(const command_id cid, const task* const tsk, const epoch_action action, std::vector<reduction_id> completed_reductions)
1,308✔
99
                    : acceptor_base(cid, tsk), m_action(action), m_completed_reductions(std::move(completed_reductions)) {}
1,308✔
100

101
                command_type get_type() const override { return command_type::epoch; }
12✔
102

103
          public:
104
                epoch_action get_epoch_action() const { return m_action; }
4,499✔
105
                const std::vector<reduction_id>& get_completed_reductions() const { return m_completed_reductions; }
1,703✔
106

107
          private:
108
                epoch_action m_action;
109
                std::vector<reduction_id> m_completed_reductions;
110
        };
111

112
        class horizon_command final : public matchbox::implement_acceptor<task_command, horizon_command> {
113
                friend class command_graph;
114
                horizon_command(const command_id cid, const task* const tsk, std::vector<reduction_id> completed_reductions)
808✔
115
                    : acceptor_base(cid, tsk), m_completed_reductions(std::move(completed_reductions)) {}
808✔
116

117
                command_type get_type() const override { return command_type::horizon; }
765✔
118

119
          public:
120
                const std::vector<reduction_id>& get_completed_reductions() const { return m_completed_reductions; }
840✔
121

122
          private:
123
                std::vector<reduction_id> m_completed_reductions;
124
        };
125

126
        class execution_command final : public matchbox::implement_acceptor<task_command, execution_command> {
127
                friend class command_graph;
128

129
          protected:
130
                execution_command(const command_id cid, const task* const tsk, subrange<3> execution_range)
2,768✔
131
                    : acceptor_base(cid, tsk), m_execution_range(execution_range) {}
2,768✔
132

133
          public:
134
                command_type get_type() const override { return command_type::execution; }
1,035✔
135

136
                const subrange<3>& get_execution_range() const { return m_execution_range; }
6,641✔
137

138
                void set_is_reduction_initializer(bool is_initializer) { m_initialize_reductions = is_initializer; }
14✔
139

140
                bool is_reduction_initializer() const { return m_initialize_reductions; }
3,496✔
141

142
          private:
143
                subrange<3> m_execution_range;
144
                bool m_initialize_reductions = false;
145
        };
146

147
        class fence_command final : public matchbox::implement_acceptor<task_command, fence_command> {
148
                friend class command_graph;
149
                using acceptor_base::acceptor_base;
150

151
                command_type get_type() const override { return command_type::fence; }
×
152
        };
153

154
        /// Hash function for `unordered_sets/maps` of `command *` that is deterministic even as allocation addresses change between application runs.
155
        struct command_hash_by_id {
156
                template <typename Pointer>
157
                constexpr size_t operator()(const Pointer instr) const {
17,436✔
158
                        return std::hash<command_id>()(instr->get_cid());
17,436✔
159
                }
160
        };
161

162
        using command_set = std::unordered_set<abstract_command*, command_hash_by_id>;
163

164
} // namespace detail
165
} // namespace celerity
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc