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

daisytuner / docc / 26556322966

27 May 2026 03:45PM UTC coverage: 60.869% (-0.02%) from 60.886%
26556322966

push

github

web-flow
Libnode ptr edges (#719)

Migrating SDFGs to treat pointers as inputs to libNodes / Calls as scalars.
A pointer will only appear in an output edge if its actually returned from the function (like malloc).

* Stdlib, Blas and Tensor Matmul nodes were migrated to this new format. Other, currently transitory Tensor Nodes are not yet migrated.
* DOCC version was bumped to incorporate previous docc-llvm versions (up to 0.4.0) that had been counted separately.
! Until all passes consider the use / leak of pointers as uncertainty / hiding potential writes, TensorNodes are declared as general side-effect.
* Lots of utility functions to centralize the creation (and edges) of various libNodes that needed to be changed.
* Fixed & unified docc paths across python and llvm front-ends.
* Skip BlockFusion test that fails to its libNodes currently having side effects
~ Prevent a crash in DotViz when using symbolic offsets into structs
* Removing old ConstProp pass, it is not safe for the new pointer representation and should not be all too critical

961 of 1749 new or added lines in 52 files covered. (54.95%)

87 existing lines in 28 files now uncovered.

35225 of 57870 relevant lines covered (60.87%)

11046.32 hits per line

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

0.0
/opt/src/transformations/offloading/rocm_transform.cpp
1
#include "sdfg/transformations/offloading/rocm_transform.h"
2

3
#include <unordered_set>
4

5
#include "sdfg/structured_control_flow/block.h"
6
#include "sdfg/targets/rocm/rocm_data_offloading_node.h"
7
#include "sdfg/transformations/transformation.h"
8
#include "symengine/symengine_rcp.h"
9

10
namespace sdfg {
11
namespace rocm {
12

13
std::string ROCMTransform::name() const { return "ROCMTransform"; }
×
14

15
void ROCMTransform::add_device_buffer(
16
    builder::StructuredSDFGBuilder& builder,
17
    std::string host_arg_name,
18
    std::string device_arg_name,
19
    symbolic::Expression arg_size
20
) {
×
21
    // Allocate device pointer
22
    auto& sdfg = builder.subject();
×
23
    auto& type = sdfg.type(host_arg_name);
×
24
    auto new_type = type.clone();
×
25
    new_type->storage_type(global_device_storage_type(arg_size));
×
26
    builder.add_container(device_arg_name, *new_type);
×
27
}
×
28

29
void ROCMTransform::allocate_device_arg(
30
    builder::StructuredSDFGBuilder& builder,
31
    Block& alloc_block,
32
    std::string host_arg_name,
33
    std::string device_arg_name,
34
    symbolic::Expression arg_size,
35
    symbolic::Expression page_size
36
) {
×
37
    auto& sdfg = builder.subject();
×
38
    if (!builder.subject().exists(device_arg_name)) {
×
39
        auto& type = sdfg.type(host_arg_name);
×
40
        auto new_type = type.clone();
×
41
        new_type->storage_type(global_device_storage_type(arg_size));
×
42
        new_type->storage_type().allocation(types::StorageType::AllocationType::Unmanaged);
×
43
        new_type->storage_type().deallocation(types::StorageType::AllocationType::Unmanaged);
×
44
        new_type->storage_type().allocation_size(SymEngine::null);
×
45

46
        std::unordered_set<std::string> container_set(sdfg.containers().begin(), sdfg.containers().end());
×
47
        if (container_set.find(device_arg_name) == container_set.end()) {
×
48
            builder.add_container(device_arg_name, *new_type);
×
49
        }
×
50
    }
×
NEW
51
    auto& out_type = builder.subject().type(device_arg_name);
×
52

NEW
53
    offloading::add_offloading_node<ROCMDataOffloadingNode>(
×
NEW
54
        builder,
×
55
        alloc_block,
×
NEW
56
        host_arg_name,
×
NEW
57
        device_arg_name,
×
NEW
58
        offloading::DataTransferDirection::NONE,
×
NEW
59
        offloading::BufferLifecycle::ALLOC,
×
NEW
60
        out_type,
×
NEW
61
        out_type,
×
62
        this->map_.debug_info(),
×
63
        arg_size,
×
NEW
64
        symbolic::zero()
×
65
    );
×
UNCOV
66
}
×
67

68
void ROCMTransform::deallocate_device_arg(
69
    builder::StructuredSDFGBuilder& builder,
70
    Block& dealloc_block,
71
    std::string device_arg_name,
72
    symbolic::Expression arg_size,
73
    symbolic::Expression page_size
74
) {
×
NEW
75
    auto& free_type = builder.subject().type(device_arg_name);
×
NEW
76
    offloading::add_offloading_node<ROCMDataOffloadingNode>(
×
NEW
77
        builder,
×
78
        dealloc_block,
×
NEW
79
        device_arg_name,
×
NEW
80
        device_arg_name,
×
NEW
81
        offloading::DataTransferDirection::NONE,
×
NEW
82
        offloading::BufferLifecycle::FREE,
×
NEW
83
        free_type,
×
NEW
84
        free_type,
×
85
        this->map_.debug_info(),
×
86
        arg_size,
×
NEW
87
        symbolic::zero()
×
88
    );
×
UNCOV
89
}
×
90

91
void ROCMTransform::copy_to_device(
92
    builder::StructuredSDFGBuilder& builder,
93
    const std::string host_arg_name,
94
    std::string device_arg_name,
95
    symbolic::Expression size,
96
    symbolic::Expression page_size,
97
    Block& copy_block
98
) {
×
NEW
99
    offloading::add_offloading_node<ROCMDataOffloadingNode>(
×
NEW
100
        builder,
×
101
        copy_block,
×
NEW
102
        host_arg_name,
×
NEW
103
        device_arg_name,
×
NEW
104
        offloading::DataTransferDirection::H2D,
×
NEW
105
        offloading::BufferLifecycle::NO_CHANGE,
×
NEW
106
        builder.subject().type(host_arg_name),
×
NEW
107
        builder.subject().type(device_arg_name),
×
108
        this->map_.debug_info(),
×
109
        size,
×
NEW
110
        symbolic::integer(0)
×
111
    );
×
UNCOV
112
}
×
113

114
void ROCMTransform::copy_to_device_with_allocation(
115
    builder::StructuredSDFGBuilder& builder,
116
    const std::string host_arg_name,
117
    std::string device_arg_name,
118
    symbolic::Expression size,
119
    symbolic::Expression page_size,
120
    Block& copy_block
121
) {
×
NEW
122
    offloading::add_offloading_node<ROCMDataOffloadingNode>(
×
NEW
123
        builder,
×
124
        copy_block,
×
NEW
125
        host_arg_name,
×
NEW
126
        device_arg_name,
×
NEW
127
        offloading::DataTransferDirection::H2D,
×
NEW
128
        offloading::BufferLifecycle::ALLOC,
×
NEW
129
        builder.subject().type(host_arg_name),
×
NEW
130
        builder.subject().type(device_arg_name),
×
131
        this->map_.debug_info(),
×
132
        size,
×
NEW
133
        symbolic::integer(0)
×
134
    );
×
UNCOV
135
}
×
136

137
void ROCMTransform::copy_from_device(
138
    builder::StructuredSDFGBuilder& builder,
139
    Block& copy_out_block,
140
    const std::string host_arg_name,
141
    std::string device_arg_name,
142
    symbolic::Expression size,
143
    symbolic::Expression page_size
144
) {
×
NEW
145
    offloading::add_offloading_node<ROCMDataOffloadingNode>(
×
NEW
146
        builder,
×
147
        copy_out_block,
×
NEW
148
        host_arg_name,
×
NEW
149
        device_arg_name,
×
NEW
150
        offloading::DataTransferDirection::D2H,
×
NEW
151
        offloading::BufferLifecycle::NO_CHANGE,
×
NEW
152
        builder.subject().type(host_arg_name),
×
NEW
153
        builder.subject().type(device_arg_name),
×
154
        this->map_.debug_info(),
×
155
        size,
×
NEW
156
        symbolic::integer(0)
×
157
    );
×
UNCOV
158
}
×
159

160
void ROCMTransform::copy_from_device_with_free(
161
    builder::StructuredSDFGBuilder& builder,
162
    Block& copy_out_block,
163
    const std::string host_arg_name,
164
    std::string device_arg_name,
165
    symbolic::Expression size,
166
    symbolic::Expression page_size
167
) {
×
NEW
168
    offloading::add_offloading_node<ROCMDataOffloadingNode>(
×
NEW
169
        builder,
×
170
        copy_out_block,
×
NEW
171
        host_arg_name,
×
NEW
172
        device_arg_name,
×
NEW
173
        offloading::DataTransferDirection::D2H,
×
NEW
174
        offloading::BufferLifecycle::FREE,
×
NEW
175
        builder.subject().type(host_arg_name),
×
NEW
176
        builder.subject().type(device_arg_name),
×
177
        this->map_.debug_info(),
×
178
        size,
×
NEW
179
        symbolic::integer(0)
×
180
    );
×
UNCOV
181
}
×
182

183
void ROCMTransform::to_json(nlohmann::json& j) const {
×
184
    std::string loop_type;
×
185
    if (dynamic_cast<structured_control_flow::Map*>(&map_)) {
×
186
        loop_type = "map";
×
187
    } else {
×
188
        throw std::runtime_error("Unsupported loop type for serialization of loop: " + map_.indvar()->get_name());
×
189
    }
×
190

191
    j["transformation_type"] = this->name();
×
192
    j["subgraph"] = {{"0", {{"element_id", this->map_.element_id()}, {"type", loop_type}}}};
×
193
    j["parameters"] = {{"block_size", block_size_}};
×
194
};
×
195

196
ROCMTransform ROCMTransform::from_json(builder::StructuredSDFGBuilder& builder, const nlohmann::json& desc) {
×
197
    auto loop_id = desc["subgraph"]["0"]["element_id"].get<size_t>();
×
198
    size_t block_size = desc["parameters"]["block_size"].get<size_t>();
×
199
    auto element = builder.find_element_by_id(loop_id);
×
200
    if (!element) {
×
201
        throw transformations::
×
202
            InvalidTransformationDescriptionException("Element with ID " + std::to_string(loop_id) + " not found.");
×
203
    }
×
204
    auto map = dynamic_cast<structured_control_flow::Map*>(element);
×
205

206
    return ROCMTransform(*map, block_size);
×
207
};
×
208

209

210
} // namespace rocm
211
} // 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