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

daisytuner / docc / 30634500673

31 Jul 2026 01:27PM UTC coverage: 64.806% (+0.1%) from 64.71%
30634500673

push

github

web-flow
Merge pull request #920 from daisytuner/pytorch-any-where

Big & small stuff to get segformer working

486 of 604 new or added lines in 13 files covered. (80.46%)

24 existing lines in 2 files now uncovered.

45593 of 70353 relevant lines covered (64.81%)

723.15 hits per line

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

49.18
/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
    passes::LibNodeExpander::AccessNodeExpand& expansion,
25
    builder::StructuredSDFGBuilder& builder,
26
    structured_control_flow::Sequence& body,
27
    const types::Tensor& input_type,
28
    const types::Tensor& output_type,
29
    const data_flow::Subset& input_subset,
30
    const data_flow::Subset& output_subset
31
) {
1✔
32
    auto& block = builder.add_block(body, {}, this->debug_info());
1✔
33

34
    auto& in_access = expansion.add_indirect_read_access(block, X_INPUT_IDX);
1✔
35
    auto& out_read_access = expansion.add_indirect_read_access(block, RESULT_PTR_IDX);
1✔
36
    auto& out_write_access = expansion.add_indirect_write_access(block, RESULT_PTR_IDX);
1✔
37

38
    bool is_int = types::is_integer(input_type.primitive_type());
1✔
39

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

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

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

68
    return true;
1✔
69
}
1✔
70

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

93
std::optional<structured_control_flow::ReductionOperation> MaxNode::reduction_operation() const {
1✔
94
    return std::make_optional(structured_control_flow::ReductionOperation::Max);
1✔
95
}
1✔
96

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

104
} // namespace tensor
105
} // namespace math
106
} // namespace sdfg
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc