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

daisytuner / sdfglib / 20564758202

29 Dec 2025 12:13AM UTC coverage: 40.366% (+1.4%) from 38.976%
20564758202

push

github

web-flow
Merge pull request #409 from daisytuner/lib-nodes-refactor

restructures library nodes

14298 of 45900 branches covered (31.15%)

Branch coverage included in aggregate %.

259 of 388 new or added lines in 19 files covered. (66.75%)

28 existing lines in 2 files now uncovered.

12247 of 19861 relevant lines covered (61.66%)

89.04 hits per line

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

56.03
/src/data_flow/library_nodes/math/tensor/elementwise_ops/hard_sigmoid_node.cpp
1
#include "sdfg/data_flow/library_nodes/math/tensor/elementwise_ops/hard_sigmoid_node.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
#include "sdfg/data_flow/library_nodes/math/cmath/cmath_node.h"
9

10
namespace sdfg {
11
namespace math {
12
namespace tensor {
13

14
HardSigmoidNode::HardSigmoidNode(
4✔
15
    size_t element_id,
16
    const DebugInfo& debug_info,
17
    const graph::Vertex vertex,
18
    data_flow::DataFlowGraph& parent,
19
    const std::vector<symbolic::Expression>& shape
20
)
21
    : ElementWiseUnaryNode(element_id, debug_info, vertex, parent, LibraryNodeType_HardSigmoid, shape) {
4✔
22
    this->inputs_.push_back("alpha");
4!
23
    this->inputs_.push_back("beta");
4!
24
}
4✔
25

26
bool HardSigmoidNode::expand_operation(
4✔
27
    builder::StructuredSDFGBuilder& builder,
28
    analysis::AnalysisManager& analysis_manager,
29
    structured_control_flow::Sequence& body,
30
    const std::string& input_name,
31
    const std::string& output_name,
32
    const types::IType& input_type,
33
    const types::IType& output_type,
34
    const data_flow::Subset& subset
35
) {
36
    // Add code
37
    auto& code_block = builder.add_block(body);
4!
38
    auto& input_node = builder.add_access(code_block, input_name);
4!
39
    auto& output_node_fma = builder.add_access(code_block, output_name);
4!
40
    auto& output_node_min = builder.add_access(code_block, output_name);
4!
41
    auto& output_node_max = builder.add_access(code_block, output_name);
4!
42

43
    // alpha * x + beta
44
    {
45
        auto& tasklet =
4✔
46
            builder.add_tasklet(code_block, data_flow::TaskletCode::fp_fma, "_out", {"_in1", "_in2", "_in3"});
4!
47
        builder.add_computational_memlet(code_block, input_node, tasklet, "_in1", subset, input_type);
4!
48
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_fma, subset, output_type);
4!
49
    }
50
    // min(1, x)
51
    {
52
        auto& one_node = builder.add_constant(code_block, "1.0f", types::Scalar(output_type.primitive_type()));
4!
53
        auto& tasklet =
4✔
54
            builder.add_library_node<math::cmath::CMathNode>(code_block, code_block.debug_info(), "fmin", 2);
4✔
55
        builder.add_computational_memlet(code_block, output_node_fma, tasklet, "_in1", subset, output_type);
4!
56
        builder.add_computational_memlet(code_block, one_node, tasklet, "_in2", subset, output_type);
4!
57
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_min, subset, output_type);
4!
58
    }
59
    // max(0, x)
60
    {
61
        auto& zero_node = builder.add_constant(code_block, "0.0f", types::Scalar(output_type.primitive_type()));
4!
62
        auto& tasklet =
4✔
63
            builder.add_library_node<math::cmath::CMathNode>(code_block, code_block.debug_info(), "fmax", 2);
4✔
64
        builder.add_computational_memlet(code_block, output_node_min, tasklet, "_in1", subset, output_type);
4!
65
        builder.add_computational_memlet(code_block, zero_node, tasklet, "_in2", subset, output_type);
4!
66
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_max, subset, output_type);
4!
67
    }
68

69
    return true;
4✔
70
}
×
71

72
std::unique_ptr<data_flow::DataFlowNode> HardSigmoidNode::
73
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
NEW
74
    return std::unique_ptr<
×
NEW
75
        data_flow::DataFlowNode>(new HardSigmoidNode(element_id, this->debug_info(), vertex, parent, this->shape_));
×
76
}
×
77

78
} // namespace tensor
79
} // namespace math
80
} // 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