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

daisytuner / sdfglib / 16345126205

17 Jul 2025 12:29PM UTC coverage: 64.863% (-0.3%) from 65.184%
16345126205

Pull #147

github

web-flow
Merge 28b2c5314 into 56ea48e3e
Pull Request #147: Adds metadata library node

106 of 200 new or added lines in 9 files covered. (53.0%)

1 existing line in 1 file now uncovered.

8717 of 13439 relevant lines covered (64.86%)

176.14 hits per line

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

89.47
/src/codegen/dispatchers/node_dispatcher_registry.cpp
1
#include "sdfg/codegen/dispatchers/node_dispatcher_registry.h"
2

3
#include "sdfg/codegen/dispatchers/block_dispatcher.h"
4
#include "sdfg/codegen/dispatchers/for_dispatcher.h"
5
#include "sdfg/codegen/dispatchers/if_else_dispatcher.h"
6
#include "sdfg/codegen/dispatchers/map_dispatcher.h"
7
#include "sdfg/codegen/dispatchers/sequence_dispatcher.h"
8
#include "sdfg/codegen/dispatchers/while_dispatcher.h"
9

10
#include "sdfg/data_flow/library_nodes/barrier_local_node.h"
11
#include "sdfg/data_flow/library_nodes/math/math.h"
12
#include "sdfg/data_flow/library_nodes/metadata_node.h"
13

14
namespace sdfg {
15
namespace codegen {
16

17
std::unique_ptr<NodeDispatcher> create_dispatcher(
24✔
18
    LanguageExtension& language_extension,
19
    StructuredSDFG& sdfg,
20
    structured_control_flow::ControlFlowNode& node,
21
    Instrumentation& instrumentation
22
) {
23
    auto dispatcher = NodeDispatcherRegistry::instance().get_dispatcher(typeid(node));
24✔
24
    if (dispatcher) {
24✔
25
        return dispatcher(language_extension, sdfg, node, instrumentation);
24✔
26
    }
27

28
    throw std::runtime_error("Unsupported control flow node: " + std::string(typeid(node).name()));
×
29
};
24✔
30

31
void register_default_dispatchers() {
2✔
32
    /* Control flow dispatchers */
33
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
34
        typeid(structured_control_flow::Block),
2✔
35
        [](LanguageExtension& language_extension,
6✔
36
           StructuredSDFG& sdfg,
37
           structured_control_flow::ControlFlowNode& node,
38
           Instrumentation& instrumentation) {
39
            return std::make_unique<BlockDispatcher>(
4✔
40
                language_extension, sdfg, static_cast<structured_control_flow::Block&>(node), instrumentation
4✔
41
            );
42
        }
43
    );
44
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
45
        typeid(structured_control_flow::Sequence),
2✔
46
        [](LanguageExtension& language_extension,
16✔
47
           StructuredSDFG& sdfg,
48
           structured_control_flow::ControlFlowNode& node,
49
           Instrumentation& instrumentation) {
50
            return std::make_unique<SequenceDispatcher>(
14✔
51
                language_extension, sdfg, static_cast<structured_control_flow::Sequence&>(node), instrumentation
14✔
52
            );
53
        }
54
    );
55
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
56
        typeid(structured_control_flow::IfElse),
2✔
57
        [](LanguageExtension& language_extension,
3✔
58
           StructuredSDFG& sdfg,
59
           structured_control_flow::ControlFlowNode& node,
60
           Instrumentation& instrumentation) {
61
            return std::make_unique<IfElseDispatcher>(
1✔
62
                language_extension, sdfg, static_cast<structured_control_flow::IfElse&>(node), instrumentation
1✔
63
            );
64
        }
65
    );
66
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
67
        typeid(structured_control_flow::While),
2✔
68
        [](LanguageExtension& language_extension,
3✔
69
           StructuredSDFG& sdfg,
70
           structured_control_flow::ControlFlowNode& node,
71
           Instrumentation& instrumentation) {
72
            return std::make_unique<WhileDispatcher>(
1✔
73
                language_extension, sdfg, static_cast<structured_control_flow::While&>(node), instrumentation
1✔
74
            );
75
        }
76
    );
77
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
78
        typeid(structured_control_flow::For),
2✔
79
        [](LanguageExtension& language_extension,
3✔
80
           StructuredSDFG& sdfg,
81
           structured_control_flow::ControlFlowNode& node,
82
           Instrumentation& instrumentation) {
83
            return std::make_unique<ForDispatcher>(
1✔
84
                language_extension, sdfg, static_cast<structured_control_flow::For&>(node), instrumentation
1✔
85
            );
86
        }
87
    );
88
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
89
        typeid(structured_control_flow::Map),
