Skip to content

Commit aed7477

Browse files
yaroslavessayed
authored andcommitted
clip of tile size in IteratorCfg ctor
1 parent 279def7 commit aed7477

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/mli_iterator.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,13 @@ class IteratorCfg {
141141
// Constructor that will compute the number of tiles in each dimension, it will also compute the increment values and sizes.
142142
template <typename buf_T>
143143
IteratorCfg(const Tensor<buf_T, iterRank>& tensor, // full tensor to be iterated
144-
const uint32_t tilesize[], // size of the tile
145-
const int32_t order[], // iteration order
144+
const uint32_t tilesize[iterRank], // size of the tile
145+
const int32_t order[iterRank], // iteration order
146146
uint32_t skew = 0) { // skewing on first iteration dimension (reduction of the first tile size, used in fused processing to avoid triple buffering)
147147
MLI_ASSERT(tilesize[order[0]] >= skew);
148148
for (uint32_t i = 0; i < iterRank; ++i, skew = 0) {
149149
int32_t dim = order[i];
150+
MLI_ASSERT(tilesize[dim] <= tensor.get_dim(dim));
150151
m_order[i] = dim;
151152
m_count[i] = CEIL_DIV(tensor.get_dim(dim) + skew, tilesize[dim]);
152153
m_first_size[i] = m_first_pos_inc[i] = tilesize[dim] - skew;

0 commit comments

Comments
 (0)