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

daisytuner / sdfglib / 20770413849

06 Jan 2026 10:50PM UTC coverage: 62.168% (+21.4%) from 40.764%
20770413849

push

github

web-flow
Merge pull request #433 from daisytuner/clang-coverage

updates clang coverage flags

14988 of 24109 relevant lines covered (62.17%)

88.57 hits per line

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

72.41
/src/data_flow/library_nodes/math/tensor/elementwise_ops/elu_node.cpp
1
#include "sdfg/data_flow/library_nodes/math/tensor/elementwise_ops/elu_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
EluNode::EluNode(
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_Elu, shape) {
4✔
22
    this->inputs_.push_back("alpha");
4✔
23
}
4✔
24

25
bool EluNode::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
) {
4✔
35
    // Add code
36
    auto& code_block = builder.add_block(body);
4✔
37
    auto& input_node = builder.add_access(code_block, input_name);
4✔
38
    auto& output_node_exp = builder.add_access(code_block, output_name);
4✔
39
    auto& output_node_sub = builder.add_access(code_block, output_name);
4✔
40
    auto& output_node_mul = builder.add_access(code_block, output_name);
4✔
41

42
    sdfg::types::Scalar element_type(output_type.primitive_type());
4✔
43

44
    // 1. exp(x)
45
    {
4✔
46
        auto& tasklet = builder.add_library_node<math::cmath::CMathNode>(
4✔
47
            code_block, code_block.debug_info(), cmath::CMathFunction::exp, input_type.primitive_type()
4✔
48
        );
4✔
49
        builder.add_computational_memlet(code_block, input_node, tasklet, "_in1", subset, input_type);
4✔
50
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_exp, subset, output_type);
4✔
51
    }
4✔
52
    // 2. x - 1.0f
53
    {
4✔
54
        auto& one_node = builder.add_constant(code_block, "1.0", element_type);
4✔
55
        auto& tasklet = builder.add_tasklet(code_block, data_flow::TaskletCode::fp_sub, "_out", {"_in1", "_in2"});
4✔
56
        builder.add_computational_memlet(code_block, output_node_exp, tasklet, "_in1", subset, output_type);
4✔
57
        builder.add_computational_memlet(code_block, one_node, tasklet, "_in2", {}, element_type);
4✔
58
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_sub, subset, output_type);
4✔
59
    }
4✔
60
    // 3. alpha * x
61
    {
4✔
62
        auto& tasklet = builder.add_tasklet(code_block, data_flow::TaskletCode::fp_mul, "_out", {"_in1", "_in2"});
4✔
63
        builder.add_computational_memlet(code_block, output_node_sub, tasklet, "_in1", subset, output_type);
4✔
64
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_mul, subset, output_type);
4✔
65

66
        // Find alpha node
67
        auto& graph = this->get_parent();
4✔
68
        const data_flow::Memlet* alpha_memlet = nullptr;
4✔
69
        for (auto& in_edge : graph.in_edges(*this)) {
4✔
70
            if (in_edge.dst_conn() == "alpha") {
4✔
71
                alpha_memlet = &in_edge;
×
72
                break;
×
73
            }
×
74
        }
4✔
75

76
        data_flow::AccessNode* alpha_node = nullptr;
4✔
77
        if (alpha_memlet) {
4✔
78
            auto& src = dynamic_cast<const data_flow::AccessNode&>(alpha_memlet->src());
×
79
            if (auto const_node = dynamic_cast<const data_flow::ConstantNode*>(&src)) {
×
80
                alpha_node = &builder.add_constant(code_block, const_node->data(), const_node->type());
×
81
            } else {
×
82
                alpha_node = &builder.add_access(code_block, src.data());
×
83
            }
×
84
            builder.add_computational_memlet(
×
85
                code_block, *alpha_node, tasklet, "_in2", alpha_memlet->subset(), alpha_memlet->base_type()
×
86
            );
×
87
        } else {
4✔
88
            alpha_node = &builder.add_constant(code_block, "1.0", element_type);
4✔
89
            builder.add_computational_memlet(code_block, *alpha_node, tasklet, "_in2", {}, element_type);
4✔
90
        }
4✔
91
    }
4✔
92

93
    return true;
4✔
94
}
4✔
95

96
std::unique_ptr<data_flow::DataFlowNode> EluNode::
97
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
98
    return std::unique_ptr<
×
99
        data_flow::DataFlowNode>(new EluNode(element_id, this->debug_info(), vertex, parent, this->shape_));
×
100
}
×
101

102
} // namespace tensor
103
} // namespace math
104
} // 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