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

daisytuner / sdfglib / 15731283590

18 Jun 2025 11:12AM UTC coverage: 64.351% (-0.2%) from 64.576%
15731283590

Pull #86

github

web-flow
Merge 99df43790 into 32b5d7ae4
Pull Request #86: Add optimizer functionality

144 of 227 new or added lines in 9 files covered. (63.44%)

453 existing lines in 14 files now uncovered.

8125 of 12626 relevant lines covered (64.35%)

153.57 hits per line

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

79.41
/src/optimizations/optimizer.cpp
1
#include <sdfg/optimizations/optimizer.h>
2
#include <sdfg/transformations/loop_distribute.h>
3
#include <sdfg/transformations/loop_interchange.h>
4
#include <sdfg/transformations/loop_slicing.h>
5
#include <sdfg/transformations/loop_tiling.h>
6
#include <sdfg/transformations/out_local_storage.h>
7

8
namespace sdfg {
9
namespace optimizations {
10

11
Optimizer::Optimizer() : history_(nlohmann::json::array()) {}
10✔
12

13
void Optimizer::replay(builder::StructuredSDFGBuilder& builder,
3✔
14
                       analysis::AnalysisManager& analysis_manager,
15
                       const nlohmann::json& transformation_data) {
16
    std::cout << "Replaying transformations..." << std::endl;
3✔
17
    std::cout << "Transformation data: " << transformation_data.dump(4) << std::endl;
3✔
18

19
    for (const auto& desc : transformation_data) {
8✔
20
        std::cout << "Processing transformation description: " << std::endl;
5✔
21
        auto transformation_name = desc["transformation_type"];
5✔
22
        std::cout << "Applying transformation: " << transformation_name.get<std::string>()
10✔
23
                  << std::endl;
5✔
24

25
        if (transformation_name == "LoopTiling") {
5✔
26
            this->apply<transformations::LoopTiling>(builder, analysis_manager, desc);
3✔
27
        } else if (transformation_name == "LoopDistribute") {
5✔
NEW
28
            this->apply<transformations::LoopDistribute>(builder, analysis_manager, desc);
×
29
        } else if (transformation_name == "LoopInterchange") {
2✔
30
            this->apply<transformations::LoopInterchange>(builder, analysis_manager, desc);
1✔
31
        } else if (transformation_name == "LoopSlicing") {
2✔
32
            this->apply<transformations::LoopSlicing>(builder, analysis_manager, desc);
1✔
33
        } else if (transformation_name == "OutLocalStorage") {
1✔
NEW
34
            this->apply<transformations::OutLocalStorage>(builder, analysis_manager, desc);
×
NEW
35
        } else {
×
NEW
36
            throw transformations::InvalidTransformationDescriptionException(
×
NEW
37
                "Unknown transformation: " + transformation_name.get<std::string>());
×
38
        }
39
    }
5✔
40
}
3✔
41

42
void Optimizer::save(std::filesystem::path path) const {
3✔
43
    std::ofstream file(path);
3✔
44
    if (!file.is_open()) {
3✔
NEW
45
        throw std::runtime_error("Failed to open file for saving transformations: " +
×
NEW
46
                                 path.string());
×
47
    }
48
    std::cout << "Saving transformations to " << path.string() << std::endl;
3✔
49
    std::cout << history_.dump(4) << std::endl;  // Pretty print with an indent of 4 spaces
3✔
50
    file << history_.dump(4);                    // Pretty print with an indent of 4 spaces
3✔
51
    file.close();
3✔
52
}
3✔
53

54
}  // namespace optimizations
55
}  // 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