Skip to content

Commit

Permalink
extent 1 doesn't need another loop
Browse files Browse the repository at this point in the history
  • Loading branch information
dsharlet committed Jan 13, 2025
1 parent 9f95b4a commit 9ba68d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ SLINKY_NO_INLINE index_t make_for_each_loops_impl(
}
}

if (d > 0 && (extent == 1 || can_fuse(bufs, bufs_size, d))) {
if (extent == 1 || (d > 0 && can_fuse(bufs, bufs_size, d))) {
// Let this fuse with the next dimension.
} else if (SkipContiguous && is_contiguous_slice(bufs, bufs_size, d)) {
// This is the slice dimension.
Expand All @@ -564,7 +564,7 @@ SLINKY_NO_INLINE index_t make_for_each_loops_impl(
extent = 1;

index_t* strides = increment_plan<index_t>(plan, bufs_size);
strides[0] = buf->dim(d).stride();
strides[0] = buf_dim.stride();
for (std::size_t n = 1; n < bufs_size; n++) {
strides[n] = d < static_cast<index_t>(bufs[n]->rank) ? bufs[n]->dim(d).stride() : 0;
}
Expand Down

0 comments on commit 9ba68d1

Please sign in to comment.