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

daisytuner / docc / 26812579723

02 Jun 2026 10:00AM UTC coverage: 61.302% (+0.3%) from 61.039%
26812579723

push

github

web-flow
Fixes for LLVM frontend (#731)

- Removed catching InvalidSDFGException in LLVM frontend
- Deactivated 8 LLVM test suite tests (6 SEGFAULT, 2 have wrong results)
- Fixed lifting for memcpy, memmove, and memset and added test cases for this
- Fixed bug in BlockSorting
- Fixed bug where the DataDependencyAnalysis tried to get the type of __daisy_nullptr
- DOT visualizer can, now, also handle return states in (unstructured) SDFGs
- Added unit test for DOT visualizer on (unstructured) SDFGs

10 of 15 new or added lines in 4 files covered. (66.67%)

1 existing line in 1 file now uncovered.

35679 of 58202 relevant lines covered (61.3%)

10989.89 hits per line

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

63.49
/sdfg/src/function.cpp
1
#include "sdfg/function.h"
2
#include <cstddef>
3

4
#include "sdfg/symbolic/symbolic.h"
5

6
using json = nlohmann::json;
7

8
namespace sdfg {
9

10
const std::unique_ptr<types::Scalar> Function::NVPTX_SYMBOL_TYPE =
11
    std::make_unique<types::Scalar>(types::PrimitiveType::UInt32);
12
const std::unique_ptr<types::Pointer> Function::CONST_POINTER_TYPE =
13
    std::make_unique<types::Pointer>(types::Scalar(types::PrimitiveType::Void));
14

15
Function::Function(const std::string& name, FunctionType type, const types::IType& return_type)
16
    : element_counter_(0), name_(name), type_(type), return_type_(return_type.clone()) {
1,994✔
17
    if (this->type_ == FunctionType_NV_GLOBAL) {
1,994✔
18
        this->assumptions_[symbolic::threadIdx_x()] =
4✔
19
            symbolic::Assumption::create(symbolic::threadIdx_x(), *NVPTX_SYMBOL_TYPE);
4✔
20
        this->assumptions_[symbolic::threadIdx_y()] =
4✔
21
            symbolic::Assumption::create(symbolic::threadIdx_y(), *NVPTX_SYMBOL_TYPE);
4✔
22
        this->assumptions_[symbolic::threadIdx_z()] =
4✔
23
            symbolic::Assumption::create(symbolic::threadIdx_z(), *NVPTX_SYMBOL_TYPE);
4✔
24
        this->assumptions_[symbolic::blockIdx_x()] =
4✔
25
            symbolic::Assumption::create(symbolic::blockIdx_x(), *NVPTX_SYMBOL_TYPE);
4✔
26
        this->assumptions_[symbolic::blockIdx_y()] =
4✔
27
            symbolic::Assumption::create(symbolic::blockIdx_y(), *NVPTX_SYMBOL_TYPE);
4✔
28
        this->assumptions_[symbolic::blockIdx_z()] =
4✔
29
            symbolic::Assumption::create(symbolic::blockIdx_z(), *NVPTX_SYMBOL_TYPE);
4✔
30
        this->assumptions_[symbolic::blockDim_x()] =
4✔
31
            symbolic::Assumption::create(symbolic::blockDim_x(), *NVPTX_SYMBOL_TYPE);
4✔
32
        this->assumptions_[symbolic::blockDim_y()] =
4✔
33
            symbolic::Assumption::create(symbolic::blockDim_y(), *NVPTX_SYMBOL_TYPE);
4✔
34
        this->assumptions_[symbolic::blockDim_z()] =
4✔
35
            symbolic::Assumption::create(symbolic::blockDim_z(), *NVPTX_SYMBOL_TYPE);
4✔
36
        this->assumptions_[symbolic::gridDim_x()] =
4✔
37
            symbolic::Assumption::create(symbolic::gridDim_x(), *NVPTX_SYMBOL_TYPE);
4✔
38
        this->assumptions_[symbolic::gridDim_y()] =
4✔
39
            symbolic::Assumption::create(symbolic::gridDim_y(), *NVPTX_SYMBOL_TYPE);
4✔
40
        this->assumptions_[symbolic::gridDim_z()] =
4✔
41
            symbolic::Assumption::create(symbolic::gridDim_z(), *NVPTX_SYMBOL_TYPE);
4✔
42
    }
4✔
43
};
1,994✔
44

45
Function::Function(const std::string& name, FunctionType type)
46
    : Function(name, type, types::Scalar(types::PrimitiveType::Void)) {}
×
47

48
const std::string& Function::name() const { return this->name_; };
170✔
49

50
void Function::name(const std::string& name) { this->name_ = name; };
×
51

52
FunctionType Function::type() const { return this->type_; };
68✔
53

54
const types::IType& Function::return_type() const { return *this->return_type_; };
43✔
55

56
size_t Function::element_counter() const { return this->element_counter_; };
26✔
57

58
void Function::validate() const {
2,479✔
59
    // Function type
60
    if (this->type_ != FunctionType_CPU && this->type_ != FunctionType_NV_GLOBAL) {
2,479✔
61
        throw InvalidSDFGException("Function type must be CPU or NV_GLOBAL");
×
62
    }
×
63
};
2,479✔
64

65
bool Function::exists(const std::string& name) const {
17,138✔
66
    return this->containers_.find(name) != this->containers_.end();
17,138✔
67
};
17,138✔
68

69
const types::IType& Function::type(const std::string& name) const {
52,723✔
70
    if (symbolic::is_nullptr(symbolic::symbol(name))) {
52,723✔
NEW
71
        return this->opaque_pointer_;
×
NEW
72
    }
×
73
    auto entry = this->containers_.find(name);
52,723✔
74
    if (entry == this->containers_.end()) {
52,723✔
75
        throw InvalidSDFGException("Type: Container " + name + " not found");
2✔
76
    }
2✔
77
    return *entry->second;
52,721✔
78
};
52,723✔
79

80
const types::StructureDefinition& Function::structure(const std::string& name) const {
32✔
81
    auto entry = this->structures_.find(name);
32✔
82
    if (entry == this->structures_.end()) {
32✔
83
        throw InvalidSDFGException("Structure: " + name + " not found");
×
84
    }
×
85
    return *entry->second;
32✔
86
};
32✔
87

88
const std::vector<std::string>& Function::arguments() const { return this->arguments_; };
371✔
89

90
const std::vector<std::string>& Function::externals() const { return this->externals_; };
78✔
91

92
LinkageType Function::linkage_type(const std::string& name) const {
17✔
93
    auto entry = this->externals_linkage_types_.find(name);
17✔
94
    if (entry == this->externals_linkage_types_.end()) {
17✔
95
        throw InvalidSDFGException("Linkage type: " + name + " not found");
×
96
    }
×
97
    return entry->second;
17✔
98
};
17✔
99

100
bool Function::is_argument(const std::string& name) const {
3,874✔
101
    return std::find(this->arguments_.begin(), this->arguments_.end(), name) != this->arguments_.end();
3,874✔
102
};
3,874✔
103

104
bool Function::is_external(const std::string& name) const {
2,587✔
105
    return std::find(this->externals_.begin(), this->externals_.end(), name) != this->externals_.end();
2,587✔
106
};
2,587✔
107

108
bool Function::is_transient(const std::string& name) const {
3,144✔
109
    return !this->is_argument(name) && !this->is_external(name);
3,144✔
110
};
3,144✔
111

112
symbolic::SymbolSet Function::parameters() const {
×
113
    symbolic::SymbolSet params;
×
114
    for (auto& arg : this->arguments_) {
×
115
        auto& arg_type = this->type(arg);
×
116
        if (auto scalar_type = dynamic_cast<const types::Scalar*>(&arg_type)) {
×
117
            if (scalar_type->is_symbol()) {
×
118
                params.insert(symbolic::symbol(arg));
×
119
            }
×
120
        }
×
121
    }
×
122
    for (auto& ext : this->externals_) {
×
123
        auto& ext_type = this->type(ext);
×
124
        if (auto scalar_type = dynamic_cast<const types::Scalar*>(&ext_type)) {
×
125
            if (scalar_type->is_symbol()) {
×
126
                params.insert(symbolic::symbol(ext));
×
127
            }
×
128
        }
×
129
    }
×
130
    return params;
×
131
};
×
132

133
bool Function::has_assumption(const symbolic::Symbol symbol) const {
1✔
134
    return this->assumptions_.find(symbol) != this->assumptions_.end();
1✔
135
};
1✔
136

137
const symbolic::Assumption& Function::assumption(const symbolic::Symbol symbol) const {
×
138
    auto entry = this->assumptions_.find(symbol);
×
139
    if (entry == this->assumptions_.end()) {
×
140
        throw InvalidSDFGException("Assumption does not exist in SDFG");
×
141
    }
×
142
    return entry->second;
×
143
};
×
144

145
symbolic::Assumption& Function::assumption(const symbolic::Symbol symbol) {
1✔
146
    auto entry = this->assumptions_.find(symbol);
1✔
147
    if (entry == this->assumptions_.end()) {
1✔
148
        throw InvalidSDFGException("Assumption does not exist in SDFG");
×
149
    }
×
150
    return entry->second;
1✔
151
};
1✔
152

153
const symbolic::Assumptions& Function::assumptions() const { return this->assumptions_; };
312✔
154

155
void Function::add_metadata(const std::string& key, const std::string& value) { this->metadata_[key] = value; };
6✔
156

157
void Function::remove_metadata(const std::string& key) { this->metadata_.erase(key); };
2✔
158

159
const std::string& Function::metadata(const std::string& key) const { return this->metadata_.at(key); }
7✔
160

161
const std::string* Function::metadata_if_exists(const std::string& key) const {
×
162
    auto entry = this->metadata_.find(key);
×
163
    if (entry == this->metadata_.end()) {
×
164
        return nullptr;
×
165
    }
×
166
    return &entry->second;
×
167
};
×
168

169
const std::unordered_map<std::string, std::string>& Function::metadata() const { return this->metadata_; };
25✔
170

171
} // 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