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

daisytuner / sdfglib / 18318341707

07 Oct 2025 03:48PM UTC coverage: 61.593% (+0.5%) from 61.066%
18318341707

push

github

web-flow
Merge pull request #262 from daisytuner/tasklets

Tasklets, Intrinsics and Library Nodes

84 of 418 new or added lines in 29 files covered. (20.1%)

153 existing lines in 17 files now uncovered.

8979 of 14578 relevant lines covered (61.59%)

103.69 hits per line

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

76.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/call_node.h"
12
#include "sdfg/data_flow/library_nodes/math/math.h"
13
#include "sdfg/data_flow/library_nodes/metadata_node.h"
14
#include "sdfg/data_flow/library_nodes/stdlib/stdlib.h"
15

16
namespace sdfg {
17
namespace codegen {
18

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

30
    throw std::runtime_error("Unsupported control flow node: " + std::string(typeid(node).name()));
×
31
};
21✔
32

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

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

155
    // stdlib
156
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
157
        stdlib::LibraryNodeType_Alloca.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
158
        [](LanguageExtension& language_extension,
2✔
159
           const Function& function,
160
           const data_flow::DataFlowGraph& data_flow_graph,
161
           const data_flow::LibraryNode& node) {
162
            return std::make_unique<stdlib::AllocaNodeDispatcher>(
×
163
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::AllocaNode&>(node)
×
164
            );
165
        }
166
    );
167
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
168
        stdlib::LibraryNodeType_Calloc.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
169
        [](LanguageExtension& language_extension,
2✔
170
           const Function& function,
171
           const data_flow::DataFlowGraph& data_flow_graph,
172
           const data_flow::LibraryNode& node) {
173
            return std::make_unique<stdlib::CallocNodeDispatcher>(
×
174
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::CallocNode&>(node)
×
175
            );
176
        }
177
    );
178
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
179
        stdlib::LibraryNodeType_Free.value() + "::" + data_flow::ImplementationType_NONE.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) {
184
            return std::make_unique<stdlib::FreeNodeDispatcher>(
×
185
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::FreeNode&>(node)
×
186
            );
187
        }
188
    );
189
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
190
        stdlib::LibraryNodeType_Malloc.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
191
        [](LanguageExtension& language_extension,
2✔
192
           const Function& function,
193
           const data_flow::DataFlowGraph& data_flow_graph,
194
           const data_flow::LibraryNode& node) {
195
            return std::make_unique<stdlib::MallocNodeDispatcher>(
×
196
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::MallocNode&>(node)
×
197
            );
198
        }
199
    );
200
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
201
        stdlib::LibraryNodeType_Memcpy.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
202
        [](LanguageExtension& language_extension,
2✔
203
           const Function& function,
204
           const data_flow::DataFlowGraph& data_flow_graph,
205
           const data_flow::LibraryNode& node) {
206
            return std::make_unique<stdlib::MemcpyNodeDispatcher>(
×
207
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::MemcpyNode&>(node)
×
208
            );
209
        }
210
    );
211
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
212
        stdlib::LibraryNodeType_Memmove.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
213
        [](LanguageExtension& language_extension,
2✔
214
           const Function& function,
215
           const data_flow::DataFlowGraph& data_flow_graph,
216
           const data_flow::LibraryNode& node) {
217
            return std::make_unique<stdlib::MemmoveNodeDispatcher>(
×
218
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::MemmoveNode&>(node)
×
219
            );
220
        }
221
    );
222
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
223
        stdlib::LibraryNodeType_Memset.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
224
        [](LanguageExtension& language_extension,
2✔
225
           const Function& function,
226
           const data_flow::DataFlowGraph& data_flow_graph,
227
           const data_flow::LibraryNode& node) {
228
            return std::make_unique<stdlib::MemsetNodeDispatcher>(
×
229
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::MemsetNode&>(node)
×
230
            );
231
        }
232
    );
233

234
    // CallNode
235
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
236
        data_flow::LibraryNodeType_Call.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
237
        [](LanguageExtension& language_extension,
2✔
238
           const Function& function,
239
           const data_flow::DataFlowGraph& data_flow_graph,
240
           const data_flow::LibraryNode& node) {
241
            return std::make_unique<data_flow::CallNodeDispatcher>(
×
242
                language_extension, function, data_flow_graph, dynamic_cast<const data_flow::CallNode&>(node)
×
243
            );
244
        }
