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

daisytuner / sdfglib / 15710378262

17 Jun 2025 02:40PM UTC coverage: 63.835% (-0.7%) from 64.576%
15710378262

Pull #86

github

web-flow
Merge 33788b6e3 into 37980e90f
Pull Request #86: Add optimizer functionality

37 of 215 new or added lines in 9 files covered. (17.21%)

12 existing lines in 5 files now uncovered.

8063 of 12631 relevant lines covered (63.84%)

115.87 hits per line

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

0.0
/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

NEW
11
Optimizer::Optimizer() : history_(nlohmann::json::array()) {}
×
12

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

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

NEW
25
        if (transformation_name == "LoopTiling") {
×
NEW
26
            this->apply<transformations::LoopTiling>(builder, analysis_manager, desc);
×
NEW
27
        } else if (transformation_name == "LoopDistribute") {
×
NEW
28
            this->apply<transformations::LoopDistribute>(builder, analysis_manager, desc);
×
NEW
29
        } else if (transformation_name == "LoopInterchange") {
×
NEW
30
            this->apply<transformations::LoopInterchange>(builder, analysis_manager, desc);
×
NEW
31
        } else if (transformation_name == "LoopSlicing") {
×
NEW
32
            this->apply<transformations::LoopSlicing>(builder, analysis_manager, desc);
×
NEW
33
        } else if (transformation_name == "OutLocalStorage") {
×
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
        }
NEW
39
    }
×
NEW
40
}
×
41

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