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

daisytuner / docc / 22023884668

14 Feb 2026 08:36PM UTC coverage: 64.903% (-1.4%) from 66.315%
22023884668

Pull #525

github

web-flow
Merge 1d47f8bf2 into 9d01cacd5
Pull Request #525: Step 3 (Native Tensor Support): Refactor Python Frontend

2522 of 3435 new or added lines in 32 files covered. (73.42%)

320 existing lines in 15 files now uncovered.

23204 of 35752 relevant lines covered (64.9%)

370.03 hits per line

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

72.22
/sdfg/src/data_flow/library_nodes/math/tensor/tensor_node.cpp
1
#include "sdfg/data_flow/library_nodes/math/tensor/tensor_node.h"
2

3
#include "sdfg/types/tensor.h"
4

5
namespace sdfg {
6
namespace math {
7
namespace tensor {
8

9
TensorNode::TensorNode(
10
    size_t element_id,
11
    const DebugInfo& debug_info,
12
    const graph::Vertex vertex,
13
    data_flow::DataFlowGraph& parent,
14
    const data_flow::LibraryNodeCode& code,
15
    const std::vector<std::string>& outputs,
16
    const std::vector<std::string>& inputs,
17
    data_flow::ImplementationType impl_type
18
)
19
    : MathNode(element_id, debug_info, vertex, parent, code, outputs, inputs, impl_type) {}
136✔
20

21
void TensorNode::validate(const Function& function) const {
91✔
22
    MathNode::validate(function);
91✔
23

24
    auto& graph = this->get_parent();
91✔
25

26
    // Check that all input memlets are tensor of scalar
27
    for (auto& iedge : graph.in_edges(*this)) {
121✔
28
        if (iedge.base_type().type_id() != types::TypeID::Tensor) {
121✔
UNCOV
29
            throw InvalidSDFGException(
×
NEW
30
                "TensorNode: Input memlet must be of tensor type. Found type: " + iedge.base_type().print()
×
31
            );
×
32
        }
×
33
    }
121✔
34

35
    // Check that all output memlets are tensor of scalar
36
    for (auto& oedge : graph.out_edges(*this)) {
91✔
37
        if (oedge.base_type().type_id() != types::TypeID::Tensor) {
91✔
UNCOV
38
            throw InvalidSDFGException(
×
NEW
39
                "TensorNode: Output memlet must be of tensor type. Found type: " + oedge.base_type().print()
×
40
            );
×
41
        }
×
42
    }
91✔
43

44
    // Validate that all memlets have the same primitive type
45
    types::PrimitiveType prim_type = primitive_type(graph);
91✔
46

47
    // Check if this operation supports integer types
48
    if (!supports_integer_types() && types::is_integer(prim_type)) {
91✔
49
        throw InvalidSDFGException(
1✔
50
            "TensorNode: This operation does not support integer types. Found type: " +
1✔
51
            std::string(types::primitive_type_to_string(prim_type))
1✔
52
        );
1✔
53
    }
1✔
54
}
91✔
55

56
types::PrimitiveType TensorNode::primitive_type(const data_flow::DataFlowGraph& graph) const {
93✔
57
    types::PrimitiveType result_type = types::PrimitiveType::Void;
93✔
58
    bool first = true;
93✔
59

60
    // Check all input edges
61
    for (auto& iedge : graph.in_edges(*this)) {
123✔
62
        types::PrimitiveType edge_type;
123✔
63
        auto& tensor_type = static_cast<const types::Tensor&>(iedge.base_type());
123✔
64
        edge_type = tensor_type.primitive_type();
123✔
65

66
        if (first) {
123✔
67
            result_type = edge_type;
93✔
68
            first = false;
93✔
69
        } else if (result_type != edge_type) {
93✔
70
            throw InvalidSDFGException(
1✔
71
                "TensorNode: All input memlets must have the same primitive type. Found " +
1✔
72
                std::string(types::primitive_type_to_string(result_type)) + " and " +
1✔
73
                std::string(types::primitive_type_to_string(edge_type))
1✔
74
            );
1✔
75
        }
1✔
76
    }
123✔
77

78
    // Check all output edges
79
    for (auto& oedge : graph.out_edges(*this)) {
92✔
80
        types::PrimitiveType edge_type;
92✔
81
        auto& tensor_type = static_cast<const types::Tensor&>(oedge.base_type());
92✔
82
        edge_type = tensor_type.primitive_type();
92✔
83

84
        if (first) {
92✔
85
            result_type = edge_type;
×
86
            first = false;
×
87
        } else if (result_type != edge_type) {
92✔
88
            throw InvalidSDFGException(
×
89
                "TensorNode: All output memlets must have the same primitive type. Found " +
×
90
                std::string(types::primitive_type_to_string(result_type)) + " and " +
×
91
                std::string(types::primitive_type_to_string(edge_type))
×
92
            );
×
93
        }
×
94
    }
92✔
95

96
    if (first) {
92✔
97
        throw InvalidSDFGException("TensorNode: No edges found to determine primitive type");
×
98
    }
×
99

100
    return result_type;
92✔
101
}
92✔
102

103
data_flow::TaskletCode TensorNode::get_integer_minmax_tasklet(types::PrimitiveType prim_type, bool is_max) {
4✔
104
    bool is_signed = types::is_signed(prim_type);
4✔
105
    if (is_max) {
4✔
106
        return is_signed ? data_flow::TaskletCode::int_smax : data_flow::TaskletCode::int_umax;
4✔
107
    } else {
4✔
108
        return is_signed ? data_flow::TaskletCode::int_smin : data_flow::TaskletCode::int_umin;
×
109
    }
×
110
}
4✔
111

112
} // namespace tensor
113
} // namespace math
114
} // 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