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

daisytuner / docc / 27981272983

22 Jun 2026 08:18PM UTC coverage: 61.754% (-0.03%) from 61.782%
27981272983

Pull #781

github

web-flow
Merge bddaa3724 into fe87d162b
Pull Request #781: Extend Segformer benchmarks setup

987 of 1432 new or added lines in 62 files covered. (68.92%)

9 existing lines in 7 files now uncovered.

38121 of 61730 relevant lines covered (61.75%)

993.19 hits per line

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

39.74
/sdfg/src/data_flow/library_nodes/stdlib/memcpy.cpp
1
#include "sdfg/data_flow/library_nodes/stdlib/memcpy.h"
2

3
namespace sdfg {
4
namespace stdlib {
5

6
MemcpyNode::MemcpyNode(
7
    size_t element_id,
8
    const DebugInfo& debug_info,
9
    const graph::Vertex vertex,
10
    data_flow::DataFlowGraph& parent,
11
    const symbolic::Expression count
12
)
13
    : StdlibNode(
8✔
14
          element_id,
8✔
15
          debug_info,
8✔
16
          vertex,
8✔
17
          parent,
8✔
18
          LibraryNodeType_Memcpy,
8✔
19
          {},
8✔
20
          {"_dst", "_src"},
8✔
21
          true,
8✔
22
          data_flow::ImplementationType_NONE
8✔
23
      ),
8✔
24
      count_(count) {}
8✔
25

26
const symbolic::Expression MemcpyNode::count() const { return count_; }
4✔
27

28
void MemcpyNode::validate(const Function& function) const { LibraryNode::validate(function); }
6✔
29

30
symbolic::SymbolSet MemcpyNode::symbols() const {
2✔
31
    auto count_symbols = symbolic::atoms(this->count_);
2✔
32
    return count_symbols;
2✔
33
}
2✔
34

35
std::unique_ptr<data_flow::DataFlowNode> MemcpyNode::
36
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
37
    return std::make_unique<MemcpyNode>(element_id, debug_info_, vertex, parent, count_);
×
38
}
×
39

40
data_flow::PointerAccessType MemcpyNode::pointer_access_type(int input_idx) const {
×
41
    if (input_idx == 0) {
×
42
        return data_flow::PointerAccessMeta::create_full_write_only(count_, true);
×
43
    } else if (input_idx == 1) {
×
44
        return data_flow::PointerAccessMeta::create_read_only(count_, true);
×
45
    } else {
×
46
        return StdlibNode::pointer_access_type(input_idx);
×
47
    }
×
48
}
×
49

50
std::string MemcpyNode::toStr() const { return StdlibNode::toStr() + "(n: " + count_->__str__() + ")"; }
×
51

52
void MemcpyNode::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
53
    this->count_ = symbolic::subs(this->count_, old_expression, new_expression);
×
54
}
×
55

NEW
56
void MemcpyNode::replace(const symbolic::ExpressionMapping& replacements) {
×
NEW
57
    this->count_ = symbolic::subs(this->count_, replacements);
×
NEW
58
}
×
59

60
nlohmann::json MemcpyNodeSerializer::serialize(const data_flow::LibraryNode& library_node) {
×
61
    const MemcpyNode& node = static_cast<const MemcpyNode&>(library_node);
×
62

63
    nlohmann::json j;
×
64
    j["code"] = node.code().value();
×
65

66
    sdfg::serializer::JSONSerializer serializer;
×
67
    j["count"] = serializer.expression(node.count());
×
68

69
    return j;
×
70
}
×
71

72
data_flow::LibraryNode& MemcpyNodeSerializer::deserialize(
73
    const nlohmann::json& j, builder::StructuredSDFGBuilder& builder, structured_control_flow::Block& parent
74
) {
×
75
    assert(j.contains("code"));
×
76
    assert(j.contains("debug_info"));
×
77
    assert(j.contains("count"));
×
78

79
    auto code = j["code"].get<std::string>();
×
80
    if (code != LibraryNodeType_Memcpy.value()) {
×
81
        throw InvalidSDFGException("Invalid library node code");
×
82
    }
×
83

84
    // Extract debug info using JSONSerializer
85
    sdfg::serializer::JSONSerializer serializer;
×
86
    DebugInfo debug_info = serializer.json_to_debug_info(j["debug_info"]);
×
87

88
    // Extract properties
89
    auto count = symbolic::parse(j.at("count"));
×
90

91
    return builder.add_library_node<MemcpyNode>(parent, debug_info, count);
×
92
}
×
93

94
MemcpyNodeDispatcher::MemcpyNodeDispatcher(
95
    codegen::LanguageExtension& language_extension,
96
    const Function& function,
97
    const data_flow::DataFlowGraph& data_flow_graph,
98
    const MemcpyNode& node
99
)
100
    : codegen::LibraryNodeDispatcher(language_extension, function, data_flow_graph, node) {}
×
101

102
void MemcpyNodeDispatcher::dispatch_code_with_edges(
103
    codegen::CodegenOutput& out,
104
    std::vector<codegen::DispatchInput>& inputs,
105
    std::vector<codegen::DispatchOutput>& outputs
106
) {
×
107
    auto& node = static_cast<const MemcpyNode&>(node_);
×
108

109
    out.stream << language_extension_.external_prefix() << "memcpy(" << inputs.at(0).expr << ", " << inputs.at(1).expr
×
110
               << ", " << language_extension_.expression(node.count()) << ")" << ";";
×
111
    out.stream << std::endl;
×
112
}
×
113

114
MemcpyNode& add_memcpy_node(
115
    builder::StructuredSDFGBuilder& builder,
116
    Block& block,
117
    const std::string& src_ptr,
118
    const std::string& dst_ptr,
119
    const symbolic::Expression& count,
120
    const types::IType& ptr_type,
121
    DebugInfo debug_info
122
) {
8✔
123
    auto& src_ptr_access = builder.add_access(block, src_ptr);
8✔
124
    auto& dst_ptr_access = builder.add_access(block, dst_ptr);
8✔
125
    auto& libnode = builder.add_library_node<stdlib::MemcpyNode>(block, debug_info, count);
8✔
126
    builder.add_computational_memlet(block, src_ptr_access, libnode, "_src", {}, ptr_type);
8✔
127
    builder.add_computational_memlet(block, dst_ptr_access, libnode, "_dst", {}, ptr_type);
8✔
128

129
    return static_cast<MemcpyNode&>(libnode);
8✔
130
}
8✔
131

132
std::tuple<Block&, MemcpyNode&> add_memcpy_block(
133
    builder::StructuredSDFGBuilder& builder,
134
    Sequence& parent,
135
    const std::string& src_ptr,
136
    const std::string& dst_ptr,
137
    const symbolic::Expression& count,
138
    const types::IType& ptr_type,
139
    DebugInfo debug_info
140
) {
8✔
141
    auto& block = builder.add_block(parent);
8✔
142

143
    auto& libnode = add_memcpy_node(builder, block, src_ptr, dst_ptr, count, ptr_type, debug_info);
8✔
144

145
    return {block, libnode};
8✔
146
}
8✔
147

148
} // namespace stdlib
149
} // 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