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

daisytuner / docc / 22168646772

18 Feb 2026 06:09PM UTC coverage: 64.742%. First build
22168646772

push

github

web-flow
Merge pull request #526 from daisytuner/native-ndarray

Python - Native Tensor Support: Update operations to use tensor type

2783 of 4104 new or added lines in 42 files covered. (67.81%)

23724 of 36644 relevant lines covered (64.74%)

368.07 hits per line

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

48.21
/sdfg/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(
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(
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::Tensor& input_type,
30
    const types::Tensor& output_type,
31
    const data_flow::Subset& input_subset,
32
    const data_flow::Subset& output_subset
33
) {
1✔
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
1✔
48
            .add_computational_memlet(block, in_access, tasklet, "_in1", input_subset, input_type, this->debug_info());
1✔
49
        builder.add_computational_memlet(
1✔
50
            block, out_read_access, tasklet, "_in2", output_subset, output_type, this->debug_info()
1✔
51
        );
1✔
52
        builder.add_computational_memlet(
1✔
53
            block, tasklet, "_out", out_write_access, output_subset, output_type, this->debug_info()
1✔
54
        );
1✔
55
    } else {
1✔
56
        // For floating-point, use the correct fmax intrinsic
57
        auto& libnode = builder.add_library_node<
×
58
            math::cmath::CMathNode>(block, this->debug_info(), cmath::CMathFunction::fmax, input_type.primitive_type());
×
59

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

70
    return true;
1✔
71
}
1✔
72

73
std::string MaxNode::identity(types::PrimitiveType primitive_type) const {
1✔
74
    switch (primitive_type) {
1✔
NEW
75
        case types::PrimitiveType::Int8:
×
NEW
76
            return "INT8_MIN";
×
NEW
77
        case types::PrimitiveType::Int16:
×
NEW
78
            return "INT16_MIN";
×
NEW
79
        case types::PrimitiveType::Int32:
×
NEW
80
            return "INT32_MIN";
×
81
        case types::PrimitiveType::Int64:
1✔
82
            return "INT64_MIN";
1✔
NEW
83
        case types::PrimitiveType::UInt8:
×
NEW
84
        case types::PrimitiveType::UInt16:
×
NEW
85
        case types::PrimitiveType::UInt32:
×
NEW
86
        case types::PrimitiveType::UInt64:
×
NEW
87
            return "0"; // Minimum unsigned value
×
NEW
88
        default:
×
NEW
89
            return "-INFINITY";
×
90
    }
1✔
91
}
1✔
92

93
std::unique_ptr<data_flow::DataFlowNode> MaxNode::
94
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
95
    return std::unique_ptr<data_flow::DataFlowNode>(
×
96
        new MaxNode(element_id, this->debug_info(), vertex, parent, this->shape_, this->axes_, this->keepdims_)
×
97
    );
×
98
}
×
99

100
} // namespace tensor
101
} // namespace math
102
} // 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