• 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

83.87
/src/types/utils.cpp
1
#include "sdfg/types/utils.h"
2

3
namespace sdfg {
4
namespace types {
5

6
const types::IType& infer_type(const sdfg::Function& function, const types::IType& type,
846✔
7
                               const data_flow::Subset& subset) {
8
    if (subset.empty()) {
846✔
9
        return type;
559✔
10
    }
11

12
    if (auto scalar_type = dynamic_cast<const types::Scalar*>(&type)) {
287✔
NEW
13
        if (!subset.empty()) {
×
NEW
14
            throw InvalidSDFGException("Scalar type must have no subset");
×
15
        }
UNCOV
16
        return *scalar_type;
×
17
    } else if (auto array_type = dynamic_cast<const types::Array*>(&type)) {
287✔
18
        data_flow::Subset element_subset(subset.begin() + 1, subset.end());
115✔
19
        return infer_type(function, array_type->element_type(), element_subset);
115✔
20
    } else if (auto pointer_type = dynamic_cast<const types::Pointer*>(&type)) {
287✔
21
        data_flow::Subset element_subset(subset.begin() + 1, subset.end());
170✔
22
        return infer_type(function, pointer_type->pointee_type(), element_subset);
170✔
23
    } else if (auto structure_type = dynamic_cast<const types::Structure*>(&type)) {
172✔
24
        auto& definition = function.structure(structure_type->name());
2✔
25

26
        data_flow::Subset element_subset(subset.begin() + 1, subset.end());
2✔
27
        auto member = SymEngine::rcp_dynamic_cast<const SymEngine::Integer>(subset.at(0));
2✔
28
        return infer_type(function, definition.member_type(member), element_subset);
2✔
29
    }
2✔
30

NEW
31
    throw InvalidSDFGException("Type inference failed");
×
32
};
846✔
33

34
std::unique_ptr<types::IType> recombine_array_type(const types::IType& type, uint depth,
21✔
35
                                                   const types::IType& inner_type) {
36
    if (depth == 0) {
21✔
37
        return inner_type.clone();
9✔
38
    } else {
39
        if (auto atype = dynamic_cast<const types::Array*>(&type)) {
12✔
40
            return std::make_unique<types::Array>(
12✔
41
                *recombine_array_type(atype->element_type(), depth - 1, inner_type).get(),
12✔
42
                atype->num_elements(), atype->device_location(), atype->address_space(),
12✔
43
                atype->initializer());
12✔
44
        } else {
45
            throw std::runtime_error("construct_type: Non array types are not supported yet!");
×
46
        }
47
    }
48
};
21✔
49

50
}  // namespace types
51
}  // 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