Skip to content

Commit

Permalink
Handle broadcasts too
Browse files Browse the repository at this point in the history
  • Loading branch information
dsharlet committed Jan 10, 2024
1 parent 266042d commit a06d741
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/optimizations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,12 @@ class copy_optimizer : public node_mutator {
}
bool handled = false;
if (dep_count == 0) {
// This dimension is a broadcast.
// TODO: We should be able to let the copy handle this.
// This dimension is a broadcast. To handle this, we're going to add a dummy dimension to the input.
// We can just always do this, regardless of whether this broadcast is implicit (the input has fewer
// dimensions than the output) or not.
src_dims.emplace_back(buffer_bounds(dst_var, dst_d), 0, expr());
dst_d++;
handled = true;
} else if (dep_count == 1) {
expr offset;
interval_expr bounds;
Expand Down

0 comments on commit a06d741

Please sign in to comment.