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

daisytuner / docc / 26831349290

02 Jun 2026 03:50PM UTC coverage: 61.29% (-0.01%) from 61.302%
26831349290

Pull #725

github

web-flow
Merge a7e2175c0 into 887730e20
Pull Request #725: Tensor node backport

932 of 1642 new or added lines in 52 files covered. (56.76%)

92 existing lines in 33 files now uncovered.

35584 of 58058 relevant lines covered (61.29%)

11020.18 hits per line

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

60.61
/sdfg/src/data_flow/library_nodes/math/tensor/elementwise_ops/cast_node.cpp
1
#include "sdfg/data_flow/library_nodes/math/tensor/elementwise_ops/cast_node.h"
2

3
#include "sdfg/analysis/analysis.h"
4
#include "sdfg/builder/structured_sdfg_builder.h"
5

6
#include "sdfg/analysis/scope_analysis.h"
7

8
namespace sdfg {
9
namespace math {
10
namespace tensor {
11

12
CastNode::CastNode(
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
    types::PrimitiveType target_type,
19
    const data_flow::ImplementationType& impl_type
20
)
21
    : ElementWiseDataflowTensorNode(
28✔
22
          element_id, debug_info, vertex, parent, LibraryNodeType_Cast, shape, "Y", {"X"}, target_type, impl_type
28✔
23
      ) {}
28✔
24

25
ElementWiseDataflowTensorNode::ElementOutput CastNode::expand_operation_dataflow(
26
    builder::StructuredSDFGBuilder& builder,
27
    analysis::AnalysisManager& analysis_manager,
28
    Block& block,
29
    std::vector<ElementInput>& needed_inputs,
30
    types::PrimitiveType expected_type
31
) {
28✔
32
    auto& input = needed_inputs.at(0);
28✔
33

34
    auto& tasklet = builder.add_tasklet(block, data_flow::TaskletCode::assign, "_out", {"_in"});
28✔
35
    input.consumer = &tasklet;
28✔
36
    input.input_conn_index = 0;
28✔
37
    return {.producer = &tasklet, .output_conn_index = 0, .type = expected_type};
28✔
38
}
28✔
39

40
void CastNode::validate(const Function& function) const {
28✔
41
    // For CastNode, skip TensorNode validation, as that includes checking that primitive types match across everything!
42
    // because the whole point of casting is to convert between types
43
    MathNode::validate(function);
28✔
44
    auto& graph = this->get_parent();
28✔
45

46
    validate_all_input_tensors(graph);
28✔
47

48
    if (fixed_quantization_ != QUANTIZATION_MATCH_INPUTS) {
28✔
49
        auto* result = graph.in_edge_for_connector(*this, inputs_.at(0));
28✔
50
        if (!result) {
28✔
NEW
51
            throw InvalidSDFGException("CastNode # " + std::to_string(element_id_) + ": result tensor is not connected");
×
NEW
52
        }
×
53
        if (result->base_type().primitive_type() != fixed_quantization_) {
28✔
54
            throw InvalidSDFGException(
×
NEW
55
                "CastNode #" + std::to_string(element_id_) + ": result tensor has wrong primitive type. Expected " +
×
NEW
56
                types::primitive_type_to_string(fixed_quantization_) + ", got " +
×
NEW
57
                types::primitive_type_to_string(result->base_type().primitive_type())
×
58
            );
×
59
        }
×
60
    }
28✔
61
}
28✔
62

63
std::unique_ptr<data_flow::DataFlowNode> CastNode::
64
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
NEW
65
    return std::unique_ptr<data_flow::DataFlowNode>(new CastNode(
×
NEW
66
        element_id, this->debug_info(), vertex, parent, this->shape_, fixed_quantization_, implementation_type_
×
NEW
67
    ));
×
UNCOV
68
}
×
69

70
} // namespace tensor
71
} // namespace math
72
} // 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