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

daisytuner / sdfglib / 15512392058

07 Jun 2025 10:47PM UTC coverage: 62.261% (+4.8%) from 57.416%
15512392058

push

github

web-flow
Merge pull request #63 from daisytuner/schedules

Schedules

152 of 194 new or added lines in 24 files covered. (78.35%)

39 existing lines in 7 files now uncovered.

7467 of 11993 relevant lines covered (62.26%)

127.08 hits per line

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

23.96
/src/structured_sdfg.cpp
1
#include "sdfg/structured_sdfg.h"
2

3
#include "sdfg/builder/structured_sdfg_builder.h"
4
#include "sdfg/data_flow/access_node.h"
5
#include "sdfg/data_flow/tasklet.h"
6
#include "sdfg/deepcopy/structured_sdfg_deep_copy.h"
7
#include "sdfg/element.h"
8

9
namespace sdfg {
10

11
StructuredSDFG::StructuredSDFG(const std::string& name, FunctionType type) : Function(name, type) {
443✔
12
    this->root_ = std::unique_ptr<structured_control_flow::Sequence>(
443✔
13
        new structured_control_flow::Sequence(DebugInfo()));
443✔
14
};
443✔
15

UNCOV
16
const structured_control_flow::Sequence& StructuredSDFG::root() const { return *this->root_; };
×
17

18
structured_control_flow::Sequence& StructuredSDFG::root() { return *this->root_; };
1,913✔
19

20
std::unique_ptr<StructuredSDFG> StructuredSDFG::clone() const {
1✔
21
    builder::StructuredSDFGBuilder builder(this->name_, this->type_);
1✔
22
    auto& new_sdfg = builder.subject();
1✔
23

24
    for (auto& structure : this->structures_) {
2✔
25
        new_sdfg.structures_.insert({structure.first, structure.second->clone()});
1✔
26
    }
27

28
    for (auto& container : this->containers_) {
5✔
29
        new_sdfg.containers_.insert({container.first, container.second->clone()});
4✔
30
    }
31

32
    for (auto& arg : this->arguments_) {
2✔
33
        new_sdfg.arguments_.push_back(arg);
1✔
34
    }
35

36
    for (auto& ext : this->externals_) {
2✔
37
        new_sdfg.externals_.push_back(ext);
1✔
38
    }
39

40
    for (auto& entry : this->metadata_) {
1✔
41
        new_sdfg.metadata_[entry.first] = entry.second;
×
42
    }
43

44
    for (auto& assumption : this->assumptions_) {
4✔
45
        new_sdfg.assumptions_.insert({assumption.first, assumption.second});
3✔
46
    }
47

48
    deepcopy::StructuredSDFGDeepCopy copier(builder, new_sdfg.root(), *this->root_);
1✔
49
    auto mapping = copier.insert();
1✔
50

51
    return builder.move();
1✔
52
};
1✔
53

54
size_t StructuredSDFG::num_nodes() const {
×
55
    size_t count = 0;
×
56
    std::set<const ControlFlowNode*> to_visit = {&this->root()};
×
57
    while (!to_visit.empty()) {
×
58
        auto current = *to_visit.begin();
×
59
        to_visit.erase(to_visit.begin());
×
60
        // if instance of block, add children to to_visit
61
        if (auto block = dynamic_cast<const structured_control_flow::Block*>(current)) {
×
62
            count += block->dataflow().nodes().size();
×
63
        } else if (auto sloop_node =
×
64
                       dynamic_cast<const structured_control_flow::StructuredLoop*>(current)) {
×
65
            to_visit.insert(&sloop_node->root());
×
66
        } else if (auto condition_node =
×
67
                       dynamic_cast<const structured_control_flow::IfElse*>(current)) {
×
68
            for (size_t i = 0; i < condition_node->size(); i++) {
×
69
                to_visit.insert(&condition_node->at(i).first);
×
70
            }
×
71
        } else if (auto while_node = dynamic_cast<const structured_control_flow::While*>(current)) {
×
72
            to_visit.insert(&while_node->root());
×
73
        } else if (auto sequence_node =
×
74
                       dynamic_cast<const structured_control_flow::Sequence*>(current)) {
×
75
            for (size_t i = 0; i < sequence_node->size(); i++) {
×
76
                to_visit.insert(&sequence_node->at(i).first);
×
77
            }
×
78
        } else if (dynamic_cast<const structured_control_flow::Return*>(current)) {
×
79
            continue;
×
80
        } else if (auto map_node = dynamic_cast<const structured_control_flow::Map*>(current)) {
×
81
            to_visit.insert(&map_node->root());
×
82
        }
×
83
    }
84
    return count;
×
85
};
×
86

UNCOV
87
const DebugInfo StructuredSDFG::debug_info() const {
×
UNCOV
88
    DebugInfo info;
×
UNCOV
89
    std::set<const ControlFlowNode*> to_visit = {&this->root()};
×
UNCOV
90
    while (!to_visit.empty()) {
×
UNCOV
91
        auto current = *to_visit.begin();
×
UNCOV
92
        to_visit.erase(to_visit.begin());
×
UNCOV
93
        info = DebugInfo::merge(info, current->debug_info());
×
94

95
        // if instance of block, add children to to_visit
UNCOV
96
        if (auto block = dynamic_cast<const structured_control_flow::Block*>(current)) {
×
UNCOV
97
            for (auto& node : block->dataflow().nodes()) {
×
98
                info = DebugInfo::merge(info, node.debug_info());
×
99
            }
UNCOV
100
            for (auto& edge : block->dataflow().edges()) {
×
101
                info = DebugInfo::merge(info, edge.debug_info());
×
102
            }
UNCOV
103
        } else if (auto sloop_node =
×
UNCOV
104
                       dynamic_cast<const structured_control_flow::StructuredLoop*>(current)) {
×
105
            info = DebugInfo::merge(info, sloop_node->debug_info());
×
106
            to_visit.insert(&sloop_node->root());
×
UNCOV
107
        } else if (auto condition_node =
×
UNCOV
108
                       dynamic_cast<const structured_control_flow::IfElse*>(current)) {
×
109
            info = DebugInfo::merge(info, condition_node->debug_info());
×
110
            for (size_t i = 0; i < condition_node->size(); i++) {
×
111
                to_visit.insert(&condition_node->at(i).first);
×
112
            }
×
UNCOV
113
        } else if (auto while_node = dynamic_cast<const structured_control_flow::While*>(current)) {
×
114
            info = DebugInfo::merge(info, while_node->debug_info());
×
115
            to_visit.insert(&while_node->root());
×
UNCOV
116
        } else if (auto sequence_node =
×
UNCOV
117
                       dynamic_cast<const structured_control_flow::Sequence*>(current)) {
×
UNCOV
118
            info = DebugInfo::merge(info, sequence_node->debug_info());
×
UNCOV
119
            for (size_t i = 0; i < sequence_node->size(); i++) {
×
UNCOV
120
                to_visit.insert(&sequence_node->at(i).first);
×
UNCOV
121
                info = DebugInfo::merge(info, sequence_node->at(i).second.debug_info());
×
UNCOV
122
            }
×
UNCOV
123
        } else if (auto return_node =
×
124
                       dynamic_cast<const structured_control_flow::Return*>(current)) {
×
125
            info = DebugInfo::merge(info, return_node->debug_info());
×
126
        } else if (auto map_node = dynamic_cast<const structured_control_flow::Map*>(current)) {
×
127
            info = DebugInfo::merge(info, map_node->debug_info());
×
128
            to_visit.insert(&map_node->root());
×
129
        }
×
130
    }
UNCOV
131
    return info;
×
UNCOV
132
};
×
133

134
}  // 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