245
    );
246

247
    // BarrierLocal
248
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
249
        data_flow::LibraryNodeType_BarrierLocal.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
250
        [](LanguageExtension& language_extension,
3✔
251
           const Function& function,
252
           const data_flow::DataFlowGraph& data_flow_graph,
253
           const data_flow::LibraryNode& node) {
254
            return std::make_unique<data_flow::BarrierLocalNodeDispatcher>(
1✔
255
                language_extension, function, data_flow_graph, dynamic_cast<const data_flow::BarrierLocalNode&>(node)
1✔
256
            );
257
        }
258
    );
259

260
    // Metadata
261
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
262
        data_flow::LibraryNodeType_Metadata.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
263
        [](LanguageExtension& language_extension,
2✔
264
           const Function& function,
265
           const data_flow::DataFlowGraph& data_flow_graph,
266
           const data_flow::LibraryNode& node) {
267
            return std::make_unique<data_flow::MetadataDispatcher>(
×
268
                language_extension, function, data_flow_graph, dynamic_cast<const data_flow::MetadataNode&>(node)
×
269
            );
270
        }
271
    );
272

273
    // Math
274

275
    // Intrinsic
276
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
277
        math::LibraryNodeType_Intrinsic.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
278
        [](LanguageExtension& language_extension,
2✔
279
           const Function& function,
280
           const data_flow::DataFlowGraph& data_flow_graph,
281
           const data_flow::LibraryNode& node) {
NEW
282
            return std::make_unique<math::IntrinsicNodeDispatcher>(
×
NEW
283
                language_extension, function, data_flow_graph, dynamic_cast<const math::IntrinsicNode&>(node)
×
284
            );
285
        }
286
    );
287

288
    // Dot - BLAS
289
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
290
        math::blas::LibraryNodeType_DOT.value() + "::" + math::blas::ImplementationType_BLAS.value(),
2✔
291
        [](LanguageExtension& language_extension,
2✔
292
           const Function& function,
293
           const data_flow::DataFlowGraph& data_flow_graph,
294
           const data_flow::LibraryNode& node) {
295
            return std::make_unique<math::blas::DotNodeDispatcher_BLAS>(
×
296
                language_extension, function, data_flow_graph, dynamic_cast<const math::blas::DotNode&>(node)
×
297
            );
298
        }
299
    );
300
    // Dot - CUBLAS
301
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
302
        math::blas::LibraryNodeType_DOT.value() + "::" + math::blas::ImplementationType_CUBLAS.value(),
2✔
303
        [](LanguageExtension& language_extension,
2✔
304
           const Function& function,
305
           const data_flow::DataFlowGraph& data_flow_graph,
306
           const data_flow::LibraryNode& node) {
307
            return std::make_unique<math::blas::DotNodeDispatcher_CUBLAS>(
×
308
                language_extension, function, data_flow_graph, dynamic_cast<const math::blas::DotNode&>(node)
×
309
            );
310
        }
311
    );
312

313
    // GEMM - BLAS
314
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
315
        math::blas::LibraryNodeType_GEMM.value() + "::" + math::blas::ImplementationType_BLAS.value(),
2✔
316
        [](LanguageExtension& language_extension,
2✔
317
           const Function& function,
318
           const data_flow::DataFlowGraph& data_flow_graph,
319
           const data_flow::LibraryNode& node) {
320
            return std::make_unique<math::blas::GEMMNodeDispatcher_BLAS>(
×
321
                language_extension, function, data_flow_graph, dynamic_cast<const math::blas::GEMMNode&>(node)
×
322
            );
323
        }
324
    );
325
    // GEMM - CUBLAS
326
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
327
        math::blas::LibraryNodeType_GEMM.value() + "::" + math::blas::ImplementationType_CUBLAS.value(),
2✔
328
        [](LanguageExtension& language_extension,
2✔
329
           const Function& function,
330
           const data_flow::DataFlowGraph& data_flow_graph,
331
           const data_flow::LibraryNode& node) {
332
            return std::make_unique<math::blas::GEMMNodeDispatcher_CUBLAS>(
×
333
                language_extension, function, data_flow_graph, dynamic_cast<const math::blas::GEMMNode&>(node)
×
334
            );
335
        }
336
    );
337
}
2✔
338

339
} // namespace codegen
340
} // 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