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

daisytuner / sdfglib / 19162352523

07 Nov 2025 08:16AM UTC coverage: 61.556% (-0.4%) from 61.911%
19162352523

push

github

web-flow
rewrite of arg captures to work on a scope level (#319)

* rewrite of arg captures to work on a scope level

* adding first unit tests for arg capturing

* Fix scoped arg captures

* Fix debug output

* Only write capture fila name to index

* Switch to element-id based capture storage

* Reenable debug prints

* Fix serialization deserialization of arg capture index

* Use fake node ids in rtl test

* Add debug output for capture file creation

* Boost coverage

---------

Co-authored-by: Nora Hagmeyer <nora.hagmeyer@daisytuner.com>

171 of 320 new or added lines in 18 files covered. (53.44%)

17 existing lines in 5 files now uncovered.

10265 of 16676 relevant lines covered (61.56%)

100.85 hits per line

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

78.72
/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/invoke_node.h"
13
#include "sdfg/data_flow/library_nodes/math/math.h"
14
#include "sdfg/data_flow/library_nodes/metadata_node.h"
15
#include "sdfg/data_flow/library_nodes/stdlib/stdlib.h"
16

17
namespace sdfg {
18
namespace codegen {
19

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

33
    throw std::runtime_error("Unsupported control flow node: " + std::string(typeid(node).name()));
×
34
};
28✔
35

36
void register_default_dispatchers() {
2✔
37
    /* Control flow dispatchers */
38
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
39
        typeid(structured_control_flow::Block),
2✔
40
        [](LanguageExtension& language_extension,
6✔
41
           StructuredSDFG& sdfg,
42
           analysis::AnalysisManager& analysis_manager,
43
           structured_control_flow::ControlFlowNode& node,
44
           InstrumentationPlan& instrumentation,
45
           ArgCapturePlan& arg_capture) {
46
            return std::make_unique<BlockDispatcher>(
4✔
47
                language_extension,
4✔
48
                sdfg,
4✔
49
                analysis_manager,
4✔
50
                static_cast<structured_control_flow::Block&>(node),
4✔
51
                instrumentation,
4✔
52
                arg_capture
4✔
53
            );
54
        }
55
    );
56
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
57
        typeid(structured_control_flow::Sequence),
2✔
58
        [](LanguageExtension& language_extension,
20✔
59
           StructuredSDFG& sdfg,
60
           analysis::AnalysisManager& analysis_manager,
61
           structured_control_flow::ControlFlowNode& node,
62
           InstrumentationPlan& instrumentation,
63
           ArgCapturePlan& arg_capture) {
64
            return std::make_unique<SequenceDispatcher>(
18✔
65
                language_extension,
18✔
66
                sdfg,
18✔
67
                analysis_manager,
18✔
68
                static_cast<structured_control_flow::Sequence&>(node),
18✔
69
                instrumentation,
18✔
70
                arg_capture
18✔
71
            );
72
        }
73
    );
74
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
75
        typeid(structured_control_flow::IfElse),
2✔
76
        [](LanguageExtension& language_extension,
3✔
77
           StructuredSDFG& sdfg,
78
           analysis::AnalysisManager& analysis_manager,
79
           structured_control_flow::ControlFlowNode& node,
80
           InstrumentationPlan& instrumentation,
81
           ArgCapturePlan& arg_capture) {
82
            return std::make_unique<IfElseDispatcher>(
1✔
83
                language_extension,
1✔
84
                sdfg,
1✔
85
                analysis_manager,
1✔
86
                static_cast<structured_control_flow::IfElse&>(node),
1✔
87
                instrumentation,
1✔
88
                arg_capture
1✔
89
            );
90
        }
91
    );
92
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
93
        typeid(structured_control_flow::While),
2✔
94
        [](LanguageExtension& language_extension,
3✔
95
           StructuredSDFG& sdfg,
96
           analysis::AnalysisManager& analysis_manager,
97
           structured_control_flow::ControlFlowNode& node,
98
           InstrumentationPlan& instrumentation,
99
           ArgCapturePlan& arg_capture) {
100
            return std::make_unique<WhileDispatcher>(
1✔
101
                language_extension,
1✔
102
                sdfg,
1✔
103
                analysis_manager,
1✔
104
                static_cast<structured_control_flow::While&>(node),
1✔
105
                instrumentation,
1✔
106
                arg_capture
1✔
107
            );
108
        }
109
    );
110
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
111
        typeid(structured_control_flow::For),
