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

daisytuner / sdfglib / 21475859063

29 Jan 2026 11:10AM UTC coverage: 66.34% (+0.5%) from 65.843%
21475859063

Pull #481

github

web-flow
Merge f2b89efe1 into a924afda9
Pull Request #481: Refactor cutout

100 of 187 new or added lines in 8 files covered. (53.48%)

3 existing lines in 3 files now uncovered.

22687 of 34198 relevant lines covered (66.34%)

383.22 hits per line

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

74.55
/sdfg/src/serializer/cutout_serializer.cpp
1
#include "sdfg/serializer/cutout_serializer.h"
2

3
#include <boost/iostreams/detail/select.hpp>
4
#include <cassert>
5

6
#include "sdfg/analysis/arguments_analysis.h"
7
#include "sdfg/analysis/users.h"
8
#include "sdfg/builder/structured_sdfg_builder.h"
9
#include "sdfg/codegen/utils.h"
10

11

12
#include "symengine/expression.h"
13
#include "symengine/logic.h"
14
#include "symengine/symengine_rcp.h"
15

16
namespace sdfg {
17
namespace serializer {
18

19
nlohmann::json CutoutSerializer::serialize(
20
    const sdfg::StructuredSDFG& sdfg,
21
    analysis::AnalysisManager* analysis_manager,
22
    structured_control_flow::Sequence* cutout_root
23
) {
1✔
24
    nlohmann::json j;
1✔
25

26
    j["name"] = sdfg.name() + std::to_string(cutout_root->element_id());
1✔
27
    j["element_counter"] = sdfg.element_counter();
1✔
28
    j["type"] = std::string(sdfg.type().value());
1✔
29

30
    // return type is always void
31
    nlohmann::json return_type_json;
1✔
32
    sdfg::types::Scalar return_type(sdfg::types::StorageType::CPU_Stack(), 0, "", sdfg::types::PrimitiveType::Void);
1✔
33
    type_to_json(return_type_json, return_type);
1✔
34
    j["return_type"] = return_type_json;
1✔
35

36
    j["structures"] = nlohmann::json::array();
1✔
37
    for (const auto& structure_name : sdfg.structures()) {
1✔
NEW
38
        const auto& structure = sdfg.structure(structure_name);
×
NEW
39
        nlohmann::json structure_json;
×
NEW
40
        structure_definition_to_json(structure_json, structure);
×
NEW
41
        j["structures"].push_back(structure_json);
×
NEW
42
    }
×
43

44
    auto& users_analysis = analysis_manager->get<analysis::Users>();
1✔
45
    sdfg::analysis::UsersView node_users(users_analysis, *cutout_root);
1✔
46

47
    // Get region arguments
48
    auto& arguments_analysis = analysis_manager->get<analysis::ArgumentsAnalysis>();
1✔
49
    auto& arguments = arguments_analysis.arguments(*analysis_manager, *cutout_root);
1✔
50

51
    j["containers"] = nlohmann::json::object();
1✔
52
    std::unordered_set<std::string> cutout_containers;
1✔
53
    for (const auto& use : node_users.uses()) {
24✔
54
        nlohmann::json desc;
24✔
55
        std::string& container = use->container();
24✔
56

57

58
        if ((arguments.find(container) != arguments.end()) && (arguments.at(container).is_scalar)) {
24✔
NEW
59
            type_to_json(desc, sdfg::codegen::Reference(sdfg.type(container)));
×
60
        } else {
24✔
61
            type_to_json(desc, sdfg.type(container));
24✔
62
        }
24✔
63
        j["containers"][container] = desc;
24✔
64
        cutout_containers.insert(container);
24✔
65
    }
24✔
66

67
    j["arguments"] = nlohmann::json::array();
1✔
68
    for (const auto& argument : arguments) {
3✔
69
        j["arguments"].push_back(argument.first);
3✔
70
        j["containers"][argument.first]["storage_type"]["allocation"] = 0;
3✔
71
        j["containers"][argument.first]["storage_type"]["deallocation"] = 0;
3✔
72
    }
3✔
73

74
    j["externals"] = nlohmann::json::array();
1✔
75
    for (const auto& external : sdfg.externals()) {
1✔
NEW
76
        if (cutout_containers.find(external) == cutout_containers.end()) {
×
NEW
77
            continue;
×
NEW
78
        }
×
NEW
79
        nlohmann::json external_json;
×
NEW
80
        external_json["name"] = external;
×
NEW
81
        external_json["linkage_type"] = sdfg.linkage_type(external);
×
NEW
82
        j["externals"].push_back(external_json);
×
NEW
83
    }
×
84

85
    j["metadata"] = nlohmann::json::object();
1✔
86

87
    // Walk the SDFG
88
    nlohmann::json root_json;
1✔
89
    sequence_to_json(root_json, *cutout_root);
1✔
90
    j["root"] = root_json;
1✔
91

92
    return j;
1✔
93
}
1✔
94

95
} // namespace serializer
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