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

daisytuner / sdfglib / 15260078402

26 May 2025 06:30PM UTC coverage: 58.306% (-2.0%) from 60.304%
15260078402

Pull #36

github

web-flow
Merge 10e5b777b into ab802a762
Pull Request #36: Introduces new definition of memlets plus sanity checks

97 of 250 new or added lines in 6 files covered. (38.8%)

242 existing lines in 15 files now uncovered.

7901 of 13551 relevant lines covered (58.31%)

95.68 hits per line

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

75.41
/src/function.cpp
1
#include "sdfg/function.h"
2

3
using json = nlohmann::json;
4

5
namespace sdfg {
6

7
const std::unique_ptr<types::Scalar> Function::NVPTX_SYMBOL_TYPE =
8
    std::make_unique<types::Scalar>(types::PrimitiveType::UInt32);
2✔
9

10
Function::Function(const std::string& name)
996✔
11
    : name_(name) {
498✔
12

13
      };
498✔
14

15
std::string Function::name() const { return this->name_; };
747✔
16

17
bool Function::exists(const std::string& name) const {
552✔
18
    return this->containers_.find(name) != this->containers_.end() ||
557✔
19
           symbolic::is_pointer(symbolic::symbol(name)) ||
10✔
20
           symbolic::is_nvptx(symbolic::symbol(name));
5✔
UNCOV
21
};
×
22

23
const types::IType& Function::type(const std::string& name) const {
1,184✔
24
    if (symbolic::is_nvptx(symbolic::symbol(name))) {
1,184✔
NEW
25
        return *NVPTX_SYMBOL_TYPE;
×
26
    }
27

28
    auto entry = this->containers_.find(name);
1,184✔
29
    if (entry == this->containers_.end()) {
1,184✔
NEW
30
        throw InvalidSDFGException("Type: Container " + name + " not found");
×
31
    }
32
    return *entry->second;
1,184✔
33
};
1,184✔
34

35
const types::StructureDefinition& Function::structure(const std::string& name) const {
26✔
36
    auto entry = this->structures_.find(name);
26✔
37
    if (entry == this->structures_.end()) {
26✔
NEW
38
        throw InvalidSDFGException("Structure: " + name + " not found");
×
39
    }
40
    return *entry->second;
26✔
41
};
×
42

43
const std::vector<std::string>& Function::arguments() const { return this->arguments_; };
17✔
44

45
const std::vector<std::string>& Function::externals() const { return this->externals_; };
22✔
46

47
bool Function::is_argument(const std::string& name) const {
1,447✔
48
    return std::find(this->arguments_.begin(), this->arguments_.end(), name) !=
2,894✔
49
           this->arguments_.end();
1,447✔
50
};
51

52
bool Function::is_external(const std::string& name) const {
1,079✔
53
    return std::find(this->externals_.begin(), this->externals_.end(), name) !=
2,158✔
54
           this->externals_.end();
1,079✔
55
};
56

57
bool Function::is_internal(const std::string& name) const {
1,247✔
58
    return helpers::endswith(name, external_suffix) &&
1,247✔
59
           is_external(name.substr(0, name.length() - external_suffix.length()));
×
60
};
×
61

62
bool Function::is_transient(const std::string& name) const {
1,431✔
63
    return !this->is_argument(name) && !this->is_external(name) && !this->is_internal(name);
1,431✔
64
};
65

66
bool Function::has_assumption(const symbolic::Symbol& symbol) const {
1✔
67
    return this->assumptions_.find(symbol) != this->assumptions_.end();
1✔
68
};
69

70
const symbolic::Assumption& Function::assumption(const symbolic::Symbol& symbol) const {
×
71
    auto entry = this->assumptions_.find(symbol);
×
72
    if (entry == this->assumptions_.end()) {
×
73
        throw InvalidSDFGException("Assumption does not exist in SDFG");
×
74
    }
75
    return entry->second;
×
76
};
×
77

78
symbolic::Assumption& Function::assumption(const symbolic::Symbol& symbol) {
1✔
79
    auto entry = this->assumptions_.find(symbol);
1✔
80
    if (entry == this->assumptions_.end()) {
1✔
81
        throw InvalidSDFGException("Assumption does not exist in SDFG");
×
82
    }
83
    return entry->second;
1✔
84
};
×
85

86
const symbolic::Assumptions& Function::assumptions() const { return this->assumptions_; };
49✔
87

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

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

94
const std::string& Function::metadata(const std::string& key) const {
7✔
95
    return this->metadata_.at(key);
7✔
96
};
97

98
const std::unordered_map<std::string, std::string>& Function::metadata() const {
4✔
99
    return this->metadata_;
4✔
100
};
101

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