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

daisytuner / docc / 30343969514

28 Jul 2026 08:49AM UTC coverage: 64.094% (+0.004%) from 64.09%
30343969514

push

github

web-flow
Add support for elementwise logical not ops (#891)

28 of 39 new or added lines in 4 files covered. (71.79%)

42895 of 66925 relevant lines covered (64.09%)

731.42 hits per line

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

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

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

6
#include "sdfg/data_flow/access_node.h"
7
#include "sdfg/data_flow/library_nodes/math/cmath/cmath_node.h"
8
#include "sdfg/types/type.h"
9

10
namespace sdfg {
11
namespace math {
12
namespace tensor {
13

14
LogicalNotNode::LogicalNotNode(
15
    size_t element_id,
16
    const DebugInfo& debug_info,
17
    const graph::Vertex vertex,
18
    data_flow::DataFlowGraph& parent,
19
    const std::vector<symbolic::Expression>& shape,
20
    QuantizationType quantization,
21
    const data_flow::ImplementationType& impl_type
22
)
23
    : ElementWiseDataflowTensorNode(
16✔
24
          element_id, debug_info, vertex, parent, LibraryNodeType_LogicalNot, shape, "Y", {"X"}, quantization, impl_type
16✔
25
      ) {}
16✔
26

27
ElementWiseDataflowTensorNode::ElementOutput LogicalNotNode::expand_operation_dataflow(
28
    builder::StructuredSDFGBuilder& builder,
29
    Block& block,
30
    std::vector<ElementInput>& needed_inputs,
31
    types::PrimitiveType expected_type
32
) {
16✔
33
    auto input_type = needed_inputs.at(0).required_type;
16✔
34
    // baseline for logical_not is to use a tasklet with a comparison to 0, which will yield 1 for false and 0 for true
35
    auto& const_0 = builder.add_constant(block, "0", types::Scalar(input_type), this->debug_info());
16✔
36

37
    data_flow::TaskletCode tasklet_code;
16✔
38
    if (types::is_integer(input_type)) {
16✔
39
        tasklet_code = data_flow::TaskletCode::int_eq;
8✔
40
    } else if (types::is_floating_point(input_type)) {
8✔
41
        tasklet_code = data_flow::TaskletCode::fp_oeq;
8✔
42
    } else {
8✔
NEW
43
        throw InvalidSDFGException(&"LogicalNotNode: Unsupported expected type for expand_operation_dataflow: "
×
NEW
44
                                       [*types::primitive_type_to_string(input_type)]);
×
NEW
45
    }
×
46

47
    auto& tasklet = builder.add_tasklet(block, tasklet_code, "_out", {"_in0", "_in1"}, this->debug_info());
16✔
48
    builder.add_computational_memlet(block, const_0, tasklet, "_in1", {}, types::Scalar(input_type), this->debug_info());
16✔
49
    auto& input = needed_inputs.at(0);
16✔
50
    input.consumer = &tasklet;
16✔
51
    input.input_conn_index = 0;
16✔
52

53
    return {.producer = &tasklet, .output_conn_index = 0, .type = types::PrimitiveType::Bool};
16✔
54
}
16✔
55

56
void LogicalNotNode::validate(const Function& function) const {
16✔
57
    auto& graph = this->get_parent();
16✔
58

59
    validate_target_tensor(graph);
16✔
60

61
    validate_all_input_tensors(graph);
16✔
62

63
    validate_non_tensor_inputs(graph);
16✔
64
}
16✔
65

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

73
} // namespace tensor
74
} // namespace math
75
} // 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