2✔
90
        [](LanguageExtension& language_extension,
2✔
91
           StructuredSDFG& sdfg,
92
           structured_control_flow::ControlFlowNode& node,
93
           Instrumentation& instrumentation) {
NEW
94
            return std::make_unique<MapDispatcher>(
×
NEW
95
                language_extension, sdfg, static_cast<structured_control_flow::Map&>(node), instrumentation
×
96
            );
97
        }
98
    );
99
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
100
        typeid(structured_control_flow::Return),
2✔
101
        [](LanguageExtension& language_extension,
3✔
102
           StructuredSDFG& sdfg,
103
           structured_control_flow::ControlFlowNode& node,
104
           Instrumentation& instrumentation) {
105
            return std::make_unique<ReturnDispatcher>(
1✔
106
                language_extension, sdfg, static_cast<structured_control_flow::Return&>(node), instrumentation
1✔
107
            );
108
        }
109
    );
110
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
111
        typeid(structured_control_flow::Break),
2✔
112
        [](LanguageExtension& language_extension,
3✔
113
           StructuredSDFG& sdfg,
114
           structured_control_flow::ControlFlowNode& node,
115
           Instrumentation& instrumentation) {
116
            return std::make_unique<BreakDispatcher>(
1✔
117
                language_extension, sdfg, static_cast<structured_control_flow::Break&>(node), instrumentation
1✔
118
            );
119
        }
120
    );
121
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
122
        typeid(structured_control_flow::Continue),
2✔
123
        [](LanguageExtension& language_extension,
3✔
124
           StructuredSDFG& sdfg,
125
           structured_control_flow::ControlFlowNode& node,
126
           Instrumentation& instrumentation) {
127
            return std::make_unique<ContinueDispatcher>(
1✔
128
                language_extension, sdfg, static_cast<structured_control_flow::Continue&>(node), instrumentation
1✔
129
            );
130
        }
131
    );
132

133
    /* Map dispatchers */
134
    MapDispatcherRegistry::instance().register_map_dispatcher(
4✔
135
        structured_control_flow::ScheduleType_Sequential.value(),
2✔
136
        [](LanguageExtension& language_extension,
3✔
137
           StructuredSDFG& sdfg,
138
           structured_control_flow::Map& node,
139
           Instrumentation& instrumentation) {
140
            return std::make_unique<SequentialMapDispatcher>(language_extension, sdfg, node, instrumentation);
1✔
141
        }
142
    );
143
    MapDispatcherRegistry::instance().register_map_dispatcher(
4✔
144
        structured_control_flow::ScheduleType_CPU_Parallel.value(),
2✔
145
        [](LanguageExtension& language_extension,
2✔
146
           StructuredSDFG& sdfg,
147
           structured_control_flow::Map& node,
148
           Instrumentation& instrumentation) {
NEW
149
            return std::make_unique<CPUParallelMapDispatcher>(language_extension, sdfg, node, instrumentation);
×
150
        }
151
    );
152

153
    /* Librarynode dispatchers */
154
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
155
        data_flow::LibraryNodeType_BarrierLocal.value(),
2✔
156
        [](LanguageExtension& language_extension,
3✔
157
           const Function& function,
158
           const data_flow::DataFlowGraph& data_flow_graph,
159
           const data_flow::LibraryNode& node) {
160
            return std::make_unique<data_flow::BarrierLocalNodeDispatcher>(
1✔
161
                language_extension, function, data_flow_graph, dynamic_cast<const data_flow::BarrierLocalNode&>(node)
1✔
162
            );
163
        }
164
    );
165
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
166
        data_flow::LibraryNodeType_Metadata.value(),
2✔
167
        [](LanguageExtension& language_extension,
2✔
168
           const Function& function,
169
           const data_flow::DataFlowGraph& data_flow_graph,
170
           const data_flow::LibraryNode& node) {
NEW
171
            return std::make_unique<data_flow::MetadataDispatcher>(
×
NEW
172
                language_extension, function, data_flow_graph, dynamic_cast<const data_flow::MetadataNode&>(node)
×
173
            );
174
        }
175
    );
176

177
    /* Math */
178
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
179
        math::ml::LibraryNodeType_ReLU.value(),
2✔
180
        [](LanguageExtension& language_extension,
2✔
181
           const Function& function,
182
           const data_flow::DataFlowGraph& data_flow_graph,
183
           const data_flow::LibraryNode& node) {
NEW
184
            return std::make_unique<math::ml::ReLUNodeDispatcher>(
×
NEW
185
                language_extension, function, data_flow_graph, dynamic_cast<const math::ml::ReLUNode&>(node)
×
186
            );
187
        }
188
    );
189
}
2✔
190

191
} // namespace codegen
192
} // namespace sdfg
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

© 2026 Coveralls, Inc