diff --git a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp --- a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp @@ -1292,7 +1292,7 @@ // If we are vectorizing a vector dimension, compute a new step for the new // vectorized loop using the vectorization factor for the vector dimension. // Otherwise, propagate the step of the scalar loop. - unsigned newStep; + int64_t newStep; if (isLoopVecDim) { unsigned vectorDim = loopToVecDimIt->second; assert(vectorDim < strategy.vectorSizes.size() && "vector dim overflow"); diff --git a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir --- a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir +++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir @@ -684,3 +684,16 @@ // CHECK-LABEL: @vec_vecdim_reduction_rejected // CHECK-NOT: vector + +// ----- + +// CHECK-LABEL: @large_step_size +// Support the step size exceeding 2^32-1. +func.func @large_step_size(%A: memref<4294967295xf32>) { + %cst = arith.constant 0.000000e+00 : f32 + // CHECK: affine.for %{{.*}} = 0 to 256 step 549755813760 { + affine.for %i = 0 to 256 step 4294967295 { + affine.store %cst, %A[%i] : memref<4294967295xf32> + } + return +} \ No newline at end of file