2✔
112
        [](LanguageExtension& language_extension,
3✔
113
           StructuredSDFG& sdfg,
114
           analysis::AnalysisManager& analysis_manager,
115
           structured_control_flow::ControlFlowNode& node,
116
           InstrumentationPlan& instrumentation,
117
           ArgCapturePlan& arg_capture) {
118
            return std::make_unique<ForDispatcher>(
1✔
119
                language_extension,
1✔
120
                sdfg,
1✔
121
                analysis_manager,
1✔
122
                static_cast<structured_control_flow::For&>(node),
1✔
123
                instrumentation,
1✔
124
                arg_capture
1✔
125
            );
126
        }
127
    );
128
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
129
        typeid(structured_control_flow::Map),
2✔
130
        [](LanguageExtension& language_extension,
2✔
131
           StructuredSDFG& sdfg,
132
           analysis::AnalysisManager& analysis_manager,
133
           structured_control_flow::ControlFlowNode& node,
134
           InstrumentationPlan& instrumentation,
135
           ArgCapturePlan& arg_capture) {
136
            return std::make_unique<MapDispatcher>(
×
137
                language_extension,
×
138
                sdfg,
×
139
                analysis_manager,
×
140
                static_cast<structured_control_flow::Map&>(node),
×
NEW
141
                instrumentation,
×
NEW
142
                arg_capture
×
143
            );
144
        }
145
    );
146
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
147
        typeid(structured_control_flow::Return),
2✔
148
        [](LanguageExtension& language_extension,
3✔
149
           StructuredSDFG& sdfg,
150
           analysis::AnalysisManager& analysis_manager,
151
           structured_control_flow::ControlFlowNode& node,
152
           InstrumentationPlan& instrumentation,
153
           ArgCapturePlan& arg_capture) {
154
            return std::make_unique<ReturnDispatcher>(
1✔
155
                language_extension,
1✔
156
                sdfg,
1✔
157
                analysis_manager,
1✔
158
                static_cast<structured_control_flow::Return&>(node),
1✔
159
                instrumentation,
1✔
160
                arg_capture
1✔
161
            );
162
        }
163
    );
164
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
165
        typeid(structured_control_flow::Break),
2✔
166
        [](LanguageExtension& language_extension,
3✔
167
           StructuredSDFG& sdfg,
168
           analysis::AnalysisManager& analysis_manager,
169
           structured_control_flow::ControlFlowNode& node,
170
           InstrumentationPlan& instrumentation,
171
           ArgCapturePlan& arg_capture) {
172
            return std::make_unique<BreakDispatcher>(
1✔
173
                language_extension,
1✔
174
                sdfg,
1✔
175
                analysis_manager,
1✔
176
                static_cast<structured_control_flow::Break&>(node),
1✔
177
                instrumentation,
1✔
178
                arg_capture
1✔
179
            );
180
        }
181
    );
182
    NodeDispatcherRegistry::instance().register_dispatcher(
4✔
183
        typeid(structured_control_flow::Continue),
2✔
184
        [](LanguageExtension& language_extension,
3✔
185
           StructuredSDFG& sdfg,
186
           analysis::AnalysisManager& analysis_manager,
187
           structured_control_flow::ControlFlowNode& node,
188
           InstrumentationPlan& instrumentation,
189
           ArgCapturePlan& arg_capture) {
190
            return std::make_unique<ContinueDispatcher>(
1✔
191
                language_extension,
1✔
192
                sdfg,
1✔
193
                analysis_manager,
1✔
194
                static_cast<structured_control_flow::Continue&>(node),
1✔
195
                instrumentation,
1✔
196
                arg_capture
1✔
197
            );
198
        }
199
    );
200

201
    /* Map dispatchers */
202
    MapDispatcherRegistry::instance().register_map_dispatcher(
4✔
203
        structured_control_flow::ScheduleType_Sequential::value(),
2✔
204
        [](LanguageExtension& language_extension,
3✔
205
           StructuredSDFG& sdfg,
206
           analysis::AnalysisManager& analysis_manager,
207
           structured_control_flow::Map& node,
208
           InstrumentationPlan& instrumentation,
209
           ArgCapturePlan& arg_capture) {
210
            return std::make_unique<
1✔
211
                SequentialMapDispatcher>(language_extension, sdfg, analysis_manager, node, instrumentation, arg_capture);
1✔
212
        }
213
    );
