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

daisytuner / sdfglib / 20603090460

30 Dec 2025 06:20PM UTC coverage: 39.276% (-0.3%) from 39.581%
20603090460

push

github

web-flow
Merge pull request #414 from daisytuner/blas-connectors

renames connectors of blas nodes

14694 of 48687 branches covered (30.18%)

Branch coverage included in aggregate %.

85 of 250 new or added lines in 11 files covered. (34.0%)

18 existing lines in 1 file now uncovered.

12557 of 20696 relevant lines covered (60.67%)

86.4 hits per line

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

60.94
/src/data_flow/tasklet.cpp
1
#include "sdfg/data_flow/tasklet.h"
2

3
#include "sdfg/data_flow/data_flow_graph.h"
4
#include "sdfg/symbolic/symbolic.h"
5

6
namespace sdfg {
7
namespace data_flow {
8

9
Tasklet::Tasklet(
377✔
10
    size_t element_id,
11
    const DebugInfo& debug_info,
12
    const graph::Vertex vertex,
13
    DataFlowGraph& parent,
14
    const TaskletCode code,
15
    const std::string& output,
16
    const std::vector<std::string>& inputs
17
)
18
    : CodeNode(element_id, debug_info, vertex, parent, {output}, inputs), code_(code) {};
377!
19

20
void Tasklet::validate(const Function& function) const {
252✔
21
    auto& graph = this->get_parent();
252✔
22

23
    // Validate: inputs match arity
24
    if (arity(this->code_) != this->inputs_.size()) {
252!
25
        throw InvalidSDFGException(
×
NEW
26
            "Tasklet (Code: " + std::to_string(this->code_) + "): Invalid number of inputs. Expected " +
×
27
            std::to_string(arity(this->code_)) + ", got " + std::to_string(this->inputs_.size())
×
28
        );
29
    }
30

31
    // Validate: inputs match type of operation
32
    for (auto& iedge : graph.in_edges(*this)) {
624✔
33
        auto& input_type = iedge.result_type(function);
372✔
34
        if (is_integer(this->code_) && !types::is_integer(input_type.primitive_type())) {
372!
NEW
35
            throw InvalidSDFGException(
×
NEW
36
                "Tasklet (Code: " + std::to_string(this->code_) + "): Integer operation with non-integer input type"
×
37
            );
38
        }
39
        if (is_floating_point(this->code_) && !types::is_floating_point(input_type.primitive_type())) {
372!
NEW
40
            throw InvalidSDFGException(
×
NEW
41
                "Tasklet (Code: " + std::to_string(this->code_) + "): Floating point operation with integer input type"
×
42
            );
43
        }
44
    }
45

46
    // Validate: Graph - No two access nodes for same data
47
    std::unordered_map<std::string, const AccessNode*> input_names;
252✔
48
    for (auto& iedge : graph.in_edges(*this)) {
624!
49
        if (dynamic_cast<const ConstantNode*>(&iedge.src()) != nullptr) {
372!
50
            continue;
89✔
51
        }
52
        auto& src = static_cast<const AccessNode&>(iedge.src());
283!
53
        if (input_names.find(src.data()) != input_names.end()) {
283!
54
            if (input_names.at(src.data()) != &src) {
4!
NEW
55
                throw InvalidSDFGException(
×
NEW
56
                    "Tasklet (Code: " + std::to_string(this->code_) +
×
NEW
57
                    "): Two access nodes with the same data as iedge: " + src.data()
×
58
                );
59
            }
60
        } else {
4✔
61
            input_names.insert({src.data(), &src});
279!
62
        }
63
    }
64
}
252✔
65

66
TaskletCode Tasklet::code() const { return this->code_; };
208✔
67

68

69
bool Tasklet::is_assign() const { return this->code_ == TaskletCode::assign; }
48✔
70

71
bool Tasklet::is_trivial(const Function& function) const {
1✔
72
    if (!this->is_assign()) {
1!
73
        return false;
×
74
    }
75

76
    auto& graph = this->get_parent();
1✔
77
    auto& iedge = *graph.in_edges(*this).begin();
1✔
78
    auto& oedge = *graph.out_edges(*this).begin();
1✔
79
    auto& input_type = iedge.result_type(function);
1✔
80
    auto& output_type = oedge.result_type(function);
1✔
81

82
    return input_type.primitive_type() == output_type.primitive_type();
1✔
83
}
1✔
84

85
bool Tasklet::is_cast(const Function& function) const {
10✔
86
    if (!this->is_assign()) {
10!
87
        return false;
×
88
    }
89

90
    auto& graph = this->get_parent();
10✔
91
    auto& iedge = *graph.in_edges(*this).begin();
10✔
92
    auto& oedge = *graph.out_edges(*this).begin();
10✔
93
    auto& input_type = iedge.result_type(function);
10✔
94
    auto& output_type = oedge.result_type(function);
10✔
95

96
    return input_type.primitive_type() != output_type.primitive_type();
10✔
97
}
10✔
98

99
bool Tasklet::is_zext(const Function& function) const {
10✔
100
    if (!this->is_assign()) {
10!
101
        return false;
×
102
    }
103

104
    auto& graph = this->get_parent();
10✔
105
    auto& iedge = *graph.in_edges(*this).begin();
10✔
106
    auto& oedge = *graph.out_edges(*this).begin();
10✔
107
    auto& input_type = iedge.result_type(function);
10✔
108
    auto& output_type = oedge.result_type(function);
10✔
109

110
    if (!types::is_unsigned(input_type.primitive_type()) || !types::is_unsigned(output_type.primitive_type())) {
10✔
111
        return false;
7✔
112
    }
113
    if (types::bit_width(output_type.primitive_type()) <= types::bit_width(input_type.primitive_type())) {
3✔
114
        return false;
2✔
115
    }
116

117
    return true;
1✔
118
}
10✔
119

120
bool Tasklet::is_sext(const Function& function) const {
1✔
121
    if (!this->is_assign()) {
1!
122
        return false;
×
123
    }
124

125
    auto& graph = this->get_parent();
1✔
126
    auto& iedge = *graph.in_edges(*this).begin();
1✔
127
    auto& oedge = *graph.out_edges(*this).begin();
1✔
128
    auto& input_type = iedge.result_type(function);
1✔
129
    auto& output_type = oedge.result_type(function);
1✔
130

131
    if (types::is_unsigned(input_type.primitive_type()) || types::is_unsigned(output_type.primitive_type())) {
1!
132
        return false;
×
133
    }
134
    if (types::bit_width(output_type.primitive_type()) <= types::bit_width(input_type.primitive_type())) {
1!
135
        return false;
×
136
    }
137

138
    return true;
1✔
139
}
1✔
140

141
bool Tasklet::is_trunc(const Function& function) const {
10✔
142
    if (!this->is_assign()) {
10!
143
        return false;
×
144
    }
145

146
    auto& graph = this->get_parent();
10✔
147
    auto& iedge = *graph.in_edges(*this).begin();
10✔
148
    auto& oedge = *graph.out_edges(*this).begin();
10✔
149
    auto& input_type = iedge.result_type(function);
10✔
150
    auto& output_type = oedge.result_type(function);
10✔
151

152
    if (!types::is_integer(input_type.primitive_type()) || !types::is_integer(output_type.primitive_type())) {
10!
153
        return false;
1✔
154
    }
155
    if (types::is_unsigned(input_type.primitive_type()) != types::is_unsigned(output_type.primitive_type())) {
9✔
156
        return false;
2✔
157
    }
158
    if (types::bit_width(output_type.primitive_type()) >= types::bit_width(input_type.primitive_type())) {
7✔
159
        return false;
6✔
160
    }
161

162
    return true;
1✔
163
}
10✔
164

165
bool Tasklet::is_fptoui(const Function& function) const {
1✔
166
    if (!this->is_assign()) {
1!
167
        return false;
×
168
    }
169

170
    auto& graph = this->get_parent();
1✔
171
    auto& iedge = *graph.in_edges(*this).begin();
1✔
172
    auto& oedge = *graph.out_edges(*this).begin();
1✔
173
    auto& input_type = iedge.result_type(function);
1✔
174
    auto& output_type = oedge.result_type(function);
1✔
175

176
    if (!types::is_floating_point(input_type.primitive_type()) || !types::is_unsigned(output_type.primitive_type())) {
1!
177
        return false;
×
178
    }
179

180
    return true;
1✔
181
}
1✔
182

183
bool Tasklet::is_fptosi(const Function& function) const {
1✔
184
    if (!this->is_assign()) {
1!
185
        return false;
×
186
    }
187

188
    auto& graph = this->get_parent();
1✔
189
    auto& iedge = *graph.in_edges(*this).begin();
1✔
190
    auto& oedge = *graph.out_edges(*this).begin();
1✔
191
    auto& input_type = iedge.result_type(function);
1✔
192
    auto& output_type = oedge.result_type(function);
1✔
193

194
    if (!types::is_floating_point(input_type.primitive_type()) || !types::is_signed(output_type.primitive_type())) {
1!
195
        return false;
×
196
    }
197

198
    return true;
1✔
199
}
1✔
200

201
bool Tasklet::is_uitofp(const Function& function) const {
1✔
202
    if (!this->is_assign()) {
1!
203
        return false;
×
204
    }
205

206
    auto& graph = this->get_parent();
1✔
207
    auto& iedge = *graph.in_edges(*this).begin();
1✔
208
    auto& oedge = *graph.out_edges(*this).begin();
1✔
209
    auto& input_type = iedge.result_type(function);
1✔
210
    auto& output_type = oedge.result_type(function);
1✔
211

212
    if (!types::is_unsigned(input_type.primitive_type()) || !types::is_floating_point(output_type.primitive_type())) {
1!
213
        return false;
×
214
    }
215

216
    return true;
1✔
217
}
1✔
218

219
bool Tasklet::is_sitofp(const Function& function) const {
1✔
220
    if (!this->is_assign()) {
1!
221
        return false;
×
222
    }
223

224
    auto& graph = this->get_parent();
1✔
225
    auto& iedge = *graph.in_edges(*this).begin();
1✔
226
    auto& oedge = *graph.out_edges(*this).begin();
1✔
227
    auto& input_type = iedge.result_type(function);
1✔
228
    auto& output_type = oedge.result_type(function);
1✔
229

230
    if (!types::is_signed(input_type.primitive_type()) || !types::is_floating_point(output_type.primitive_type())) {
1!
231
        return false;
×
232
    }
233

234
    return true;
1✔
235
}
1✔
236

237
bool Tasklet::is_fpext(const Function& function) const {
1✔
238
    if (!this->is_assign()) {
1!
239
        return false;
×
240
    }
241

242
    auto& graph = this->get_parent();
1✔
243
    auto& iedge = *graph.in_edges(*this).begin();
1✔
244
    auto& oedge = *graph.out_edges(*this).begin();
1✔
245
    auto& input_type = iedge.result_type(function);
1✔
246
    auto& output_type = oedge.result_type(function);
1✔
247

248
    if (!types::is_floating_point(input_type.primitive_type()) ||
1!
249
        !types::is_floating_point(output_type.primitive_type())) {
1✔
250
        return false;
×
251
    }
252
    if (types::bit_width(output_type.primitive_type()) <= types::bit_width(input_type.primitive_type())) {
1!
253
        return false;
×
254
    }
255

256
    return true;
1✔
257
}
1✔
258

259
bool Tasklet::is_fptrunc(const Function& function) const {
1✔
260
    if (!this->is_assign()) {
1!
261
        return false;
×
262
    }
263

264
    auto& graph = this->get_parent();
1✔
265
    auto& iedge = *graph.in_edges(*this).begin();
1✔
266
    auto& oedge = *graph.out_edges(*this).begin();
1✔
267
    auto& input_type = iedge.result_type(function);
1✔
268
    auto& output_type = oedge.result_type(function);
1✔
269

270
    if (!types::is_floating_point(input_type.primitive_type()) ||
1!
271
        !types::is_floating_point(output_type.primitive_type())) {
1✔
272
        return false;
×
273
    }
274
    if (types::bit_width(output_type.primitive_type()) >= types::bit_width(input_type.primitive_type())) {
1!
275
        return false;
×
276
    }
277

278
    return true;
1✔
279
}
1✔
280

281
const std::string& Tasklet::output() const { return this->outputs_[0]; };
54✔
282

283
std::unique_ptr<DataFlowNode> Tasklet::clone(size_t element_id, const graph::Vertex vertex, DataFlowGraph& parent)
×
284
    const {
285
    return std::unique_ptr<Tasklet>(
×
286
        new Tasklet(element_id, this->debug_info_, vertex, parent, this->code_, this->outputs_.at(0), this->inputs_)
×
287
    );
288
};
×
289

290
void Tasklet::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {};
2✔
291

292
} // namespace data_flow
293
} // 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