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

daisytuner / docc / 26556322966

27 May 2026 03:45PM UTC coverage: 60.869% (-0.02%) from 60.886%
26556322966

push

github

web-flow
Libnode ptr edges (#719)

Migrating SDFGs to treat pointers as inputs to libNodes / Calls as scalars.
A pointer will only appear in an output edge if its actually returned from the function (like malloc).

* Stdlib, Blas and Tensor Matmul nodes were migrated to this new format. Other, currently transitory Tensor Nodes are not yet migrated.
* DOCC version was bumped to incorporate previous docc-llvm versions (up to 0.4.0) that had been counted separately.
! Until all passes consider the use / leak of pointers as uncertainty / hiding potential writes, TensorNodes are declared as general side-effect.
* Lots of utility functions to centralize the creation (and edges) of various libNodes that needed to be changed.
* Fixed & unified docc paths across python and llvm front-ends.
* Skip BlockFusion test that fails to its libNodes currently having side effects
~ Prevent a crash in DotViz when using symbolic offsets into structs
* Removing old ConstProp pass, it is not safe for the new pointer representation and should not be all too critical

961 of 1749 new or added lines in 52 files covered. (54.95%)

87 existing lines in 28 files now uncovered.

35225 of 57870 relevant lines covered (60.87%)

11046.32 hits per line

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

82.46
/sdfg/src/data_flow/access_node.cpp
1
#include "sdfg/data_flow/access_node.h"
2

3
#include <unordered_set>
4
#include "sdfg/data_flow/data_flow_graph.h"
5
#include "sdfg/function.h"
6

7
namespace sdfg {
8
namespace data_flow {
9

10
AccessNode::AccessNode(
11
    size_t element_id,
12
    const DebugInfo& debug_info,
13
    const graph::Vertex vertex,
14
    DataFlowGraph& parent,
15
    const std::string& data
16
)
17
    : DataFlowNode(element_id, debug_info, vertex, parent), data_(data) {
7,196✔
18

19
      };
7,196✔
20

21
void AccessNode::validate(const Function& function) const {
11,366✔
22
    if (!function.exists(this->data_)) {
11,366✔
23
        throw InvalidSDFGException("Access node " + this->data_ + " uses non-existent variable");
×
24
    }
×
25

26
    auto& graph = this->get_parent();
11,366✔
27

28
    if (graph.out_degree(*this) > 1) {
11,366✔
29
        MemletType type = (*graph.out_edges(*this).begin()).type();
283✔
30
        for (auto& oedge : graph.out_edges(*this)) {
567✔
31
            if (oedge.type() != type) {
567✔
32
                throw InvalidSDFGException("Access node " + this->data() + " used with multiple memlet types");
×
33
            }
×
34
        }
567✔
35
    }
283✔
36

37
    if (graph.in_degree(*this) > 1) {
11,366✔
38
        MemletType type = (*graph.in_edges(*this).begin()).type();
5✔
39
        for (auto& iedge : graph.in_edges(*this)) {
10✔
40
            if (iedge.type() != type) {
10✔
41
                throw InvalidSDFGException("Access node " + this->data() + " used with multiple memlet types");
×
42
            }
×
43
        }
10✔
44
    }
5✔
45
}
11,366✔
46

47
const std::string& AccessNode::data() const { return this->data_; };
34,088✔
48

49
void AccessNode::data(const std::string data) { this->data_ = data; }
144✔
50

51
bool AccessNode::side_effect() const { return get_parent().in_degree(*this) > 0; }
17✔
52

53
std::unique_ptr<DataFlowNode> AccessNode::clone(size_t element_id, const graph::Vertex vertex, DataFlowGraph& parent)
54
    const {
50✔
55
    return std::unique_ptr<AccessNode>(new AccessNode(element_id, this->debug_info_, vertex, parent, this->data_));
50✔
56
};
50✔
57

58
void AccessNode::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
566✔
59
    if (SymEngine::is_a<SymEngine::Symbol>(*old_expression) && SymEngine::is_a<SymEngine::Symbol>(*new_expression)) {
566✔
60
        auto old_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(old_expression);
429✔
61
        if (this->data_ == old_symbol->get_name()) {
429✔
62
            auto new_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(new_expression);
29✔
63
            this->data_ = new_symbol->get_name();
29✔
64
        }
29✔
65
    }
429✔
66
}
566✔
67

68
/**
69
 * Every read can be removed
70
 */
71
EdgeRemoveOption AccessNode::can_remove_out_edge(const data_flow::DataFlowGraph& graph, const Memlet* memlet) const {
16✔
72
    return EdgeRemoveOption::Trivially;
16✔
73
}
16✔
74

NEW
75
EdgeRemoveOption AccessNode::can_remove_in_edge(const data_flow::DataFlowGraph& graph, const Memlet* memlet) const {
×
NEW
76
    return (graph.out_degree(*this) == 0) ? EdgeRemoveOption::RemoveNodeAfter : EdgeRemoveOption::Trivially;
×
NEW
77
}
×
78

79
bool AccessNode::identicalBackingData(const AccessNode& src1, const AccessNode& src2) {
34✔
80
    return src1.data() == src2.data();
34✔
81
}
34✔
82

83
namespace {
84
bool is_special_constant(const std::string& data) {
71✔
85
    static const std::unordered_set<std::string> constants = {
71✔
86
        "true",
71✔
87
        "false",
71✔
88
        "INT8_MIN",
71✔
89
        "INT8_MAX",
71✔
90
        "UINT8_MAX",
71✔
91
        "INT16_MIN",
71✔
92
        "INT16_MAX",
71✔
93
        "UINT16_MAX",
71✔
94
        "INT32_MIN",
71✔
95
        "INT32_MAX",
71✔
96
        "UINT32_MAX",
71✔
97
        "INT64_MIN",
71✔
98
        "INT64_MAX",
71✔
99
        "UINT64_MAX",
71✔
100
    };
71✔
101
    return constants.find(data) != constants.end();
71✔
102
}
71✔
103
} // namespace
104

105
ConstantNode::ConstantNode(
106
    size_t element_id,
107
    const DebugInfo& debug_info,
108
    const graph::Vertex vertex,
109
    DataFlowGraph& parent,
110
    const std::string& data,
111
    const types::IType& type
112
)
113
    : AccessNode(element_id, debug_info, vertex, parent, data), type_(type.clone()) {};
404✔
114

115
void ConstantNode::validate(const Function& function) const {
655✔
116
    if (function.exists(this->data_)) {
655✔
117
        throw InvalidSDFGException("ConstantNode " + this->data_ + " uses variable");
×
118
    }
×
119

120
    auto& graph = this->get_parent();
655✔
121
    if (graph.in_degree(*this) > 0) {
655✔
122
        throw InvalidSDFGException("ConstantNode " + this->data_ + " has incoming edges");
×
123
    }
×
124

125
    switch (this->type_->type_id()) {
655✔
126
        case types::TypeID::Scalar: {
613✔
127
            auto& scalar_type = static_cast<const types::Scalar&>(*this->type_);
613✔
128
            switch (scalar_type.primitive_type()) {
613✔
129
                case types::PrimitiveType::Bool:
×
130
                case types::PrimitiveType::Int8:
×
131
                case types::PrimitiveType::Int16:
×
132
                case types::PrimitiveType::Int32:
46✔
133
                case types::PrimitiveType::Int64:
49✔
134
                case types::PrimitiveType::UInt8:
49✔
135
                case types::PrimitiveType::UInt16:
49✔
136
                case types::PrimitiveType::UInt32:
63✔
137
                case types::PrimitiveType::UInt64: {
71✔
138
                    auto data = this->data();
71✔
139
                    if (is_special_constant(data)) {
71✔
140
                        break;
×
141
                    }
×
142

143
                    try {
71✔
144
                        helpers::parse_number_signed(data);
71✔
145
                    } catch (const std::exception& e) {
71✔
146
                        throw InvalidSDFGException("ConstantNode " + data + " has non-integer scalar type");
×
147
                    }
×
148
                    break;
71✔
149
                }
71✔
150
                default:
542✔
151
                    break;
542✔
152
            }
613✔
153
            break;
613✔
154
        }
613✔
155
        default:
613✔
156
            break;
42✔
157
    }
655✔
158
}
655✔
159

160
const types::IType& ConstantNode::type() const { return *this->type_; };
292✔
161

162
std::unique_ptr<DataFlowNode> ConstantNode::clone(size_t element_id, const graph::Vertex vertex, DataFlowGraph& parent)
163
    const {
6✔
164
    return std::unique_ptr<
6✔
165
        ConstantNode>(new ConstantNode(element_id, this->debug_info_, vertex, parent, this->data(), *this->type_));
6✔
166
};
6✔
167

168
} // namespace data_flow
169
} // 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