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

daisytuner / docc / 30535446315

30 Jul 2026 10:38AM UTC coverage: 64.738% (+0.02%) from 64.718%
30535446315

push

github

web-flow
Add rsqrt op to frontend (#909)

* Added rsqrt library node
* Added rsqrt c++ unit test
* Added serializer/deserializer test

24 of 29 new or added lines in 4 files covered. (82.76%)

44344 of 68498 relevant lines covered (64.74%)

716.95 hits per line

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

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

3
#include "sdfg/analysis/analysis.h"
4
#include "sdfg/builder/structured_sdfg_builder.h"
5
#include "sdfg/data_flow/library_nodes/math/cmath/cmath_node.h"
6

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

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

24
ElementWiseDataflowTensorNode::ElementOutput RsqrtNode::expand_operation_dataflow(
25
    builder::StructuredSDFGBuilder& builder,
26
    Block& block,
27
    std::vector<ElementInput>& needed_inputs,
28
    types::PrimitiveType expected_type
29
) {
4✔
30
    auto& input = needed_inputs.at(0);
4✔
31
    types::Scalar scalar_type(input.required_type);
4✔
32

33
    // sqrt(x)
34
    auto& sqrt_op = builder.add_library_node<
4✔
35
        math::cmath::CMathNode>(block, block.debug_info(), cmath::CMathFunction::sqrt, input.required_type);
4✔
36
    input.consumer = &sqrt_op;
4✔
37
    input.input_conn_index = 0;
4✔
38

39
    auto& output_node_sqrt = create_tmp_access_node(builder, block, "tmp_rsqrt_sqrt_", scalar_type);
4✔
40
    builder.add_computational_memlet(block, sqrt_op, "_out", output_node_sqrt, {}, scalar_type);
4✔
41

42
    // 1.0 constant
43
    auto& one_node = builder.add_constant(block, "1.0", scalar_type);
4✔
44

45
    // 1.0 / sqrt(x)
46
    auto& div_op = builder.add_tasklet(block, data_flow::TaskletCode::fp_div, "_out", {"_in1", "_in2"});
4✔
47
    builder.add_computational_memlet(block, one_node, div_op, "_in1", {}, scalar_type);
4✔
48
    builder.add_computational_memlet(block, output_node_sqrt, div_op, "_in2", {}, scalar_type);
4✔
49

50
    return {.producer = &div_op, .output_conn_index = 0, .type = input.required_type};
4✔
51
}
4✔
52

53
std::unique_ptr<data_flow::DataFlowNode> RsqrtNode::
NEW
54
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
NEW
55
    return std::unique_ptr<data_flow::DataFlowNode>(new RsqrtNode(
×
NEW
56
        element_id, this->debug_info(), vertex, parent, this->shape_, fixed_quantization_, implementation_type_
×
NEW
57
    ));
×
NEW
58
}
×
59

60
} // namespace tensor
61
} // namespace math
62
} // 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