214
    MapDispatcherRegistry::instance().register_map_dispatcher(
4✔
215
        structured_control_flow::ScheduleType_CPU_Parallel::value(),
2✔
216
        [](LanguageExtension& language_extension,
2✔
217
           StructuredSDFG& sdfg,
218
           analysis::AnalysisManager& analysis_manager,
219
           structured_control_flow::Map& node,
220
           InstrumentationPlan& instrumentation,
221
           ArgCapturePlan& arg_capture) {
222
            return std::make_unique<
×
NEW
223
                CPUParallelMapDispatcher>(language_extension, sdfg, analysis_manager, node, instrumentation, arg_capture);
×
224
        }
225
    );
226

227
    // stdlib
228
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
229
        stdlib::LibraryNodeType_Alloca.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
230
        [](LanguageExtension& language_extension,
2✔
231
           const Function& function,
232
           const data_flow::DataFlowGraph& data_flow_graph,
233
           const data_flow::LibraryNode& node) {
234
            return std::make_unique<stdlib::AllocaNodeDispatcher>(
×
235
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::AllocaNode&>(node)
×
236
            );
237
        }
238
    );
239
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
240
        stdlib::LibraryNodeType_Calloc.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
241
        [](LanguageExtension& language_extension,
2✔
242
           const Function& function,
243
           const data_flow::DataFlowGraph& data_flow_graph,
244
           const data_flow::LibraryNode& node) {
245
            return std::make_unique<stdlib::CallocNodeDispatcher>(
×
246
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::CallocNode&>(node)
×
247
            );
248
        }
249
    );
250
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
251
        stdlib::LibraryNodeType_Free.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
252
        [](LanguageExtension& language_extension,
2✔
253
           const Function& function,
254
           const data_flow::DataFlowGraph& data_flow_graph,
255
           const data_flow::LibraryNode& node) {
256
            return std::make_unique<stdlib::FreeNodeDispatcher>(
×
257
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::FreeNode&>(node)
×
258
            );
259
        }
260
    );
261
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
262
        stdlib::LibraryNodeType_Malloc.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<stdlib::MallocNodeDispatcher>(
×
268
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::MallocNode&>(node)
×
269
            );
270
        }
271
    );
272
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
273
        stdlib::LibraryNodeType_Memcpy.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
274
        [](LanguageExtension& language_extension,
2✔
275
           const Function& function,
276
           const data_flow::DataFlowGraph& data_flow_graph,
277
           const data_flow::LibraryNode& node) {
278
            return std::make_unique<stdlib::MemcpyNodeDispatcher>(
×
279
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::MemcpyNode&>(node)
×
280
            );
281
        }
282
    );
283
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
284
        stdlib::LibraryNodeType_Memmove.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
285
        [](LanguageExtension& language_extension,
2✔
286
           const Function& function,
287
           const data_flow::DataFlowGraph& data_flow_graph,
288
           const data_flow::LibraryNode& node) {
289
            return std::make_unique<stdlib::MemmoveNodeDispatcher>(
×
290
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::MemmoveNode&>(node)
×
291
            );
292
        }
293
    );
294
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
295
        stdlib::LibraryNodeType_Memset.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
296
        [](LanguageExtension& language_extension,
2✔
297
           const Function& function,
298
           const data_flow::DataFlowGraph& data_flow_graph,
299
           const data_flow::LibraryNode& node) {
300
            return std::make_unique<stdlib::MemsetNodeDispatcher>(
×
301
                language_extension, function, data_flow_graph, dynamic_cast<const stdlib::MemsetNode&>(node)
×
302
            );
303
        }
304
    );
305

306
    // CallNode
307
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
308
        data_flow::LibraryNodeType_Call.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
309
        [](LanguageExtension& language_extension,
2✔
310
           const Function& function,
311
           const data_flow::DataFlowGraph& data_flow_graph,
312
           const data_flow::LibraryNode& node) {
313
            return std::make_unique<data_flow::CallNodeDispatcher>(
×
314
                language_extension, function, data_flow_graph, dynamic_cast<const data_flow::CallNode&>(node)
×
315
            );
316
        }
317
    );
318
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
319
        data_flow::LibraryNodeType_Invoke.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
320
        [](LanguageExtension& language_extension,
2✔
321
           const Function& function,
322
           const data_flow::DataFlowGraph& data_flow_graph,
323
           const data_flow::LibraryNode& node) {
324
            return std::make_unique<data_flow::InvokeNodeDispatcher>(
×
325
                language_extension, function, data_flow_graph, dynamic_cast<const data_flow::InvokeNode&>(node)
×
326
            );
327
        }
