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

daisytuner / docc / 28806128926

06 Jul 2026 04:16PM UTC coverage: 62.96%. First build
28806128926

push

github

web-flow
New LibNodeExpansion pass (#740)

* Switched expansion "pipeline" to new LibNodeExpansionPass that can recursively expand using a LibNodeExpander impl.
- removed access to analysis_manager from expansion methods, as those would currently not be appropriately maintained between nodes
+ New expansion API handles more of the boilerplate code (checking for standalone, creating boundary access nodes, removing old elements)
* Also migrated sdfg-json-to-c.cpp to not using the expansion pipeline anymore
* toStr() for ReduceNodes and giving PyStructuredSDFG access to the output_dir for additional dumping
~ DotVisualizer : Fix on nested sequences.
+ DotVisualizer: visualize empty sequences
* DotVisualizer default-enabled show block/loop ids
 * while MathNodes still have an expand-method, the new infrastructure is based upon "Expander" classes. The MathNodeExpander just redirects to the method for now
 ~ Broadcast node still used old ptr-output semantics
 * updated tensor & blas node expand to new expand API, that handles more of the boilerplate code (checking, removing old nodes, creating standalone-replacement nodes)
 - removed Transpose Node. Was unused and on old ptr-semantics
 + StructuredSDFGBuilder.add_sequence_at, add_for_at, add_map_at
 * switched StructuredSDFGBuilder internally to use ptr of Assignments to express using default assignments when needed
 * updated tests to use the new expand_single_math_node helper function, instead of the method directly
 + pass and expand-single helper functions are ready to use other expanders
 + EinsumExpansionPass is basically the legacy ExpansionPass, only restricted to EinsumNodes. It still needs to run in a pipeline to ensure finding multiple EinsumNodes per block. This is temporary, because Einsum is the only node that already supported splitting a block, which the new expansion disallows, as it should handle it itself when needed (but that part is not yet implemented)

594 of 962 new or added lines in 31 files covered. (61.75%)

40554 of 64412 relevant lines covered (62.96%)

963.11 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
    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
) {
×
32
    auto& block = builder.add_block(body, {}, this->debug_info());
×
33

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

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

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

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

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

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

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