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

daisytuner / docc / 28218915263

25 Jun 2026 06:08PM UTC coverage: 61.743% (+0.1%) from 61.644%
28218915263

push

github

web-flow
adds reduce as new structured loop type (#802)

* adds Reduce loop to structured loops

* extends For2Map into a general detection of reduce and map

* makes serialization of reduce backward compatible

* counts reduce as fors in loop analysis

* renames serializer for structured loops

* updates verifier

* adds support for FMA

* updates loop report to count map, reduce, for separately

* updates verifier after merge

* removes non-existent api function in tests after merge

* updates transformations to handle reduce

* adds vectorize dispatcher for reduce

* updates xfail for incorrect output

* updates go fast

* updates llvm verifier

* removes torchaudio dependency

705 of 985 new or added lines in 34 files covered. (71.57%)

5 existing lines in 4 files now uncovered.

38837 of 62901 relevant lines covered (61.74%)

977.93 hits per line

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

0.0
/opt/src/targets/vectorize/codegen/vectorize_dispatcher.cpp
1
#include "sdfg/targets/vectorize/codegen/vectorize_dispatcher.h"
2

3
#include "sdfg/targets/vectorize/schedule.h"
4

5
#include <sdfg/analysis/loop_analysis.h>
6
#include <sdfg/analysis/users.h>
7
#include <sdfg/codegen/dispatchers/node_dispatcher_registry.h>
8
#include <sdfg/codegen/dispatchers/sequence_dispatcher.h>
9
#include <sdfg/codegen/instrumentation/instrumentation_info.h>
10
#include <sdfg/structured_control_flow/structured_loop.h>
11

12
namespace sdfg {
13
namespace vectorize {
14

15
VectorizeDispatcher::VectorizeDispatcher(
16
    codegen::LanguageExtension& language_extension,
17
    StructuredSDFG& sdfg,
18
    analysis::AnalysisManager& analysis_manager,
19
    structured_control_flow::StructuredLoop& node,
20
    codegen::InstrumentationPlan& instrumentation_plan,
21
    codegen::ArgCapturePlan& arg_capture_plan
22
)
23
    : NodeDispatcher(language_extension, sdfg, analysis_manager, node, instrumentation_plan, arg_capture_plan),
×
24
      node_(node) {
×
25

26
      };
×
27

28
void VectorizeDispatcher::dispatch_node(
29
    codegen::PrettyPrinter& main_stream,
30
    codegen::PrettyPrinter& globals_stream,
31
    codegen::CodeSnippetFactory& library_snippet_factory
32
) {
×
33
    // Generate code
NEW
34
    if (dynamic_cast<structured_control_flow::Map*>(&node_)) {
×
NEW
35
        main_stream << "// Map" << std::endl;
×
NEW
36
    } else if (dynamic_cast<structured_control_flow::Reduce*>(&node_)) {
×
NEW
37
        main_stream << "// Reduce" << std::endl;
×
NEW
38
    }
×
39

40
    main_stream << "#pragma clang loop vectorize(enable) interleave(enable)" << std::endl;
×
41

42
    main_stream << "for";
×
43
    main_stream << "(";
×
44
    main_stream << node_.indvar()->get_name();
×
45
    main_stream << " = ";
×
46
    main_stream << language_extension_.expression(node_.init());
×
47
    main_stream << ";";
×
48
    main_stream << language_extension_.expression(node_.condition());
×
49
    main_stream << ";";
×
50
    main_stream << node_.indvar()->get_name();
×
51
    main_stream << " = ";
×
52
    main_stream << language_extension_.expression(node_.update());
×
53
    main_stream << ")" << std::endl;
×
54
    main_stream << "{" << std::endl;
×
55

56
    main_stream.setIndent(main_stream.indent() + 4);
×
57
    codegen::SequenceDispatcher
×
58
        dispatcher(language_extension_, sdfg_, analysis_manager_, node_.root(), instrumentation_plan_, arg_capture_plan_);
×
59
    dispatcher.dispatch(main_stream, globals_stream, library_snippet_factory);
×
60
    main_stream.setIndent(main_stream.indent() - 4);
×
61

62
    main_stream << "}" << std::endl;
×
63
};
×
64

NEW
65
codegen::InstrumentationInfo VectorizeDispatcher::instrumentation_info() const {
×
66
    auto& loop_analysis = analysis_manager_.get<analysis::LoopAnalysis>();
×
67
    analysis::LoopInfo loop_info = loop_analysis.loop_info(&node_);
×
68

69
    // Perform FlopAnalysis
70
    std::unordered_map<std::string, std::string> metrics;
×
71
    auto& flop_analysis = analysis_manager_.get<analysis::FlopAnalysis>();
×
72
    auto flop = flop_analysis.get_if_available_for_codegen(&node_);
×
73
    if (!flop.is_null()) {
×
74
        std::string flop_str = language_extension_.expression(flop);
×
75
        metrics.insert({"flop", flop_str});
×
76
    }
×
77

78
    return codegen::InstrumentationInfo(
×
79
        node_.element_id(), codegen::ElementType_Map, codegen::TargetType_CPU_PARALLEL, loop_info, metrics
×
80
    );
×
81
};
×
82

83
} // namespace vectorize
84
} // 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