328
    );
329

330
    // BarrierLocal
331
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
332
        data_flow::LibraryNodeType_BarrierLocal.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
333
        [](LanguageExtension& language_extension,
3✔
334
           const Function& function,
335
           const data_flow::DataFlowGraph& data_flow_graph,
336
           const data_flow::LibraryNode& node) {
337
            return std::make_unique<data_flow::BarrierLocalNodeDispatcher>(
1✔
338
                language_extension, function, data_flow_graph, dynamic_cast<const data_flow::BarrierLocalNode&>(node)
1✔
339
            );
340
        }
341
    );
342

343
    // Metadata
344
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
345
        data_flow::LibraryNodeType_Metadata.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
346
        [](LanguageExtension& language_extension,
2✔
347
           const Function& function,
348
           const data_flow::DataFlowGraph& data_flow_graph,
349
           const data_flow::LibraryNode& node) {
350
            return std::make_unique<data_flow::MetadataDispatcher>(
×
351
                language_extension, function, data_flow_graph, dynamic_cast<const data_flow::MetadataNode&>(node)
×
352
            );
353
        }
354
    );
355

356
    // Math
357

358
    // Intrinsic
359
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
360
        math::LibraryNodeType_Intrinsic.value() + "::" + data_flow::ImplementationType_NONE.value(),
2✔
361
        [](LanguageExtension& language_extension,
2✔
362
           const Function& function,
363
           const data_flow::DataFlowGraph& data_flow_graph,
364
           const data_flow::LibraryNode& node) {
365
            return std::make_unique<math::IntrinsicNodeDispatcher>(
×
366
                language_extension, function, data_flow_graph, dynamic_cast<const math::IntrinsicNode&>(node)
×
367
            );
368
        }
369
    );
370

371
    // Dot - BLAS
372
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
373
        math::blas::LibraryNodeType_DOT.value() + "::" + math::blas::ImplementationType_BLAS.value(),
2✔
374
        [](LanguageExtension& language_extension,
2✔
375
           const Function& function,
376
           const data_flow::DataFlowGraph& data_flow_graph,
377
           const data_flow::LibraryNode& node) {
378
            return std::make_unique<math::blas::DotNodeDispatcher_BLAS>(
×
379
                language_extension, function, data_flow_graph, dynamic_cast<const math::blas::DotNode&>(node)
×
380
            );
381
        }
382
    );
383
    // Dot - CUBLAS
384
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
385
        math::blas::LibraryNodeType_DOT.value() + "::" + math::blas::ImplementationType_CUBLAS.value(),
2✔
386
        [](LanguageExtension& language_extension,
2✔
387
           const Function& function,
388
           const data_flow::DataFlowGraph& data_flow_graph,
389
           const data_flow::LibraryNode& node) {
390
            return std::make_unique<math::blas::DotNodeDispatcher_CUBLAS>(
×
391
                language_extension, function, data_flow_graph, dynamic_cast<const math::blas::DotNode&>(node)
×
392
            );
393
        }
394
    );
395

396
    // GEMM - BLAS
397
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
398
        math::blas::LibraryNodeType_GEMM.value() + "::" + math::blas::ImplementationType_BLAS.value(),
2✔
399
        [](LanguageExtension& language_extension,
2✔
400
           const Function& function,
401
           const data_flow::DataFlowGraph& data_flow_graph,
402
           const data_flow::LibraryNode& node) {
403
            return std::make_unique<math::blas::GEMMNodeDispatcher_BLAS>(
×
404
                language_extension, function, data_flow_graph, dynamic_cast<const math::blas::GEMMNode&>(node)
×
405
            );
406
        }
407
    );
408
    // GEMM - CUBLAS
409
    LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
4✔
410
        math::blas::LibraryNodeType_GEMM.value() + "::" + math::blas::ImplementationType_CUBLAS.value(),
2✔
411
        [](LanguageExtension& language_extension,
2✔
412
           const Function& function,
413
           const data_flow::DataFlowGraph& data_flow_graph,
414
           const data_flow::LibraryNode& node) {
415
            return std::make_unique<math::blas::GEMMNodeDispatcher_CUBLAS>(
×
416
                language_extension, function, data_flow_graph, dynamic_cast<const math::blas::GEMMNode&>(node)
×
417
            );
418
        }
419
    );
420
}
2✔
421

422
} // namespace codegen
423
} // 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