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

daisytuner / sdfglib / 17589393671

09 Sep 2025 04:35PM UTC coverage: 61.094% (+1.9%) from 59.145%
17589393671

Pull #219

github

web-flow
Merge a2a473c0b into b8fdeb232
Pull Request #219: stdlib Library Nodes and ConstantNodes

424 of 1357 new or added lines in 74 files covered. (31.25%)

90 existing lines in 32 files now uncovered.

9307 of 15234 relevant lines covered (61.09%)

109.01 hits per line

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

0.0
/src/data_flow/library_nodes/math/ml/clip.cpp
1
#include "sdfg/data_flow/library_nodes/math/ml/clip.h"
2

3
#include "sdfg/analysis/analysis.h"
4
#include "sdfg/builder/structured_sdfg_builder.h"
5

6
#include "sdfg/analysis/scope_analysis.h"
7

8
namespace sdfg {
9
namespace math {
10
namespace ml {
11

12
ClipNode::ClipNode(
×
13
    size_t element_id,
14
    const DebugInfo& debug_info,
15
    const graph::Vertex vertex,
16
    data_flow::DataFlowGraph& parent,
17
    const std::vector<symbolic::Expression>& shape,
18
    const std::string& min,
19
    const std::string& max
20
)
NEW
21
    : ElementWiseUnaryNode(
×
NEW
22
          element_id, debug_info, vertex, parent, LibraryNodeType_Clip, shape, {{"min", min}, {"max", max}}
×
NEW
23
      ) {}
×
24

25
bool ClipNode::expand_operation(
×
26
    builder::StructuredSDFGBuilder& builder,
27
    analysis::AnalysisManager& analysis_manager,
28
    structured_control_flow::Sequence& body,
29
    const std::string& input_name,
30
    const std::string& output_name,
31
    const types::IType& input_type,
32
    const types::IType& output_type,
33
    const data_flow::Subset& subset
34
) {
35
    std::string tmp_name = builder.find_new_name("__tmp");
×
36
    types::Scalar tmp_type(input_type.primitive_type());
×
37
    builder.add_container(tmp_name, tmp_type, false, false);
×
38

39
    // Add code
40
    auto& code_block = builder.add_block(body);
×
41
    auto& input_node_new = builder.add_access(code_block, input_name);
×
42
    auto& output_node_new = builder.add_access(code_block, output_name);
×
43
    auto& tmp_node = builder.add_access(code_block, tmp_name);
×
44

45
    // 1. Clip max
46
    if (!this->attributes_.at("max").empty()) {
×
47
        auto& tasklet =
×
48
            builder.add_tasklet(code_block, data_flow::TaskletCode::min, "_out", {"_in", this->attributes_.at("max")});
×
49
        builder.add_computational_memlet(code_block, input_node_new, tasklet, "_in", subset, input_type);
×
50
        builder.add_computational_memlet(code_block, tasklet, "_out", tmp_node, {}, output_type);
×
51
    } else {
×
52
        auto& tasklet = builder.add_tasklet(code_block, data_flow::TaskletCode::assign, "_out", {"_in"});
×
53
        builder.add_computational_memlet(code_block, input_node_new, tasklet, "_in", subset, input_type);
×
54
        builder.add_computational_memlet(code_block, tasklet, "_out", tmp_node, {}, tmp_type);
×
55
    }
56

57
    // 2. Clip min
58
    if (!this->attributes_.at("min").empty()) {
×
59
        auto& tasklet =
×
60
            builder.add_tasklet(code_block, data_flow::TaskletCode::max, "_out", {"_in", this->attributes_.at("min")});
×
61
        builder.add_computational_memlet(code_block, tmp_node, tasklet, "_in", {}, tmp_type);
×
62
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_new, subset, output_type);
×
63
    } else {
×
64
        auto& tasklet = builder.add_tasklet(code_block, data_flow::TaskletCode::assign, "_out", {"_in"});
×
65
        builder.add_computational_memlet(code_block, tmp_node, tasklet, "_in", {}, tmp_type);
×
66
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_new, subset, output_type);
×
67
    }
68

69
    return true;
70
}
×
71

72
std::unique_ptr<data_flow::DataFlowNode> ClipNode::
73
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
74
    return std::unique_ptr<data_flow::DataFlowNode>(new ClipNode(
×
NEW
75
        element_id,
×
NEW
76
        this->debug_info(),
×
NEW
77
        vertex,
×
NEW
78
        parent,
×
NEW
79
        this->shape_,
×
NEW
80
        this->attributes_.at("min"),
×
NEW
81
        this->attributes_.at("max")
×
82
    ));
83
}
×
84

85
} // namespace ml
86
} // namespace math
87
} // 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