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

daisytuner / sdfglib / 15656007340

14 Jun 2025 08:51PM UTC coverage: 13.234% (-49.9%) from 63.144%
15656007340

Pull #76

github

web-flow
Merge 9586c8161 into 413c53212
Pull Request #76: New Loop Dependency Analysis

361 of 465 new or added lines in 7 files covered. (77.63%)

6215 existing lines in 110 files now uncovered.

1612 of 12181 relevant lines covered (13.23%)

13.64 hits per line

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

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

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

5
using json = nlohmann::json;
6

7
namespace sdfg {
8

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

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

UNCOV
43
std::string Function::name() const { return this->name_; };
×
44

UNCOV
45
FunctionType Function::type() const { return this->type_; };
×
46

47
bool Function::exists(const std::string& name) const {
45✔
48
    return this->containers_.find(name) != this->containers_.end() ||
45✔
UNCOV
49
           symbolic::is_pointer(symbolic::symbol(name)) || symbolic::is_nv(symbolic::symbol(name));
×
50
};
×
51

52
const types::IType& Function::type(const std::string& name) const {
45✔
53
    if (symbolic::is_nv(symbolic::symbol(name))) {
45✔
54
        return *NVPTX_SYMBOL_TYPE;
×
55
    }
56
    if (symbolic::is_pointer(symbolic::symbol(name))) {
45✔
57
        return *CONST_POINTER_TYPE;
×
58
    }
59

60
    auto entry = this->containers_.find(name);
45✔
61
    if (entry == this->containers_.end()) {
45✔
62
        throw InvalidSDFGException("Type: Container " + name + " not found");
×
63
    }
64
    return *entry->second;
45✔
65
};
45✔
66

UNCOV
67
const types::StructureDefinition& Function::structure(const std::string& name) const {
×
UNCOV
68
    auto entry = this->structures_.find(name);
×
UNCOV
69
    if (entry == this->structures_.end()) {
×
70
        throw InvalidSDFGException("Structure: " + name + " not found");
×
71
    }
UNCOV
72
    return *entry->second;
×
73
};
×
74

UNCOV
75
const std::vector<std::string>& Function::arguments() const { return this->arguments_; };
×
76

UNCOV
77
const std::vector<std::string>& Function::externals() const { return this->externals_; };
×
78

UNCOV
79
bool Function::is_argument(const std::string& name) const {
×
UNCOV
80
    return std::find(this->arguments_.begin(), this->arguments_.end(), name) !=
×
UNCOV
81
           this->arguments_.end();
×
82
};
83

UNCOV
84
bool Function::is_external(const std::string& name) const {
×
UNCOV
85
    return std::find(this->externals_.begin(), this->externals_.end(), name) !=
×
UNCOV
86
           this->externals_.end();
×
87
};
88

UNCOV
89
bool Function::is_internal(const std::string& name) const {
×
UNCOV
90
    return helpers::endswith(name, external_suffix) &&
×
91
           is_external(name.substr(0, name.length() - external_suffix.length()));
×
92
};
×
93

UNCOV
94
bool Function::is_transient(const std::string& name) const {
×
UNCOV
95
    return !this->is_argument(name) && !this->is_external(name) && !this->is_internal(name);
×
96
};
97

UNCOV
98
bool Function::has_assumption(const symbolic::Symbol& symbol) const {
×
UNCOV
99
    return this->assumptions_.find(symbol) != this->assumptions_.end();
×
100
};
101

102
const symbolic::Assumption& Function::assumption(const symbolic::Symbol& symbol) const {
×
103
    auto entry = this->assumptions_.find(symbol);
×
104
    if (entry == this->assumptions_.end()) {
×
105
        throw InvalidSDFGException("Assumption does not exist in SDFG");
×
106
    }
107
    return entry->second;
×
108
};
×
109

110
symbolic::Assumption& Function::assumption(const symbolic::Symbol& symbol) {
2✔
111
    auto entry = this->assumptions_.find(symbol);
2✔
112
    if (entry == this->assumptions_.end()) {
2✔
113
        throw InvalidSDFGException("Assumption does not exist in SDFG");
×
114
    }
115
    return entry->second;
2✔
116
};
×
117

118
const symbolic::Assumptions& Function::assumptions() const { return this->assumptions_; };
39✔
119

UNCOV
120
void Function::add_metadata(const std::string& key, const std::string& value) {
×
UNCOV
121
    this->metadata_[key] = value;
×
UNCOV
122
};
×
123

UNCOV
124
void Function::remove_metadata(const std::string& key) { this->metadata_.erase(key); };
×
125

UNCOV
126
const std::string& Function::metadata(const std::string& key) const {
×
UNCOV
127
    return this->metadata_.at(key);
×
128
};
129

UNCOV
130
const std::unordered_map<std::string, std::string>& Function::metadata() const {
×
UNCOV
131
    return this->metadata_;
×
132
};
133

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