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

daisytuner / sdfglib / 18318341707

07 Oct 2025 03:48PM UTC coverage: 61.593% (+0.5%) from 61.066%
18318341707

push

github

web-flow
Merge pull request #262 from daisytuner/tasklets

Tasklets, Intrinsics and Library Nodes

84 of 418 new or added lines in 29 files covered. (20.1%)

153 existing lines in 17 files now uncovered.

8979 of 14578 relevant lines covered (61.59%)

103.69 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/elu.cpp
1
#include "sdfg/data_flow/library_nodes/math/ml/elu.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/intrinsic.h"
9

10
namespace sdfg {
11
namespace math {
12
namespace ml {
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
)
NEW
21
    : ElementWiseUnaryNode(element_id, debug_info, vertex, parent, LibraryNodeType_Elu, shape) {
×
NEW
22
        this->inputs_.push_back("alpha");
×
NEW
23
    }
×
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
) {
35
    // Add code
36
    auto& code_block = builder.add_block(body);
×
37
    auto& input_node = builder.add_access(code_block, input_name);
×
38
    auto& output_node_exp = builder.add_access(code_block, output_name);
×
39
    auto& output_node_sub = builder.add_access(code_block, output_name);
×
40
    auto& output_node_mul = builder.add_access(code_block, output_name);
×
41

42
    // 1. exp(x)
43
    {
NEW
44
        auto& tasklet = builder.add_library_node<math::IntrinsicNode>(code_block, code_block.debug_info(), "expf", 1);
×
NEW
45
        builder.add_computational_memlet(code_block, input_node, tasklet, "_in1", subset, input_type);
×
UNCOV
46
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_exp, subset, output_type);
×
47
    }
48
    // 2. x - 1.0f
49
    {
NEW
50
        auto& one_node = builder.add_constant(code_block, "1.0f", types::Scalar(output_type.primitive_type()));
×
NEW
51
        auto& tasklet = builder.add_tasklet(code_block, data_flow::TaskletCode::fp_sub, "_out", {"_in1", "_in2"});
×
NEW
52
        builder.add_computational_memlet(code_block, output_node_exp, tasklet, "_in1", subset, output_type);
×
NEW
53
        builder.add_computational_memlet(code_block, one_node, tasklet, "_in2", subset, output_type);
×
UNCOV
54
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_sub, subset, output_type);
×
55
    }
56
    // 3. alpha * x
57
    {
58
        // Find alpha node
NEW
59
        auto& graph = this->get_parent();
×
NEW
60
        const data_flow::Memlet* alpha_memlet = nullptr;
×
NEW
61
        for (auto& in_edge : graph.in_edges(*this)) {
×
NEW
62
            if (in_edge.dst_conn() == "alpha") {
×
NEW
63
                alpha_memlet = &in_edge;
×
NEW
64
                break;
×
65
            }
66
        }
NEW
67
        assert(alpha_memlet && "Alpha input not connected");
×
68

NEW
69
        auto& src = dynamic_cast<const data_flow::AccessNode&>(alpha_memlet->src());
×
NEW
70
        data_flow::AccessNode* alpha_node = nullptr;
×
NEW
71
        if (auto const_node = dynamic_cast<const data_flow::ConstantNode*>(&src)) {
×
NEW
72
            alpha_node = &builder.add_constant(code_block, const_node->data(), const_node->type());
×
NEW
73
        } else {
×
NEW
74
            alpha_node = &builder.add_access(code_block, src.data());
×
75
        }
76
        
77
        auto& tasklet =
×
NEW
78
            builder.add_tasklet(code_block, data_flow::TaskletCode::fp_mul, "_out", {"_in1", "_in2"});
×
NEW
79
        builder.add_computational_memlet(code_block, output_node_sub, tasklet, "_in1", subset, output_type);
×
NEW
80
        builder.add_computational_memlet(code_block, *alpha_node, tasklet, "_in2", alpha_memlet->subset(), alpha_memlet->base_type());
×
UNCOV
81
        builder.add_computational_memlet(code_block, tasklet, "_out", output_node_mul, subset, output_type);
×
82
    }
83

84
    return true;
×
85
}
×
86

87
std::unique_ptr<data_flow::DataFlowNode> EluNode::
88
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
89
    return std::unique_ptr<data_flow::DataFlowNode>(
×
NEW
90
        new EluNode(element_id, this->debug_info(), vertex, parent, this->shape_)
×
91
    );
92
}
×
93

94
} // namespace ml
95
} // namespace math
96
} // 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