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

daisytuner / sdfglib / 20621841097

31 Dec 2025 03:18PM UTC coverage: 39.655% (-0.06%) from 39.712%
20621841097

Pull #421

github

web-flow
Merge 7662c1b88 into 3b72c335e
Pull Request #421: Extend tensor library nodes with primitive type support and refactor CMathNode to use enums

14996 of 49220 branches covered (30.47%)

Branch coverage included in aggregate %.

247 of 608 new or added lines in 52 files covered. (40.63%)

38 existing lines in 5 files now uncovered.

12874 of 21062 relevant lines covered (61.12%)

89.39 hits per line

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

41.05
/src/data_flow/library_nodes/math/tensor/reduce_ops/max_node.cpp
1
#include "sdfg/data_flow/library_nodes/math/tensor/reduce_ops/max_node.h"
2

3
#include "sdfg/builder/structured_sdfg_builder.h"
4
#include "sdfg/data_flow/library_nodes/math/cmath/cmath_node.h"
5
#include "sdfg/data_flow/library_nodes/math/tensor/tensor_node.h"
6
#include "sdfg/types/type.h"
7

8
namespace sdfg {
9
namespace math {
10
namespace tensor {
11

12
MaxNode::MaxNode(
1✔
13
    size_t element_id,
14
    const DebugInfo& debug_info,
15
    const graph::Vertex vertex,
16
    data_flow::DataFlowGraph& parent,
17
    const std::vector<symbolic::Expression>& shape,
18
    const std::vector<int64_t>& axes,
19
    bool keepdims
20
)
21
    : ReduceNode(element_id, debug_info, vertex, parent, LibraryNodeType_Max, shape, axes, keepdims) {}
1✔
22

23
bool MaxNode::expand_reduction(
1✔
24
    builder::StructuredSDFGBuilder& builder,
25
    analysis::AnalysisManager& analysis_manager,
26
    structured_control_flow::Sequence& body,
27
    const std::string& input_name,
28
    const std::string& output_name,
29
    const types::IType& input_type,
30
    const types::IType& output_type,
31
    const data_flow::Subset& input_subset,
32
    const data_flow::Subset& output_subset
33
) {
34
    auto& block = builder.add_block(body, {}, this->debug_info());
1!
35

36
    auto& in_access = builder.add_access(block, input_name, this->debug_info());
1✔
37
    auto& out_read_access = builder.add_access(block, output_name, this->debug_info());
1✔
38
    auto& out_write_access = builder.add_access(block, output_name, this->debug_info());
1✔
39

40
    bool is_int = types::is_integer(input_type.primitive_type());
1✔
41

42
    if (is_int) {
1!
43
        // For integers, use tasklet - distinguish between signed and unsigned
44
        auto tasklet_code = TensorNode::get_integer_minmax_tasklet(input_type.primitive_type(), true);
1✔
45
        auto& tasklet = builder.add_tasklet(block, tasklet_code, "_out", {"_in1", "_in2"});
1!
46

47
        builder
2✔
48
            .add_computational_memlet(block, in_access, tasklet, "_in1", input_subset, input_type, this->debug_info());
1!
49
        builder.add_computational_memlet(
2!
50
            block, out_read_access, tasklet, "_in2", output_subset, output_type, this->debug_info()
1!
51
        );
52
        builder.add_computational_memlet(
2!
53
            block, tasklet, "_out", out_write_access, output_subset, output_type, this->debug_info()
1!
54
        );
55
    } else {
1✔
56
        // For floating-point, use the correct fmax intrinsic
NEW
57
        auto& libnode = builder.add_library_node<
×
NEW
58
            math::cmath::CMathNode>(block, this->debug_info(), cmath::CMathFunction::fmax, input_type.primitive_type());
×
59

NEW
60
        builder
×
NEW
61
            .add_computational_memlet(block, in_access, libnode, "_in1", input_subset, input_type, this->debug_info());
×
NEW
62
        builder.add_computational_memlet(
×
NEW
63
            block, out_read_access, libnode, "_in2", output_subset, output_type, this->debug_info()
×
64
        );
NEW
65
        builder.add_computational_memlet(
×
NEW
66
            block, libnode, "_out", out_write_access, output_subset, output_type, this->debug_info()
×
67
        );
68
    }
69

70
    return true;
1✔
71
}
×
72

73
std::string MaxNode::identity() const { return "-INFINITY"; }
1!
74

75
std::unique_ptr<data_flow::DataFlowNode> MaxNode::
76
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
77
    return std::unique_ptr<data_flow::DataFlowNode>(
×
78
        new MaxNode(element_id, this->debug_info(), vertex, parent, this->shape_, this->axes_, this->keepdims_)
×
79
    );
80
}
×
81

82
} // namespace tensor
83
} // namespace math
84
} // 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