Skip to content

Commit

Permalink
Explicitly name the allocgroups on GPU schedules "allocgroup__..." (#…
Browse files Browse the repository at this point in the history
…7883)

* 50cents readibility improvement to allocgroups on GPU schedules.

* Improve allocation group prefix: only if the alloc group cluster contains more than 1 allocation prepend the prefix.
  • Loading branch information
mcourteaux authored Oct 12, 2023
1 parent 509140a commit a3911bb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/FuseGPUThreadLoops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,15 +800,23 @@ class ExtractSharedAndHeapAllocations : public IRMutator {
string name;
Expr total_size = 0;
Type widest_type;
int number_of_allocs = 0;
for (const auto &alloc : cluster) {
number_of_allocs += alloc.group.size();
}
for (const auto &alloc : cluster) {
if (name.empty()) {
name = alloc.name;
widest_type = alloc.widest_type;
if (number_of_allocs > 1) {
name = "allocgroup__" + alloc.name;
} else {
name = alloc.name;
}
} else {
name += "__" + alloc.name;
if (alloc.widest_type.bytes() > widest_type.bytes()) {
widest_type = alloc.widest_type;
}
name += "__" + alloc.name;
}
int ratio = alloc.widest_type.bytes() / alloc_type.bytes();
internal_assert(ratio != 0)
Expand Down

0 comments on commit a3911bb

Please sign in to comment.