Closed chhzh123 closed 2 years ago
MLIR does not allow to pass in a negative step in affine.for, making the following code invalid.
affine.for
module { func @top(%arg0: memref<10xi32>) attributes {extra_itypes = "s", extra_otypes = ""} { %0 = hcl.create_stage_handle "" : !hcl.StageHandle %1 = hcl.create_loop_handle "loop_0" : !hcl.LoopHandle affine.for %arg1 = 9 to -1 step -1 { %2 = arith.index_cast %arg1 : index to i32 affine.store %2, %arg0[%arg1] {to = "compute_0"} : memref<10xi32> } {loop_name = "loop_0"} return } } loc("-":3:37): error: custom op 'affine.for' expected step to be representable as a positive signed integer
We need to find a way to support negative steps, either using scf.for or canonicalizing the loop.
scf.for
MLIR does not allow to pass in a negative step in
affine.for
, making the following code invalid.We need to find a way to support negative steps, either using
scf.for
or canonicalizing the loop.