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

daisytuner / docc / 28302975093

27 Jun 2026 09:55PM UTC coverage: 61.929% (+0.2%) from 61.754%
28302975093

Pull #814

github

web-flow
Merge d9618e50c into 8322f5994
Pull Request #814: Adds GPU reduce dispatchers

567 of 854 new or added lines in 16 files covered. (66.39%)

17 existing lines in 1 file now uncovered.

39450 of 63702 relevant lines covered (61.93%)

968.19 hits per line

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

60.0
/sdfg/src/structured_control_flow/reduce.cpp
1
#include "sdfg/structured_control_flow/reduce.h"
2

3
#include <string>
4

5
#include "sdfg/exceptions.h"
6
#include "sdfg/structured_control_flow/structured_loop.h"
7

8
namespace sdfg {
9
namespace structured_control_flow {
10

11
std::string reduction_operation_to_string(ReductionOperation op) {
3✔
12
    switch (op) {
3✔
13
        case ReductionOperation::Add:
2✔
14
            return "add";
2✔
15
        case ReductionOperation::Mul:
×
16
            return "mul";
×
17
        case ReductionOperation::Min:
×
18
            return "min";
×
19
        case ReductionOperation::Max:
1✔
20
            return "max";
1✔
21
    }
3✔
22
    throw InvalidSDFGException("Reduce: unknown reduction operation");
×
23
}
3✔
24

25
ReductionOperation reduction_operation_from_string(const std::string& value) {
1✔
26
    if (value == "add") {
1✔
27
        return ReductionOperation::Add;
×
28
    } else if (value == "mul") {
1✔
29
        return ReductionOperation::Mul;
×
30
    } else if (value == "min") {
1✔
31
        return ReductionOperation::Min;
×
32
    } else if (value == "max") {
1✔
33
        return ReductionOperation::Max;
1✔
34
    }
1✔
35
    throw InvalidSDFGException("Reduce: unknown reduction operation '" + value + "'");
×
36
}
1✔
37

38
Reduce::Reduce(
39
    size_t element_id,
40
    const DebugInfo& debug_info,
41
    ControlFlowNode* parent,
42
    symbolic::Symbol indvar,
43
    symbolic::Expression init,
44
    symbolic::Expression update,
45
    symbolic::Condition condition,
46
    std::vector<ReductionInfo> reductions,
47
    const ScheduleType& schedule_type
48
)
49
    : StructuredLoop(element_id, debug_info, parent, indvar, init, update, condition, schedule_type),
52✔
50
      reductions_(std::move(reductions)) {};
52✔
51

52
void Reduce::validate(const Function& function) const { StructuredLoop::validate(function); };
250✔
53

54
void Reduce::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
15✔
55
    StructuredLoop::replace(old_expression, new_expression);
15✔
56

57
    if (SymEngine::is_a<SymEngine::Symbol>(*old_expression) && SymEngine::is_a<SymEngine::Symbol>(*new_expression)) {
15✔
58
        const auto& old_name = SymEngine::rcp_static_cast<const SymEngine::Symbol>(old_expression)->get_name();
15✔
59
        const auto& new_name = SymEngine::rcp_static_cast<const SymEngine::Symbol>(new_expression)->get_name();
15✔
60
        for (auto& reduction : this->reductions_) {
19✔
61
            if (reduction.container == old_name) {
19✔
NEW
62
                reduction.container = new_name;
×
NEW
63
            }
×
64
        }
19✔
65
    }
15✔
66
}
15✔
67

NEW
68
void Reduce::replace(const symbolic::ExpressionMapping& replacements) {
×
NEW
69
    StructuredLoop::replace(replacements);
×
70

NEW
71
    for (auto& reduction : this->reductions_) {
×
NEW
72
        auto it = replacements.find(symbolic::symbol(reduction.container));
×
NEW
73
        if (it != replacements.end() && SymEngine::is_a<SymEngine::Symbol>(*it->second)) {
×
NEW
74
            reduction.container = SymEngine::rcp_static_cast<const SymEngine::Symbol>(it->second)->get_name();
×
NEW
75
        }
×
NEW
76
    }
×
NEW
77
}
×
78

79
const std::vector<ReductionInfo>& Reduce::reductions() const { return this->reductions_; };
63✔
80

81
} // namespace structured_control_flow
82
} // 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