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

daisytuner / sdfglib / 15262928007

26 May 2025 10:36PM UTC coverage: 58.284% (-2.0%) from 60.304%
15262928007

push

github

web-flow
Merge pull request #36 from daisytuner/sdfg-validation

Introduces new definition of memlets plus sanity checks

104 of 266 new or added lines in 6 files covered. (39.1%)

241 existing lines in 15 files now uncovered.

7908 of 13568 relevant lines covered (58.28%)

96.1 hits per line

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

75.38
/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
const std::unique_ptr<types::Pointer> Function::CONST_POINTER_TYPE =
2✔
10
    std::make_unique<types::Pointer>(types::Scalar(types::PrimitiveType::Void));
2✔
11

12
Function::Function(const std::string& name)
996✔
13
    : name_(name) {
498✔
14

15
      };
498✔
16

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

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

25
const types::IType& Function::type(const std::string& name) const {
1,187✔
26
    if (symbolic::is_nvptx(symbolic::symbol(name))) {
1,187✔
NEW
27
        return *NVPTX_SYMBOL_TYPE;
×
28
    }
29
    if (symbolic::is_pointer(symbolic::symbol(name))) {
1,187✔
NEW
30
        return *CONST_POINTER_TYPE;
×
31
    }
32

33
    auto entry = this->containers_.find(name);
1,187✔
34
    if (entry == this->containers_.end()) {
1,187✔
NEW
35
        throw InvalidSDFGException("Type: Container " + name + " not found");
×
36
    }
37
    return *entry->second;
1,187✔
38
};
1,187✔
39

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

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

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

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

57
bool Function::is_external(const std::string& name) const {
1,079✔
58
    return std::find(this->externals_.begin(), this->externals_.end(), name) !=
2,158✔
59
           this->externals_.end();
1,079✔
60
};
61

62
bool Function::is_internal(const std::string& name) const {
1,247✔
63
    return helpers::endswith(name, external_suffix) &&
1,247✔
64
           is_external(name.substr(0, name.length() - external_suffix.length()));
×
65
};
×
66

67
bool Function::is_transient(const std::string& name) const {
1,431✔
68
    return !this->is_argument(name) && !this->is_external(name) && !this->is_internal(name);
1,431✔
69
};
70

71
bool Function::has_assumption(const symbolic::Symbol& symbol) const {
1✔
72
    return this->assumptions_.find(symbol) != this->assumptions_.end();
1✔
73
};
74

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

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

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

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

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

99
const std::string& Function::metadata(const std::string& key) const {
7✔
100
    return this->metadata_.at(key);
7✔
101
};
102

103
const std::unordered_map<std::string, std::string>& Function::metadata() const {
4✔
104
    return this->metadata_;
4✔
105
};
106

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