diff --git a/src/pystencils/gpu/indexing.py b/src/pystencils/gpu/indexing.py index 0b062baf8a194eace298725e397480b7cc75a897..c1b0c0936d1ae0c68345bd472b46cf65bd161cb2 100644 --- a/src/pystencils/gpu/indexing.py +++ b/src/pystencils/gpu/indexing.py @@ -226,7 +226,7 @@ class BlockIndexing(AbstractIndexing): end = [s.stop if s.stop != 0 else 1 for s in numeric_iteration_slice] for i, s in enumerate(numeric_iteration_slice): if s.step and s.step != 1: - end[i] = div_floor(end[i], s.step) + end[i] = div_ceil(s.stop - s.start, s.step) + s.start if self._dim < 4: conditions = [c < e for c, e in zip(self.coordinates, end)]