Skip to content

[MLIR][Affine] Loop with missing lower and upper bound from affine-data-copy-generate #127808

@bondhugula

Description

@bondhugula

For this test case, invalid IR is being generated unchecked (outermost loop's bounds missing)

// CHECK-LABEL: func @affine_parallel

`bin/mlir-opt ../mlir/test/Dialect/Affine/affine-data-copy.mlir -split-input-file -affine-data-copy-generate="generate-dma=false fast-mem-space=0 skip-non-unit-stride-loops"

func.func @affine_parallel(%arg0: memref<2x5x4x2xi64>) {
    %c80 = arith.constant 80 : index
    %c0 = arith.constant 0 : index
    %c0_0 = arith.constant 0 : index
    %alloc = memref.alloc() : memref<2x5x4x2xi64>
    affine.for %arg1 = max #map() to min #map() {
      affine.for %arg2 = 0 to 5 {
        affine.for %arg3 = 0 to 4 {
          affine.for %arg4 = 0 to 2 {
            %0 = affine.load %arg0[%arg1, %arg2, %arg3, %arg4] : memref<2x5x4x2xi64>
            affine.store %0, %alloc[%arg1, %arg2, %arg3, %arg4] : memref<2x5x4x2xi64>
          }
        }
      }
    }
    affine.for %arg1 = 0 to 2 {
      affine.parallel (%arg2) = (0) to (5) {
        affine.parallel (%arg3) = (0) to (4) {
          affine.for %arg4 = #map1(%arg1, %arg2, %arg3) to #map2(%arg1, %arg2, %arg3) {
            %0 = affine.load %alloc[((%arg4 floordiv 2) floordiv 4) floordiv 5, ((%arg4 floordiv 2) floordiv 4) mod 5, (%arg4 floordiv 2) mod 4, %arg4 mod 2] : memref<2x5x4x2xi64>
          }
        }
      }
    }
    memref.dealloc %alloc : memref<2x5x4x2xi64>
    return
  }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions