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

daisytuner / docc / 22151769687

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

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.06 hits per line

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

0.0
/sdfg/src/data_flow/library_nodes/math/tensor/reduce_ops/min_node.cpp
1
#include "sdfg/data_flow/library_nodes/math/tensor/reduce_ops/min_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
MinNode::MinNode(
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_Min, shape, axes, keepdims) {}
×
22

23
bool MinNode::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
) {
×
34
    auto& block = builder.add_block(body, {}, this->debug_info());
×
35

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

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

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

47
        builder
×
48
            .add_computational_memlet(block, in_access, tasklet, "_in1", input_subset, input_type, this->debug_info());
×
49
        builder.add_computational_memlet(
×
50
            block, out_read_access, tasklet, "_in2", output_subset, output_type, this->debug_info()
×
51
        );
×
52
        builder.add_computational_memlet(
×
53
            block, tasklet, "_out", out_write_access, output_subset, output_type, this->debug_info()
×
54
        );
×
55
    } else {
×
56
        // For floating-point, use the correct fmin intrinsic
57
        auto& libnode = builder.add_library_node<
×
58
            math::cmath::CMathNode>(block, this->debug_info(), cmath::CMathFunction::fmin, 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;
×
71
}
×
72

NEW
73
std::string MinNode::identity(types::PrimitiveType primitive_type) const {
×
NEW
74
    switch (primitive_type) {
×
NEW
75
        case types::PrimitiveType::Int8:
×
NEW
76
            return "INT8_MAX";
×
NEW
77
        case types::PrimitiveType::Int16:
×
NEW
78
            return "INT16_MAX";
×
NEW
79
        case types::PrimitiveType::Int32:
×
NEW
80
            return "INT32_MAX";
×
NEW
81
        case types::PrimitiveType::Int64:
×
NEW
82
            return "INT64_MAX";
×
NEW
83
        case types::PrimitiveType::UInt8:
×
NEW
84
            return "UINT8_MAX";
×
NEW
85
        case types::PrimitiveType::UInt16:
×
NEW
86
            return "UINT16_MAX";
×
NEW
87
        case types::PrimitiveType::UInt32:
×
NEW
88
            return "UINT32_MAX";
×
NEW
89
        case types::PrimitiveType::UInt64:
×
NEW
90
            return "UINT64_MAX";
×
NEW
91
        default:
×
NEW
92
            return "INFINITY";
×
NEW
93
    }
×
NEW
94
}
×
95

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

103
} // namespace tensor
104
} // namespace math
105
} // 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